Module types

Module types 

Source
Expand description

Node-specific data types. Node-specific data types for the MDL format.

Each MDL node carries a base header (name, transform, controllers) plus type-specific data determined by the node’s bitflags. This module defines the MdlNodeData enum that discriminates between node types, along with the concrete structs for each variant.

§Rust Representation

The engine’s C++ code uses an inheritance hierarchy (MdlNodeSkin extends MdlNodeTriMesh extends MdlNode). We represent this as a flat enum with composition – mesh-derived variants contain an MdlMesh field rather than inheriting from a base class. This is idiomatic Rust: the enum discriminant replaces the C++ vtable, and shared mesh data is accessed through the composed struct.

MdlNodeData (enum)
 |-- Base                        (no extra data)
 |-- Light(MdlLight)             (92 extra bytes)
 |-- Emitter(MdlEmitter)         (224 extra bytes)
 |-- Camera(MdlCamera)           (no extra data)
 |-- Reference(MdlReference)     (36 extra bytes)
 |-- Mesh(MdlMesh)               (332 extra bytes)
 |-- Skin(MdlSkin)               (332 + 100 extra bytes)
 |     `-- contains MdlMesh      (composition, not inheritance)
 |-- AnimMesh(MdlAnimMesh)       (332 + 56 extra bytes)
 |     `-- contains MdlMesh
 |-- Dangly(MdlDangly)           (332 + 28 extra bytes)
 |     `-- contains MdlMesh
 |-- Aabb(MdlAabb)               (332 + 4 extra bytes)
 |     `-- contains MdlMesh
 `-- Saber(MdlSaber)             (332 + 20 extra bytes)
       `-- contains MdlMesh

See super module docs for the binary format layout and docs/notes/mdl_mdx.md for Ghidra-verified allocation sizes.

Structs§

AabbNode
A node in the AABB binary search tree used for spatial face queries.
MdlAabb
AABB walkmesh tree node.
MdlAnimMesh
Animated mesh with per-frame vertex sets.
MdlCamera
Camera node data.
MdlDangly
Dangly mesh with physics constraints.
MdlEmitter
Emitter node data.
MdlFace
A face in the binary MaxFace format (32 bytes on disk).
MdlLight
Light node data.
MdlMesh
A triangle mesh contained within a node.
MdlReference
Reference node data.
MdlSaber
Lightsaber blade mesh.
MdlSkin
Skinned mesh with bone weight data.

Enums§

MdlNodeData
Type-specific payload for an MDL node.