GDB Format - DustStormPettigrew/LibLR1 GitHub Wiki

GDB — 3D Model

Mesh geometry format. Marked as "VERY WORK IN PROGRESS" in source.

Top-Level Blocks

Block ID Hex Type Description
Materials 0x27 string[] Material name array
Vertex (Normal) 0x29 GDB_Vertex_Normal[] Vertices with normals
Vertex (Colored) 0x2A GDB_Vertex_Color[] Vertices with vertex colors
Indices 0x2D GDB_Polygon[] Triangle index list
Indices Meta 0x2E GDB_Meta[] Material assignment and mesh partitioning
Scale 0x33 float Model scale factor (default 1.0, only written if ≠ 1)

Vertex Types

A GDB file contains either normal vertices or colored vertices (or both, though typically one).

GDB_Vertex_Normal

Field Type Description
Position LRVector3 World-space position
TexCoords LRVector2 UV texture coordinates
Normal LRVector3 Surface normal vector

GDB_Vertex_Color

Field Type Description
Position LRVector3 World-space position
TexCoords LRVector2 UV texture coordinates
Color LRColor Per-vertex RGBA color

GDB_Polygon

Field Type Description
V0 byte Vertex index 0
V1 byte Vertex index 1
V2 byte Vertex index 2

Note: Vertex indices are byte (0–255), limiting a single mesh partition to 256 vertices. Larger meshes use the Meta system to define multiple partitions.

GDB_Meta (Polymorphic)

The meta array contains interleaved entries of different types, identified by a leading type byte:

Type Byte Class Fields
0x27 GDB_Meta_Material MaterialId (ushort) — index into the Materials array
0x2D GDB_Meta_Indices Offset (ushort), Length (ushort) — polygon range
0x31 GDB_Meta_Vertices UnknownByte (byte), Offset (ushort), Length (ushort) — vertex range
0x32 GDB_Meta_Bone BoneId (ushort) — skeleton bone reference

The meta entries define how the flat vertex/polygon arrays are partitioned into sub-meshes, each with its own material, vertex range, and polygon range.

Read/Write Support

Full round-trip read/write is implemented.


Back to Home