Geometry Struct

From GTAMods Wiki
Revision as of 12:19, 7 April 2009 by THE HERO (talk | contribs) (Geometry Data)
Jump to navigation Jump to search
{{{NAME}}}
RenderWare Stream Section
Vendor {{{VENDORNAME}}}
Module {{{MODULENAME}}}
Module ID 0x{{{MODULEID}}}
Identifier 0x{{{IDENTIFIER}}}
Chunk ID 0x{{{MODULEID}}}{{{IDENTIFIER}}}
Versions All
Hierarchy
Parents:
None
Children:
None
Extensions:
None
File Format

This article is about the Struct section accompanied by a Geometry parent section.

The Geometry Struct sections can usually be found in model files used by the GTA III game trilogy. They are amongst the most important sections inside a .dff file since they contain the actual mesh data. The typical location in the file's section hierarchy is Clump > Geometry List > Geometry > Struct.

Header

There is a 16 byte header with section content information:

2b - WORD  - Flags
1b - BYTE  - Number of of UV coordinate sets
1b - BYTE  - Unknown (is set to 1 in PS2 files, otherwise 0)
4b - DWORD - Face Count
4b - DWORD - Vertex Count (also normals and colors, if included)
4b - DWORD - Frame Count
Flags
Bit 0: triangle strip (else triangle list)
Bit 1: vertex positions are included (usually 1)
Bit 2: UV coordinates are included
Bit 3: vertex colors are included
Bit 4: normals are included (0 for most static map objects)
Bit 5: unknown (GeometryLight)
Bit 6: unknown (GeometryModulateMaterialColor)
Bit 7: multiple sets of UV coordinates are included (see header)

Geometry Data

12b - FLOAT[3] - Scene Lighting Info (ambient, diffuse, specular) - only for RW versions < 3.4!
 4b - BYTE[4]  - Vertex Colors (RGBA) - array of [Vertex Count] entries, if flag bit 3 is set
 8b - FLOAT[2] - UV Coords - array of [Vertex Count] entries, if flag bit 2 is set;
                 multiple blocks if bit 7 is set and the UV set count in the header is > 1
 8b - WORD[4]  - Face Indices (Vert 2, Vert 1, Flags, Vert 3) - array of [Face Count] entries
16b - FLOAT[4] - Bounding Sphere (X, Y, Z, Radius)
 8b - DWORD[2] - has position, has normals (1 if true; possibly not used)
12b - FLOAT[3] - Vertices (X, Y, Z) - array of [Vertex Count] entries
12b - FLOAT[3] - Normals (X, Y, Z) - array of [Vertex Count] entries, if flag bit 4 is set

Note: Face Indices are overridden if there's a Bin Mesh PLG section. This is also used to assign different materials to parts of the mesh.

Note: Vertex Colors, UV Coordinates, Face Indices, Vertices, and Normals are omitted in PS2 files, and instead Native Data PLG is used for geometry information.

See also