Vtx structures¶
The optimized mesh file, produced per graphics backend. An Mdl carries no triangle indices; they all live here, already arranged into strips and stripgroups for the hardware.
studiomdl emits one Vtx per backend, distinguished only by file extension:
.dx90.vtx,.dx80.vtxand.sw.vtx. Team Fortress 2 loadsdx90.The tree mirrors the mdl.
FileHeader_treachesBodyPartHeader_treachesModelHeader_treachesModelLODHeader_treachesMeshHeader_treachesStripGroupHeader_treachesStripHeader_t. The bodypart / model / mesh levels correspond one to one with the mdl’s, which is what lets the two files describe the same geometry from two angles. What the vtx adds is everything below a mesh: the strips and stripgroups the hardware actually draws, and the index buffer that turns the vvd’s vertices into triangles.Packing. Vtx is the one byte-packed family in the studio formats.
optimize.hwraps the wholeOptimizedModelnamespace in#pragma pack(1), so unlike Mdl and Vvd there is no padding between fields and structures do not sit on 4 byte boundaries.StripHeader_tis 27 bytes, not the 32 its field types would suggest, andMaterialReplacementHeader_tis 6, not 8. (This costs ValveMDL nothing:constructconcatenates fields without alignment, so it byte-packs by nature. The trap is only for a reader who assumes alignment.)No magic number.
FileHeader_topens directly onversion; there is no signature to identify a Vtx by. The only integrity check available ischeckSum, which must match the one in the Mdl and the Vvd.Its offsets are struct-relative, like the mdl’s and unlike the vvd’s.
- struct valvemdl.structs.vtx.MaterialReplacementListHeader_t¶
-
-
replacementOffset
(<parsed from long>¶int) offset to an array of
MaterialReplacementHeader_t
-
replacementOffset
- struct valvemdl.structs.vtx.MaterialReplacementHeader_t¶
- struct valvemdl.structs.vtx.BoneStateChangeHeader_t¶
- struct valvemdl.structs.vtx.Vertex_t¶
- struct valvemdl.structs.vtx.StripHeader_t¶
-
-
flags
(<parsed from unsigned char>¶int) Represents a flags Enum 0x1 STRIP_IS_TRILIST 0x2 STRIP_IS_TRISTRIP
-
boneStateChangeOffset
(<parsed from long>¶int) offset to an array of
BoneStateChangeHeader_t
-
flags
- struct valvemdl.structs.vtx.StripGroupHeader_t¶
-
-
stripOffset
(<parsed from long>¶int) offset to an array of
StripHeader_t
-
stripOffset
- struct valvemdl.structs.vtx.MeshHeader_t¶
-
-
stripGroupHeaderOffset
(<parsed from long>¶int) offset to an array of
StripGroupHeader_t
-
stripGroupHeaderOffset
- struct valvemdl.structs.vtx.ModelLODHeader_t¶
-
-
meshOffset
(<parsed from long>¶int) offset to an array of
MeshHeader_t
-
meshOffset
- struct valvemdl.structs.vtx.ModelHeader_t¶
-
numLODs
(<parsed from long>¶int) also in
FileHeader_t
-
lodOffset
(<parsed from long>¶int) offset to an array of
ModelLODHeader_t
-
numLODs
- struct valvemdl.structs.vtx.BodyPartHeader_t¶
-
-
modelOffset
(<parsed from long>¶int) offset to an array of
ModelHeader_t
-
modelOffset
- struct valvemdl.structs.vtx.FileHeader_t¶
-
version
(<parsed from long>¶int) OPTIMIZED_MODEL_FILE_VERSION; note there is no id field preceding this
-
vertCacheSize
(<parsed from long>¶int) hardware params that affect how the model is to be optimized
-
checkSum
(<parsed from long>¶int) must match
studiohdr_t.checksum
-
numLODs
(<parsed from long>¶int) also specified in
ModelHeader_t, and should match
-
materialReplacementListOffset
(<parsed from long>¶int) offset to an array of
MaterialReplacementListHeader_t, one per lod
-
bodyPartOffset
(<parsed from long>¶int) offset to an array of
BodyPartHeader_t
-
version