mirror of
https://github.com/aap/librw.git
synced 2024-11-25 05:05:42 +00:00
moved d3d rendering code here
This commit is contained in:
parent
dc4011ba7a
commit
ad81510267
@ -191,7 +191,10 @@
|
||||
<ClCompile Include="src\clump.cpp" />
|
||||
<ClCompile Include="src\d3d.cpp" />
|
||||
<ClCompile Include="src\d3d8.cpp" />
|
||||
<ClCompile Include="src\d3d8render.cpp" />
|
||||
<ClCompile Include="src\d3d9.cpp" />
|
||||
<ClCompile Include="src\d3d9render.cpp" />
|
||||
<ClCompile Include="src\d3ddriver.cpp" />
|
||||
<ClCompile Include="src\geometry.cpp" />
|
||||
<ClCompile Include="src\image.cpp" />
|
||||
<ClCompile Include="src\ogl.cpp" />
|
||||
|
20
src/d3d9.cpp
20
src/d3d9.cpp
@ -10,8 +10,6 @@
|
||||
#include "rwd3d.h"
|
||||
#include "rwd3d9.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace rw {
|
||||
namespace d3d9 {
|
||||
using namespace d3d;
|
||||
@ -346,13 +344,28 @@ uninstance(rw::ObjPipeline *rwpipe, Atomic *atomic)
|
||||
destroyNativeData(geo, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
render(rw::ObjPipeline *rwpipe, Atomic *atomic)
|
||||
{
|
||||
ObjPipeline *pipe = (ObjPipeline*)rwpipe;
|
||||
Geometry *geo = atomic->geometry;
|
||||
if((geo->geoflags & Geometry::NATIVE) == 0)
|
||||
pipe->instance(atomic);
|
||||
assert(geo->instData != NULL);
|
||||
assert(geo->instData->platform == PLATFORM_D3D9);
|
||||
if(pipe->renderCB)
|
||||
pipe->renderCB(atomic, (InstanceDataHeader*)geo->instData);
|
||||
}
|
||||
|
||||
ObjPipeline::ObjPipeline(uint32 platform)
|
||||
: rw::ObjPipeline(platform)
|
||||
{
|
||||
this->impl.instance = d3d9::instance;
|
||||
this->impl.uninstance = d3d9::uninstance;
|
||||
this->impl.render = d3d9::render;
|
||||
this->instanceCB = NULL;
|
||||
this->uninstanceCB = NULL;
|
||||
this->renderCB = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
@ -494,6 +507,7 @@ makeDefaultPipeline(void)
|
||||
ObjPipeline *pipe = new ObjPipeline(PLATFORM_D3D9);
|
||||
pipe->instanceCB = defaultInstanceCB;
|
||||
pipe->uninstanceCB = defaultUninstanceCB;
|
||||
pipe->renderCB = defaultRenderCB;
|
||||
return pipe;
|
||||
}
|
||||
|
||||
@ -503,6 +517,7 @@ makeSkinPipeline(void)
|
||||
ObjPipeline *pipe = new ObjPipeline(PLATFORM_D3D9);
|
||||
pipe->instanceCB = defaultInstanceCB;
|
||||
pipe->uninstanceCB = defaultUninstanceCB;
|
||||
pipe->renderCB = defaultRenderCB;
|
||||
pipe->pluginID = ID_SKIN;
|
||||
pipe->pluginData = 1;
|
||||
return pipe;
|
||||
@ -514,6 +529,7 @@ makeMatFXPipeline(void)
|
||||
ObjPipeline *pipe = new ObjPipeline(PLATFORM_D3D9);
|
||||
pipe->instanceCB = defaultInstanceCB;
|
||||
pipe->uninstanceCB = defaultUninstanceCB;
|
||||
pipe->renderCB = defaultRenderCB;
|
||||
pipe->pluginID = ID_MATFX;
|
||||
pipe->pluginData = 0;
|
||||
return pipe;
|
||||
|
@ -16,8 +16,6 @@ using namespace std;
|
||||
|
||||
namespace rw {
|
||||
|
||||
void (*defaultRenderCBs[rw::NUM_PLATFORMS])(Atomic*);
|
||||
|
||||
static void nothing(ObjPipeline *, Atomic*) {}
|
||||
|
||||
Pipeline::Pipeline(uint32 platform)
|
||||
@ -35,13 +33,6 @@ ObjPipeline::ObjPipeline(uint32 platform)
|
||||
this->impl.render = nothing;
|
||||
}
|
||||
|
||||
//void
|
||||
//ObjPipeline::render(Atomic *atomic)
|
||||
//{
|
||||
// if(defaultRenderCBs[rw::platform])
|
||||
// defaultRenderCBs[rw::platform](atomic);
|
||||
//}
|
||||
|
||||
// helper functions
|
||||
|
||||
void
|
||||
|
@ -95,5 +95,10 @@ void setTexels(Raster *raster, void *texels, int32 level);
|
||||
extern int32 nativeRasterOffset;
|
||||
void registerNativeRaster(void);
|
||||
|
||||
// Rendering
|
||||
|
||||
void setTexture(Texture *tex);
|
||||
void setMaterial(Material *mat);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -63,10 +63,15 @@ class ObjPipeline : public rw::ObjPipeline
|
||||
public:
|
||||
void (*instanceCB)(Geometry *geo, InstanceDataHeader *header);
|
||||
void (*uninstanceCB)(Geometry *geo, InstanceDataHeader *header);
|
||||
void (*renderCB)(Atomic *atomic, InstanceDataHeader *header);
|
||||
|
||||
ObjPipeline(uint32 platform);
|
||||
};
|
||||
|
||||
void defaultInstanceCB(Geometry *geo, InstanceDataHeader *header);
|
||||
void defaultUninstanceCB(Geometry *geo, InstanceDataHeader *header);
|
||||
void defaultRenderCB(Atomic *atomic, InstanceDataHeader *header);
|
||||
|
||||
ObjPipeline *makeDefaultPipeline(void);
|
||||
|
||||
ObjPipeline *makeSkinPipeline(void);
|
||||
|
@ -29,8 +29,6 @@ public:
|
||||
void render(Atomic *atomic) { this->impl.render(this, atomic); }
|
||||
};
|
||||
|
||||
extern void (*defaultRenderCBs[rw::NUM_PLATFORMS])(Atomic*);
|
||||
|
||||
void findMinVertAndNumVertices(uint16 *indices, uint32 numIndices, uint32 *minVert, int32 *numVertices);
|
||||
|
||||
// everything xbox, d3d8 and d3d9 may want to use
|
||||
|
Loading…
Reference in New Issue
Block a user