NOTE: This is only implemented in OpenGL. DirectX (and software) are unchanged.
Listing the new possibilities:
- You can have more than 2 texture coordinates per vertex.
- You can use attributes in GLSL shaders.
- You can use video::SColorf for vertex colors, if you prefer that.
- You only need to store the information you need. If you vertices don't need a normal, you don't use a normal. If your position don't need a Z-coordinate, use can a core::vector2df for position instead.
Code: Select all
struct SMyVertex
{
static SVertexType VertexType;
core::vector3df Position;
core::vector3df Normal;
video::SColor Color;
core::vector2df TCoord1;
core::vector3df TCoord2; // Note: it has 3 coordinates. This is not a problem :)
f32 Stiffness;
};
Code: Select all
// .. (somewhere in program init)
CREATE_VTYPE( SMyVertex, SMyVertex::VertexType )
V_POSITION( Position )
V_NORMAL( Normal )
V_COLOR( Color )
V_TCOORD( TCoord1, 0 )
V_TCOORD( TCoord2, 1 )
V_SHADER( Stiffness, "Stiffness" )
END_VTYPE
Finally, to render geometry using the vertex type there is a new overloaded version of drawIndexedTriangleList:
Code: Select all
void drawIndexedTriangleList(const void* vertices, const SVertexType& vertexType,
s32 vertexCount, const u16* indexList, s32 triangleCount);
Anyway, you can download the patch and a small demo right here.
Hm.. normally I'd have posted a screenshot, but you can't really see anything from a screenshot in this case can you?