diff --git a/src/d3d/d3dimmed.cpp b/src/d3d/d3dimmed.cpp index 972839b..1ad4e87 100644 --- a/src/d3d/d3dimmed.cpp +++ b/src/d3d/d3dimmed.cpp @@ -252,13 +252,16 @@ closeIm3D(void) } void -im3DTransform(void *vertices, int32 numVertices, Matrix *world) +im3DTransform(void *vertices, int32 numVertices, Matrix *world, uint32 flags) { if(world == nil) uploadMatrices(); else uploadMatrices(world); + if((flags & im3d::VERTEXUV) == 0) + SetRenderStatePtr(TEXTURERASTER, nil); + d3ddevice->SetVertexShaderConstantF(VSLOC_fogData, (float*)&d3dShaderState.fogData, 1); d3ddevice->SetPixelShaderConstantF(PSLOC_fogColor, (float*)&d3dShaderState.fogColor, 1); static float surfprops[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; diff --git a/src/d3d/rwd3dimpl.h b/src/d3d/rwd3dimpl.h index ee0b7d4..adefe8c 100644 --- a/src/d3d/rwd3dimpl.h +++ b/src/d3d/rwd3dimpl.h @@ -11,7 +11,7 @@ void im2DRenderIndexedPrimitive(PrimitiveType primType, void *vertices, int32 nu void openIm3D(void); void closeIm3D(void); -void im3DTransform(void *vertices, int32 numVertices, Matrix *world); +void im3DTransform(void *vertices, int32 numVertices, Matrix *world, uint32 flags); void im3DRenderPrimitive(PrimitiveType primType); void im3DRenderIndexedPrimitive(PrimitiveType primType, void *indices, int32 numIndices); void im3DEnd(void); diff --git a/src/engine.cpp b/src/engine.cpp index d99c602..08fc7fa 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -417,7 +417,7 @@ void im2DRenderTriangle(void*, int32, int32, int32, int32) { } void im2DRenderPrimitive(PrimitiveType, void*, int32) { } void im2DRenderIndexedPrimitive(PrimitiveType, void*, int32, void*, int32) { } -void im3DTransform(void *vertices, int32 numVertices, Matrix *world) { } +void im3DTransform(void *vertices, int32 numVertices, Matrix *world, uint32 flags) { } void im3DRenderPrimitive(PrimitiveType primType) { } void im3DRenderIndexedPrimitive(PrimitiveType primType, void *indices, int32 numIndices) { } void im3DEnd(void) { } diff --git a/src/gl/gl3immed.cpp b/src/gl/gl3immed.cpp index 2f08b0e..51a1636 100644 --- a/src/gl/gl3immed.cpp +++ b/src/gl/gl3immed.cpp @@ -208,7 +208,7 @@ closeIm3D(void) } void -im3DTransform(void *vertices, int32 numVertices, Matrix *world) +im3DTransform(void *vertices, int32 numVertices, Matrix *world, uint32 flags) { if(world == nil){ Matrix ident; @@ -218,6 +218,9 @@ im3DTransform(void *vertices, int32 numVertices, Matrix *world) setWorldMatrix(world); im3dShader->use(); + if((flags & im3d::VERTEXUV) == 0) + SetRenderStatePtr(TEXTURERASTER, nil); + // TODO: fixed size glBindBuffer(GL_ARRAY_BUFFER, im3DVbo); glBufferData(GL_ARRAY_BUFFER, numVertices*sizeof(Im3DVertex), diff --git a/src/gl/rwgl3impl.h b/src/gl/rwgl3impl.h index 5d452d2..8c5e428 100644 --- a/src/gl/rwgl3impl.h +++ b/src/gl/rwgl3impl.h @@ -17,7 +17,7 @@ void im2DRenderIndexedPrimitive(PrimitiveType primType, void openIm3D(void); void closeIm3D(void); -void im3DTransform(void *vertices, int32 numVertices, Matrix *world); +void im3DTransform(void *vertices, int32 numVertices, Matrix *world, uint32 flags); void im3DRenderPrimitive(PrimitiveType primType); void im3DRenderIndexedPrimitive(PrimitiveType primType, void *indices, int32 numIndices); void im3DEnd(void); diff --git a/src/render.cpp b/src/render.cpp index fef6e58..814f682 100644 --- a/src/render.cpp +++ b/src/render.cpp @@ -52,9 +52,9 @@ RenderPrimitive(PrimitiveType type, void *verts, int32 numVerts) namespace im3d { void -Transform(void *vertices, int32 numVertices, Matrix *world) +Transform(void *vertices, int32 numVertices, Matrix *world, uint32 flags) { - engine->device.im3DTransform(vertices, numVertices, world); + engine->device.im3DTransform(vertices, numVertices, world, flags); } void RenderPrimitive(PrimitiveType primType) diff --git a/src/rwengine.h b/src/rwengine.h index 50b0703..ef17a9a 100644 --- a/src/rwengine.h +++ b/src/rwengine.h @@ -55,7 +55,7 @@ struct Device void (*im2DRenderPrimitive)(PrimitiveType primType, void *vertices, int32 numVertices); void (*im2DRenderIndexedPrimitive)(PrimitiveType primType, void *vertices, int32 numVertices, void *indices, int32 numIndices); - void (*im3DTransform)(void *vertices, int32 numVertices, Matrix *world); + void (*im3DTransform)(void *vertices, int32 numVertices, Matrix *world, uint32 flags); void (*im3DRenderPrimitive)(PrimitiveType primType); void (*im3DRenderIndexedPrimitive)(PrimitiveType primType, void *indices, int32 numIndices); void (*im3DEnd)(void); diff --git a/src/rwrender.h b/src/rwrender.h index 33f094c..592ecc2 100644 --- a/src/rwrender.h +++ b/src/rwrender.h @@ -84,7 +84,17 @@ void RenderPrimitive(PrimitiveType type, void *verts, int32 numVerts); namespace im3d { -void Transform(void *vertices, int32 numVertices, Matrix *world); +enum TransformFlags +{ + VERTEXUV = 1, // has tex Coords + ALLOPAQUE = 2, // no vertex alpha + NOCLIP = 4, // don't frustum clip + VERTEXXYZ = 8, // has position + VERTEXRGBA = 16, // has color + EVERYTHING = VERTEXUV|VERTEXXYZ|VERTEXRGBA +}; + +void Transform(void *vertices, int32 numVertices, Matrix *world, uint32 flags); void RenderPrimitive(PrimitiveType primType); void RenderIndexedPrimitive(PrimitiveType primType, void *indices, int32 numIndices); void End(void); diff --git a/tools/playground/main.cpp b/tools/playground/main.cpp index 655e6b4..b0d8ebd 100644 --- a/tools/playground/main.cpp +++ b/tools/playground/main.cpp @@ -349,7 +349,7 @@ im3dtest(void) genIm3DRenderIndexed(rw::PRIMTYPETRILIST, indices, 12); genIm3DEnd(); */ - rw::im3d::Transform(verts, 8, nil); + rw::im3d::Transform(verts, 8, nil, rw::im3d::EVERYTHING); rw::im3d::RenderIndexedPrimitive(rw::PRIMTYPETRILIST, indices, 12); rw::im3d::End(); }