GLM is the Ghoul2 model format. Meshes/surfaces in the model are arranged in a hierarchy, starting from the torso going outwards, to make it easy to not render whole parts of the model, e.g. limbs.
LODs are built into the model format.
type | name | description |
---|---|---|
int32 |
ident | Always MD3 |
int32 |
version | Always 2 |
char[MAX_QPATH] |
name | Full model path |
char[MAX_QPATH] |
animName | Animation file name |
int32 |
animIndex | Unused |
int32 |
numBones | Number of bones |
int32 |
numLODs | Number of LODs |
int32 |
ofsLODs | Byte offset from start of file to the beginning of the LOD data |
int32 |
numSurfaces | Number of surfaces |
int32 |
ofsSurfHierarchy | Byte offset from start of file to beginning of surface hierarchy data |
int32 |
ofsEnd | Byte offset from start of file to end of file |
At the start of fileBase + header.ofsSurfHierarchy
is the surface hierarchy data. The data in this section is split into its own header and the list of surface data.
The header is a list of byte offsets of size header.numSurfaces
. Following this is the list of surface data:
type | name | description |
---|---|---|
char[MAX_QPATH] |
name | Surface name |
uint32 |
flags | Flags |
char[MAX_QPATH] |
shader | Shader path |
int32 |
shaderIndex | Unused |
int32 |
parentIndex | Index of parent surface, or -1 if this is the root surface |
int32 |
numChildren | Number of child surfaces |
int32[numChildren] |
childIndexes | Variable-sized list of child surface indexes |