mirror of
https://github.com/aap/librw.git
synced 2024-11-24 20:55:41 +00:00
added im3d transform flags
This commit is contained in:
parent
b3ad490d1b
commit
40eae78e79
@ -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 };
|
||||
|
@ -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);
|
||||
|
@ -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) { }
|
||||
|
@ -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),
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user