Expand description
Wavefront MTL material library parser.
Parses .mtl files referenced by OBJ mtllib directives, extracting diffuse color
(Kd) into MtlMaterial structs that can be mapped to 3MF BaseMaterial resources.
§Supported Directives
newmtl <name>- Define a new materialKd <r> <g> <b>- Diffuse color (floats 0.0-1.0, clamped)
§Ignored Directives
Ka,Ks,Ns,Ke,illum,Ni,d,Tr- Silently skippedmap_Kdand othermap_*- Warning printed to stderr, skipped
§Defaults
Materials without a Kd line default to gray (#808080FF).
Structs§
- MtlMaterial
- A parsed MTL material with a name and display color.
Functions§
- parse_
mtl - Parses an MTL material library from a reader.
- parse_
mtl_ file - Parses an MTL file from a filesystem path.