PDA

View Full Version : Pal2pac.dll texture handling



Dschulle
Jan 28 2004, 19:04
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!  http://forums.bistudio.com/oldsmileys/biggrin_o.gif


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.

Ebud
Jan 28 2004, 23:53
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?

Placebo
Jan 28 2004, 23:59
And when he finds out I can hopefully find out which forum I should be moving the thread to, all I know is general isn&#39;t the right one http://forums.bistudio.com/oldsmileys/smile_o.gif

shinRaiden
Jan 29 2004, 03:53
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.

Ebud
Jan 29 2004, 05: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 http://forums.bistudio.com/oldsmileys/smile_o.gif

Dwarden
Jan 29 2004, 05:59
I got idea, can someone made .paa .pac plugin for IrfanView? http://forums.bistudio.com/oldsmileys/smile_o.gif))

Romolus
Jan 29 2004, 06:22
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 http://forums.bistudio.com/oldsmileys/smile_o.gif
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.

Placebo
Jan 29 2004, 07:24
A&M:D Will do then http://forums.bistudio.com/oldsmileys/smile_o.gif

Suma
Jan 29 2004, 07:25
This certainly does not belong to General discussion.