Results 1 to 8 of 8

  Click here to go to the first Developer post in this thread.  

Thread: Pal2pac.dll texture handling

  1. #1
    I don't want to keep this cool info away from you, even if most editors might have no use for it.
    The Pal2Pac.dll is included with O2. The rest of the info is inside the header.

    Big THX to SUMA! ***

    Quote Originally Posted by (Dschulle @ Jan. 28 2004,17:18)
    Could you provide me with a header file? Or give me the complete function call of "CreateTexture" and "CombineTexture".
    Here you are:


    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#ifndef _PAL2PAC_HPP
    #define _PAL2PAC_HPP

    #define MYDLL _ _ declspec &#40; dllexport &#41; _ _ stdcall
    //the spaces should not be there,
    // but iconboard does not like it without them

    // dynamic linking types etc...

    extern &#34;C&#34;
    {

    // Objektiv Interface

    int MYDLL AddTexture&#40; const char *libPath, const char *textPath, int size &#41;;
    int MYDLL UpdateTexture&#40; const char *dest, const char *src, int size &#41;;

    int MYDLL CombineTexture
    &#40;
    const char *D, const char *S1, const char *S2, const char *S3, const char *S4,
    int size, const char *bank, const char *water
    &#41;;

    // Visitor Interface
    void MYDLL TextureMix
    &#40;
    const char *t,
    const char *s1, const char *s2, const char *s3, const char *s4,
    const char *bankDirectory, const char *bankTexture
    &#41;;

    struct TextureDataStruct
    {
    int _w,_h; // data dimensions
    DWORD *_data; // pointer to ARGB 8888 data
    };
    void MYDLL CreateTextureData&#40; TextureDataStruct &data, const char *name &#41;;
    void MYDLL DestroyTextureData&#40; TextureDataStruct &data &#41;;

    COLORREF MYDLL TextureColor&#40; const char *s &#41;;
    DWORD MYDLL TextureColorARGB&#40; const char *s &#41;;

    typedef int stdcall UpdateTextureT&#40; const char *dest, const char *src, int size &#41;;

    typedef void stdcall DestroyTextureDataT&#40; TextureDataStruct &data &#41;;

    };

    extern UpdateTextureT *UpdateTextureF;
    extern CreateTextureDataT *CreateTextureDataF;
    extern DestroyTextureDataT *DestroyTextureDataF;

    void InitPal2Pac&#40;&#41;;

    // class encapsulation of TextureDataStruct
    class TextureData
    {
    struct TextureDataStruct _data;

    public&#58;
    TextureData&#40; const char *name=NULL &#41;
    {
    if &#40;&#33;CreateTextureDataF&#41; return;
    CreateTextureDataF&#40;_data,name&#41;;
    }
    ~TextureData&#40;&#41;
    {
    if &#40;&#33;DestroyTextureDataF&#41; return;
    DestroyTextureDataF&#40;_data&#41;;
    }
    void Load&#40; const char *name &#41;
    {
    if &#40;&#33;CreateTextureDataF&#41; return;
    if &#40;&#33;DestroyTextureDataF&#41; return;
    DestroyTextureDataF&#40;_data&#41;;
    CreateTextureDataF&#40;_data,name&#41;;
    }

    int W&#40;&#41; const {return _data._w;}
    int H&#40;&#41; const {return _data._h;}
    const DWORD *Data&#40;&#41; const {return _data._data;}
    DWORD GetPixel&#40; int x, int y &#41; const {return _data._data&#91;y*_data._w+x&#93;;}

    private&#58;
    TextureData&#40; const TextureData &src &#41;;
    void operator =&#40; const TextureData &src &#41;;
    };

    #endif
    [/QUOTE]

    If you think anyone else can use this for the benefit of OPF community, feel free to share it. You can create and load pal/pac files with this interface. It is far from flexible, but it may help you.




  2. #2
    Sergeant Major
    Join Date
    Jul 13 2001
    Location
    Orlando Florida
    Posts
    1,491
    OK, explain the use of this for a dummy like me. Will it make pac files "better"? Will it allow people to make batch converters? etc?




  3.   Click here to go to the next Developer post in this thread.   #3
    There really ain&#39;t a thread for this...

    Basicly, this is the critical core code for exporting graphics into OFP PAA/PAC format. If you want to make a converter like texview, or create a viewer application, or a wrp editor, this is the key to WRITING textures.

    Essentially, this is just the skeleton _defs and code to structure your data arrays of pixels, and properly process them through the pal2pac.dll included with Oxygen.

    The biggest need that can now be filled is to make a transition masher, where you could load in some base textures, a list of desired transitions, and punch out textures. Or you could make a converter for other raw formats.
    And where is that band that so vauntingly swore, That the havoc of war and the battle's confusion,
    A home and a country shall leave us no more? Their blood has washed out their foul footstep's pollution.
    No refuge could save the hireling and slave, From the terror of flight, or the gloom of the grave;
    And the Star-Spangled Banner in triumph doth wave O'er the land of the free and the home of the brave!
    (3rd stanza of the Star-Spangled Banner)

  4. #4
    Sergeant Major
    Join Date
    Jul 13 2001
    Location
    Orlando Florida
    Posts
    1,491
    well, my dream tool is a batch converter for taking a whole folder of tgas and converting them to paa or pac... hope someone makes one now

  5.   Click here to go to the next Developer post in this thread.   #5

  6. #6
    Quote Originally Posted by (Ebud @ Jan. 29 2004,07:12)
    well, my dream tool is a batch converter for taking a whole folder of tgas and converting them to paa or pac... hope someone makes one now
    You allready can do this with the pal2pace.exe you find in your Bulldozer folder:

    pal2pace *.tga


    Unfortunately this header file doesn&#39;t enable us to write a better textur converter than texView since the dll encapsulates the function for the texture compression and the file headers for the texture files are still unknown so that you can&#39;t write your own compression function.

    But it makes it much easier for tools like WrpTool to read and write OFP textures.

  7.   This is the last Developer post in this thread.   #7
    BI Developer Suma's Avatar
    Join Date
    Jun 27 2001
    Location
    Czech Republic
    Posts
    3,707
    I think O2 Doc will suit best for this topic.
    Ondrej Spanel, BIS Lead Programmer

  8. #8
    Quote Originally Posted by (Dwarden @ Jan. 29 2004,07:59)
    I got idea, can someone made .paa .pac plugin for IrfanView? ))
    Currently Dschulle is trying to integrate the pal2pac.dll into PaNSee, the texture browser that comes with WrpTool.

    We are also looking into writing a plugin for Photoshop (and programs who can also use PS-plugins like PSP and others), but the problem is that pal2pac needs file names and writes the files by itself wich isn&#39;t the way a PS-plugin should handle it.
    A PS-plugin only gets a buffer to write the data into, while PS handles all the file creating and opening stuff, you don&#39;t even get the filename from Photoshop.

    So what we would need for this is basically the source code of the pal2pac.dll or some info about the texture file headers of paa and pac files (just the header info, we allready know the different formats for the texture data and how to write/read it)


    .....................................

    WrpTool dev




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •