2015-01-25 22:27:03 +01:00
|
|
|
namespace rw {
|
|
|
|
namespace ps2 {
|
2014-12-20 15:05:34 +01:00
|
|
|
|
2014-12-30 17:39:39 +01:00
|
|
|
struct InstanceData
|
2014-12-20 15:05:34 +01:00
|
|
|
{
|
2014-12-30 19:30:13 +01:00
|
|
|
// 0 - addresses in ref tags need fixing
|
|
|
|
// 1 - no ref tags, so no fixing
|
|
|
|
// set by the program:
|
|
|
|
// 2 - ref tags are fixed, need to unfix before stream write
|
|
|
|
uint32 arePointersFixed;
|
2014-12-20 15:05:34 +01:00
|
|
|
uint32 dataSize;
|
|
|
|
uint8 *data;
|
|
|
|
Material *material;
|
2014-12-20 18:13:45 +01:00
|
|
|
};
|
2014-12-20 15:05:34 +01:00
|
|
|
|
2015-01-25 22:27:03 +01:00
|
|
|
struct InstanceDataHeader : rw::InstanceDataHeader
|
2014-12-20 15:05:34 +01:00
|
|
|
{
|
|
|
|
uint32 numMeshes;
|
2014-12-30 17:39:39 +01:00
|
|
|
InstanceData *instanceMeshes;
|
2014-12-20 15:05:34 +01:00
|
|
|
};
|
|
|
|
|
2015-07-11 23:48:11 +02:00
|
|
|
enum {
|
|
|
|
VU_Lights = 0x3d0
|
|
|
|
};
|
|
|
|
|
2015-01-25 22:27:03 +01:00
|
|
|
void *destroyNativeData(void *object, int32, int32);
|
|
|
|
void readNativeData(Stream *stream, int32 len, void *object, int32, int32);
|
|
|
|
void writeNativeData(Stream *stream, int32 len, void *object, int32, int32);
|
|
|
|
int32 getSizeNativeData(void *object, int32, int32);
|
|
|
|
void registerNativeDataPlugin(void);
|
2015-01-06 23:17:05 +01:00
|
|
|
|
2015-07-12 22:57:05 +02:00
|
|
|
void printDMA(InstanceData *inst);
|
2015-01-06 23:17:05 +01:00
|
|
|
void walkDMA(InstanceData *inst, void (*f)(uint32 *data, int32 size));
|
|
|
|
void sizedebug(InstanceData *inst);
|
2014-12-20 18:13:45 +01:00
|
|
|
|
2014-12-30 19:30:13 +01:00
|
|
|
// only RW_PS2
|
|
|
|
void fixDmaOffsets(InstanceData *inst);
|
|
|
|
void unfixDmaOffsets(InstanceData *inst);
|
2015-07-11 23:48:11 +02:00
|
|
|
//
|
|
|
|
|
2015-08-01 23:03:10 +02:00
|
|
|
class MatPipeline : public rw::Pipeline
|
2015-07-11 23:48:11 +02:00
|
|
|
{
|
2015-08-01 23:03:10 +02:00
|
|
|
public:
|
2015-07-11 23:48:11 +02:00
|
|
|
uint32 vifOffset;
|
|
|
|
uint32 inputStride;
|
|
|
|
uint32 triStripCount, triListCount;
|
2015-08-01 23:03:10 +02:00
|
|
|
PipeAttribute *attribs[10];
|
2015-08-02 19:31:01 +02:00
|
|
|
void (*instanceCB)(MatPipeline*, Geometry*, Mesh*, uint8**, int32);
|
2015-07-11 23:48:11 +02:00
|
|
|
|
|
|
|
static uint32 getVertCount(uint32 top, uint32 inAttribs,
|
|
|
|
uint32 outAttribs, uint32 outBufs) {
|
|
|
|
return (top-outBufs)/(inAttribs*2+outAttribs*outBufs);
|
|
|
|
}
|
|
|
|
|
2015-08-01 23:03:10 +02:00
|
|
|
MatPipeline(uint32 platform);
|
|
|
|
virtual void dump(void);
|
|
|
|
void setTriBufferSizes(uint32 inputStride, uint32 stripCount);
|
2015-08-02 19:31:01 +02:00
|
|
|
void instance(Geometry *g, InstanceData *inst, Mesh *m);
|
2015-08-01 23:03:10 +02:00
|
|
|
};
|
|
|
|
|
2015-08-02 19:31:01 +02:00
|
|
|
class ObjPipeline : public rw::ObjPipeline
|
2015-08-01 23:03:10 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
MatPipeline *groupPipeline;
|
|
|
|
|
|
|
|
ObjPipeline(uint32 platform);
|
2015-07-12 22:57:05 +02:00
|
|
|
virtual void instance(Atomic *atomic);
|
|
|
|
virtual void uninstance(Atomic *atomic);
|
2015-07-11 23:48:11 +02:00
|
|
|
};
|
|
|
|
|
2015-08-01 23:03:10 +02:00
|
|
|
extern ObjPipeline *defaultObjPipe;
|
|
|
|
extern MatPipeline *defaultMatPipe;
|
|
|
|
|
|
|
|
ObjPipeline *makeDefaultPipeline(void);
|
|
|
|
ObjPipeline *makeSkinPipeline(void);
|
|
|
|
ObjPipeline *makeMatFXPipeline(void);
|
2015-07-11 23:48:11 +02:00
|
|
|
void dumpPipeline(rw::Pipeline *pipe);
|
2014-12-30 19:30:13 +01:00
|
|
|
|
2015-01-07 23:06:44 +01:00
|
|
|
// Skin plugin
|
|
|
|
|
2015-01-25 22:27:03 +01:00
|
|
|
void readNativeSkin(Stream *stream, int32, void *object, int32 offset);
|
|
|
|
void writeNativeSkin(Stream *stream, int32 len, void *object, int32 offset);
|
|
|
|
int32 getSizeNativeSkin(void *object, int32 offset);
|
2015-01-07 23:06:44 +01:00
|
|
|
|
2015-01-06 23:17:05 +01:00
|
|
|
// ADC plugin
|
|
|
|
|
2015-08-16 16:44:59 +02:00
|
|
|
// Each element in adcBits corresponds to an index in Mesh->indices,
|
|
|
|
// this assumes the Mesh indices are ADC formatted.
|
|
|
|
// For some reason ADCData->numBits != Mesh->numIndices
|
2015-01-06 23:17:05 +01:00
|
|
|
|
|
|
|
struct ADCData
|
|
|
|
{
|
2015-08-16 16:44:59 +02:00
|
|
|
bool32 adcFormatted;
|
|
|
|
int8 *adcBits;
|
|
|
|
int32 numBits;
|
2015-01-06 23:17:05 +01:00
|
|
|
};
|
|
|
|
|
2015-01-25 22:27:03 +01:00
|
|
|
void registerADCPlugin(void);
|
2015-01-06 23:17:05 +01:00
|
|
|
|
2015-08-01 23:03:10 +02:00
|
|
|
// PDS plugin
|
|
|
|
|
|
|
|
// IDs used by SA
|
|
|
|
// n atomic material
|
|
|
|
// 1892 53f20080 53f20081 // ?
|
|
|
|
// 1 53f20080 53f2008d // triad_buddha01.dff
|
|
|
|
// 56430 53f20082 53f20083 // world
|
|
|
|
// 39 53f20082 53f2008f // reflective world
|
|
|
|
// 6941 53f20084 53f20085 // vehicles
|
|
|
|
// 3423 53f20084 53f20087 // vehicles
|
|
|
|
// 4640 53f20084 53f2008b // vehicles
|
|
|
|
// 418 53f20088 53f20089 // peds
|
|
|
|
|
|
|
|
|
|
|
|
void registerPDSPlugin(void);
|
|
|
|
|
2014-12-20 15:05:34 +01:00
|
|
|
}
|
2014-12-30 17:39:39 +01:00
|
|
|
}
|