Sign in to follow this  
Followers 0
Dschulle

Pal2pac.dll texture handling

8 posts in this topic

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!  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 ( dllexport ) _ _ stdcall

//the spaces should not be there,

// but iconboard does not like it without them

// dynamic linking types etc...

extern "C"

{

// Objektiv Interface

int MYDLL AddTexture( const char *libPath, const char *textPath, int size );

int MYDLL UpdateTexture( const char *dest, const char *src, int size );

int MYDLL CombineTexture

(

const char *D, const char *S1, const char *S2, const char *S3, const char *S4,

int size, const char *bank, const char *water

);

// Visitor Interface

void MYDLL TextureMix

(

const char *t,

const char *s1, const char *s2, const char *s3, const char *s4,

const char *bankDirectory, const char *bankTexture

);

struct TextureDataStruct

{

int _w,_h; // data dimensions

DWORD *_data; // pointer to ARGB 8888 data

};

void MYDLL CreateTextureData( TextureDataStruct &data, const char *name );

void MYDLL DestroyTextureData( TextureDataStruct &data );

COLORREF MYDLL TextureColor( const char *s );

DWORD MYDLL TextureColorARGB( const char *s );

typedef int stdcall UpdateTextureT( const char *dest, const char *src, int size );

typedef void stdcall DestroyTextureDataT( TextureDataStruct &data );

};

extern UpdateTextureT *UpdateTextureF;

extern CreateTextureDataT *CreateTextureDataF;

extern DestroyTextureDataT *DestroyTextureDataF;

void InitPal2Pac();

// class encapsulation of TextureDataStruct

class TextureData

{

struct TextureDataStruct _data;

public:

TextureData( const char *name=NULL )

{

if (!CreateTextureDataF) return;

CreateTextureDataF(_data,name);

}

~TextureData()

{

if (!DestroyTextureDataF) return;

DestroyTextureDataF(_data);

}

void Load( const char *name )

{

if (!CreateTextureDataF) return;

if (!DestroyTextureDataF) return;

DestroyTextureDataF(_data);

CreateTextureDataF(_data,name);

}

int W() const {return _data._w;}

int H() const {return _data._h;}

const DWORD *Data() const {return _data._data;}

DWORD GetPixel( int x, int y ) const {return _data._data[y*_data._w+x];}

private:

TextureData( const TextureData &src );

void operator =( const TextureData &src );

};

#endif

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

There really ain'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.

Share this post


Link to post
Share on other sites

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 smile_o.gif

Share this post


Link to post
Share on other sites

I got idea, can someone made .paa .pac plugin for IrfanView? smile_o.gif))

Share this post


Link to post
Share on other sites
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 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'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't write your own compression function.

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

Share this post


Link to post
Share on other sites
I got idea, can someone made .paa .pac plugin for IrfanView? smile_o.gif))

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'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'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

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
Followers 0