mirror of
https://github.com/aap/librw.git
synced 2025-12-22 10:29:55 +00:00
changed pipe new to explicit create
This commit is contained in:
@@ -84,8 +84,10 @@ registerPDSPlugin(int32 n)
|
||||
void
|
||||
registerPluginPDSPipes(void)
|
||||
{
|
||||
// TODO: how do we destroy them?
|
||||
|
||||
// rwPDS_G3_Skin_GrpMatPipeID
|
||||
MatPipeline *pipe = new MatPipeline(PLATFORM_PS2);
|
||||
MatPipeline *pipe = MatPipeline::create();
|
||||
pipe->pluginID = ID_PDS;
|
||||
pipe->pluginData = 0x11001;
|
||||
pipe->attribs[AT_XYZ] = &attribXYZ;
|
||||
@@ -103,14 +105,14 @@ registerPluginPDSPipes(void)
|
||||
registerPDSPipe(pipe);
|
||||
|
||||
// rwPDS_G3_Skin_GrpAtmPipeID
|
||||
ObjPipeline *opipe = new ObjPipeline(PLATFORM_PS2);
|
||||
ObjPipeline *opipe = ObjPipeline::create();
|
||||
opipe->pluginID = ID_PDS;
|
||||
opipe->pluginData = 0x11002;
|
||||
opipe->groupPipeline = pipe;
|
||||
registerPDSPipe(opipe);
|
||||
|
||||
// rwPDS_G3_MatfxUV1_GrpMatPipeID
|
||||
pipe = new MatPipeline(PLATFORM_PS2);
|
||||
pipe = MatPipeline::create();
|
||||
pipe->pluginID = ID_PDS;
|
||||
pipe->pluginData = 0x1100b;
|
||||
pipe->attribs[AT_XYZ] = &attribXYZ;
|
||||
@@ -124,14 +126,14 @@ registerPluginPDSPipes(void)
|
||||
registerPDSPipe(pipe);
|
||||
|
||||
// rwPDS_G3_MatfxUV1_GrpAtmPipeID
|
||||
opipe = new ObjPipeline(PLATFORM_PS2);
|
||||
opipe = ObjPipeline::create();
|
||||
opipe->pluginID = ID_PDS;
|
||||
opipe->pluginData = 0x1100d;
|
||||
opipe->groupPipeline = pipe;
|
||||
registerPDSPipe(opipe);
|
||||
|
||||
// rwPDS_G3_MatfxUV2_GrpMatPipeID
|
||||
pipe = new MatPipeline(PLATFORM_PS2);
|
||||
pipe = MatPipeline::create();
|
||||
pipe->pluginID = ID_PDS;
|
||||
pipe->pluginData = 0x1100c;
|
||||
pipe->attribs[AT_XYZ] = &attribXYZ;
|
||||
@@ -145,7 +147,7 @@ registerPluginPDSPipes(void)
|
||||
registerPDSPipe(pipe);
|
||||
|
||||
// rwPDS_G3_MatfxUV2_GrpAtmPipeID
|
||||
opipe = new ObjPipeline(PLATFORM_PS2);
|
||||
opipe = ObjPipeline::create();
|
||||
opipe->pluginID = ID_PDS;
|
||||
opipe->pluginData = 0x1100e;
|
||||
opipe->groupPipeline = pipe;
|
||||
@@ -154,19 +156,19 @@ registerPluginPDSPipes(void)
|
||||
// RW World plugin
|
||||
|
||||
// rwPDS_G3x_Generic_AtmPipeID
|
||||
opipe = new ObjPipeline(PLATFORM_PS2);
|
||||
opipe = ObjPipeline::create();
|
||||
opipe->pluginID = ID_PDS;
|
||||
opipe->pluginData = 0x50001;
|
||||
registerPDSPipe(opipe);
|
||||
|
||||
// rwPDS_G3x_Skin_AtmPipeID
|
||||
opipe = new ObjPipeline(PLATFORM_PS2);
|
||||
opipe = ObjPipeline::create();
|
||||
opipe->pluginID = ID_PDS;
|
||||
opipe->pluginData = 0x5000b;
|
||||
registerPDSPipe(opipe);
|
||||
|
||||
// rwPDS_G3xd_A4D_MatPipeID
|
||||
pipe = new MatPipeline(PLATFORM_PS2);
|
||||
pipe = MatPipeline::create();
|
||||
pipe->pluginID = ID_PDS;
|
||||
pipe->pluginData = 0x5002f;
|
||||
pipe->attribs[0] = &attribXYZW;
|
||||
@@ -180,7 +182,7 @@ registerPluginPDSPipes(void)
|
||||
registerPDSPipe(pipe);
|
||||
|
||||
// rwPDS_G3xd_A4DSkin_MatPipeID
|
||||
pipe = new MatPipeline(PLATFORM_PS2);
|
||||
pipe = MatPipeline::create();
|
||||
pipe->pluginID = ID_PDS;
|
||||
pipe->pluginData = 0x5003e;
|
||||
pipe->attribs[0] = &attribXYZW;
|
||||
|
||||
@@ -437,12 +437,30 @@ instanceNormal(uint32 *wp, Geometry *g, Mesh *m, uint32 idx, uint32 n)
|
||||
return (uint32*)p;
|
||||
}
|
||||
|
||||
MatPipeline::MatPipeline(uint32 platform)
|
||||
: rw::Pipeline(platform), instanceCB(nil), uninstanceCB(nil),
|
||||
preUninstCB(nil), postUninstCB(nil)
|
||||
void
|
||||
MatPipeline::init(void)
|
||||
{
|
||||
this->rw::Pipeline::init(PLATFORM_PS2);
|
||||
for(int i = 0; i < 10; i++)
|
||||
this->attribs[i] = nil;
|
||||
this->instanceCB = nil;
|
||||
this->uninstanceCB = nil;
|
||||
this->preUninstCB = nil;
|
||||
this->postUninstCB = nil;
|
||||
}
|
||||
|
||||
MatPipeline*
|
||||
MatPipeline::create(void)
|
||||
{
|
||||
MatPipeline *pipe = rwNewT(MatPipeline, 1, MEMDUR_GLOBAL);
|
||||
pipe->init();
|
||||
return pipe;
|
||||
}
|
||||
|
||||
void
|
||||
MatPipeline::destroy(void)
|
||||
{
|
||||
rwFree(this);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -911,14 +929,23 @@ objUninstance(rw::ObjPipeline *rwpipe, Atomic *atomic)
|
||||
*/
|
||||
}
|
||||
|
||||
ObjPipeline::ObjPipeline(uint32 platform)
|
||||
: rw::ObjPipeline(platform)
|
||||
void
|
||||
ObjPipeline::init(void)
|
||||
{
|
||||
this->rw::ObjPipeline::init(PLATFORM_PS2);
|
||||
this->groupPipeline = nil;
|
||||
this->impl.instance = objInstance;
|
||||
this->impl.uninstance = objUninstance;
|
||||
}
|
||||
|
||||
ObjPipeline*
|
||||
ObjPipeline::create(void)
|
||||
{
|
||||
ObjPipeline *pipe = rwNewT(ObjPipeline, 1, MEMDUR_GLOBAL);
|
||||
pipe->init();
|
||||
return pipe;
|
||||
}
|
||||
|
||||
void
|
||||
insertVertex(Geometry *geo, int32 i, uint32 mask, Vertex *v)
|
||||
{
|
||||
@@ -1082,7 +1109,7 @@ ObjPipeline*
|
||||
makeDefaultPipeline(void)
|
||||
{
|
||||
if(defaultMatPipe == nil){
|
||||
MatPipeline *pipe = new MatPipeline(PLATFORM_PS2);
|
||||
MatPipeline *pipe = MatPipeline::create();
|
||||
pipe->attribs[AT_XYZ] = &attribXYZ;
|
||||
pipe->attribs[AT_UV] = &attribUV;
|
||||
pipe->attribs[AT_RGBA] = &attribRGBA;
|
||||
@@ -1095,7 +1122,7 @@ makeDefaultPipeline(void)
|
||||
}
|
||||
|
||||
if(defaultObjPipe == nil){
|
||||
ObjPipeline *opipe = new ObjPipeline(PLATFORM_PS2);
|
||||
ObjPipeline *opipe = ObjPipeline::create();
|
||||
defaultObjPipe = opipe;
|
||||
}
|
||||
return defaultObjPipe;
|
||||
|
||||
@@ -29,6 +29,9 @@ matfxOpen(void *o, int32, int32)
|
||||
static void*
|
||||
matfxClose(void *o, int32, int32)
|
||||
{
|
||||
((ObjPipeline*)matFXGlobals.pipelines[PLATFORM_PS2])->groupPipeline->destroy();
|
||||
((ObjPipeline*)matFXGlobals.pipelines[PLATFORM_PS2])->destroy();
|
||||
matFXGlobals.pipelines[PLATFORM_PS2] = nil;
|
||||
return o;
|
||||
}
|
||||
|
||||
@@ -42,7 +45,7 @@ initMatFX(void)
|
||||
ObjPipeline*
|
||||
makeMatFXPipeline(void)
|
||||
{
|
||||
MatPipeline *pipe = new MatPipeline(PLATFORM_PS2);
|
||||
MatPipeline *pipe = MatPipeline::create();
|
||||
pipe->pluginID = ID_MATFX;
|
||||
pipe->pluginData = 0;
|
||||
pipe->attribs[AT_XYZ] = &attribXYZ;
|
||||
@@ -54,7 +57,7 @@ makeMatFXPipeline(void)
|
||||
pipe->vifOffset = pipe->inputStride*vertCount;
|
||||
pipe->uninstanceCB = genericUninstanceCB;
|
||||
|
||||
ObjPipeline *opipe = new ObjPipeline(PLATFORM_PS2);
|
||||
ObjPipeline *opipe = ObjPipeline::create();
|
||||
opipe->pluginID = ID_MATFX;
|
||||
opipe->pluginData = 0;
|
||||
opipe->groupPipeline = pipe;
|
||||
|
||||
@@ -31,6 +31,10 @@ skinOpen(void *o, int32, int32)
|
||||
static void*
|
||||
skinClose(void *o, int32, int32)
|
||||
{
|
||||
((ObjPipeline*)skinGlobals.pipelines[PLATFORM_PS2])->groupPipeline->destroy();
|
||||
((ObjPipeline*)skinGlobals.pipelines[PLATFORM_PS2])->groupPipeline = nil;
|
||||
((ObjPipeline*)skinGlobals.pipelines[PLATFORM_PS2])->destroy();
|
||||
skinGlobals.pipelines[PLATFORM_PS2] = nil;
|
||||
return o;
|
||||
}
|
||||
|
||||
@@ -44,7 +48,7 @@ initSkin(void)
|
||||
ObjPipeline*
|
||||
makeSkinPipeline(void)
|
||||
{
|
||||
MatPipeline *pipe = new MatPipeline(PLATFORM_PS2);
|
||||
MatPipeline *pipe = MatPipeline::create();
|
||||
pipe->pluginID = ID_SKIN;
|
||||
pipe->pluginData = 1;
|
||||
pipe->attribs[AT_XYZ] = &attribXYZ;
|
||||
@@ -60,7 +64,7 @@ makeSkinPipeline(void)
|
||||
pipe->preUninstCB = skinPreCB;
|
||||
pipe->postUninstCB = skinPostCB;
|
||||
|
||||
ObjPipeline *opipe = new ObjPipeline(PLATFORM_PS2);
|
||||
ObjPipeline *opipe = ObjPipeline::create();
|
||||
opipe->pluginID = ID_SKIN;
|
||||
opipe->pluginData = 1;
|
||||
opipe->groupPipeline = pipe;
|
||||
|
||||
@@ -132,7 +132,9 @@ public:
|
||||
return (top-outBufs)/(inAttribs*2+outAttribs*outBufs);
|
||||
}
|
||||
|
||||
MatPipeline(uint32 platform);
|
||||
void init(void);
|
||||
static MatPipeline *create(void);
|
||||
void destroy(void);
|
||||
void dump(void);
|
||||
void setTriBufferSizes(uint32 inputStride, uint32 bufferSize);
|
||||
void instance(Geometry *g, InstanceData *inst, Mesh *m);
|
||||
@@ -142,14 +144,15 @@ public:
|
||||
class ObjPipeline : public rw::ObjPipeline
|
||||
{
|
||||
public:
|
||||
void init(void);
|
||||
static ObjPipeline *create(void);
|
||||
|
||||
MatPipeline *groupPipeline;
|
||||
// RW has more:
|
||||
// setupCB()
|
||||
// finalizeCB()
|
||||
// lightOffset
|
||||
// lightSize
|
||||
|
||||
ObjPipeline(uint32 platform);
|
||||
};
|
||||
|
||||
struct Vertex {
|
||||
|
||||
Reference in New Issue
Block a user