Module writer

Module writer 

Source
Expand description

MDL binary writer. MDL binary writer.

Serializes an Mdl struct back into the binary MDL+MDX format used by the Odyssey engine. The writer uses a single-pass cursor approach: it reserves placeholder space for headers and arrays, writes child data forward, then backpatches pointers and counts using seek-back helpers.

MDX vertex data is written separately via write_mdl_with_mdx_to_vec or deferred to a second buffer. Non-skin meshes are emitted first (DFS order), then skin meshes (DFS order), matching the vanilla engine layout.

Functionsยง

write_mdl
Writes an MDL file structure to a writer.
write_mdl_to_vec
Writes an MDL file structure to a byte vector.
write_mdl_with_mdx_to_vec
Writes an MDL model and its companion MDX vertex data to byte vectors.