pub struct Writer { /* private fields */ }Expand description
Writer for MDX/MDL model files
The Writer takes a Model structure and writes it to disk in binary MDX format or text MDL format. It automatically handles chunk serialization and size calculation for MDX, and text formatting for MDL.
The format is selected either by file extension (.mdl → text, .mdx → binary) or by an explicit MDLXFormat parameter.
Uses the PImpl (Pointer to Implementation) idiom to hide implementation details.
Implementations§
Source§impl Writer
impl Writer
Sourcepub fn write_file(
&mut self,
file_path: &str,
mdlx: &Model,
mdl_format: MdlFormat,
)
pub fn write_file( &mut self, file_path: &str, mdlx: &Model, mdl_format: MdlFormat, )
Write a model file to disk
The format is detected from the file extension: .mdl for text MDL format, .mdx (or any other extension) for binary MDX format.
@param filePath Path where the file should be written @param mdlx Model data to write @param mdlFormat MDL text dialect (only used when writing .mdl); defaults to WarcraftIII (engine-faithful). @throws std::runtime_error If file cannot be created or written
Sourcepub fn write(
&mut self,
mdx: &Model,
format: MDLXFormat,
mdl_format: MdlFormat,
) -> Bytes
pub fn write( &mut self, mdx: &Model, format: MDLXFormat, mdl_format: MdlFormat, ) -> Bytes
Write a model to a byte buffer @param mdx Model data to write @param format Output format (MDX binary or MDL text, defaults to MDX) @param mdlFormat MDL text dialect (only used when format == MDL); defaults to WarcraftIII (engine-faithful). @return Vector containing the binary MDX data or UTF-8 MDL text