Expand description
Wavefront MTL (material library) ASCII parser + serialiser.
The grammar mirrors OBJ’s: line-oriented, whitespace-separated,
# introduces a comment to end of line. Each newmtl <name>
opens a fresh material; subsequent lines populate the material’s
parameters until the next newmtl or end of file.
This crate maps the Phong-Blinn vocabulary onto the glTF
metallic-roughness model in Material, preserving the original
field values in Material::extras so a re-serialise reproduces
the input. The Wavefront-PBR extension (Pr, Pm, Pc, Ps,
map_Pr, map_Pm) lands directly in the corresponding PBR slots.
Functions§
- merge_
materials_ into_ scene - Hoist pending texture URIs into the supplied scene as
Textures and bind the result on each material viaTextureRef. Materials are also added to the scene; returns theMaterialIdfor each input material in declaration order. - parse_
mtl - Parse an MTL document.
- parse_
mtl_ with_ scene - One-shot parse + scene-hoist for direct MTL-decoder callers.
- serialize_
mtl - Serialise a slice of materials to MTL format.