====== Geometry data ====== Geometry data consists of the following sections: * GEOMETRY META DATA * VERTICES * FACES * TEXTURE COORDINATES * VERTEX COLORS ---- ===== GEOMETRY META DATA ===== This section consists of the following structure: struct GeometryMeta // 0x20 bytes { /*0x00*/ u32 offsVertices; // offset of the vertices section /*0x04*/ u32 numVertices; // number of vertices /*0x08*/ u32 offsFaces; // offset of the faces section /*0x0C*/ u32 numFaces; // number of faces /*0x10*/ u32 offsTexCoords; // offset of the texture coordinates section /*0x14*/ u32 numTexCoords; // number of texture coordinates /*0x18*/ u32 offsColors; // offset of the vertex colors section /*0x1C*/ u32 numColors; // number of vertex colors }; ---- ===== VERTICES ===== This section defines the 3D coordinates of the vertices. It is an array of the following structure: struct Vec3s // 0x06 bytes { /*0x00*/ s16 x; /*0x02*/ s16 y; /*0x04*/ s16 z; }; ---- ===== FACES ===== This section defines the faces of the geometry. It is an array of the following structure: struct GeometryFace // 0x20 bytes { /*0x00*/ u16 unk00; // unknown purpose /*0x02*/ u16 unk02; // unknown purpose /*0x04*/ u8 materialIndex; // index of the material /*0x05*/ u8 _pad[3]; // structure padding /*0x08*/ s16 vertexIndex0; // index of vertex 0 /*0x0A*/ s16 vertexIndex1; // index of vertex 1 /*0x0C*/ s16 vertexIndex2; // index of vertex 2 /*0x0E*/ s16 vertexIndex3; // index of vertex 3 /*0x10*/ s16 texCoordIndex0; // index of texture coordinate 0 /*0x12*/ s16 texCoordIndex1; // index of texture coordinate 1 /*0x14*/ s16 texCoordIndex2; // index of texture coordinate 2 /*0x16*/ s16 texCoordIndex3; // index of texture coordinate 3 /*0x18*/ s16 colorIndex0; // index of vertex color 0 /*0x1A*/ s16 colorIndex1; // index of vertex color 1 /*0x1C*/ s16 colorIndex2; // index of vertex color 2 /*0x1E*/ s16 colorIndex3; // index of vertex color 3 }; This structure may represent either a quadrangle or a triangle. If a triangle is to be represented, ''vertexIndex3'' and ''texCoordIndex3'' are set to -1. The ''vertexIndex'', ''texCoordIndex'', and ''colorIndex'' fields are indices of structures in the VERTICES, TEXTURE COORDINATE, and VERTEX COLORS sections. The ''materialIndex'' field indexes three parallel display list offset tables. For track, skydome, and animated object geometries, these tables are defined in the level file. ---- ===== TEXTURE COORDINATES ===== This section contains the texture coordinate table. It is an array of the following structure: struct TexCoord // 0x04 bytes { /*0x00*/ s16 s; // S-coordinate /*0x02*/ s16 t; // T-coordinate }; ---- ===== VERTEX COLORS ===== This section contains the vertex color table. Colors in this table are stored in RGBA8888 format. struct VertexColor // 0x04 bytes { /*0x00*/ u8 r; /*0x01*/ u8 g; /*0x02*/ u8 b; /*0x03*/ u8 a; };