Module mtl

Module mtl 

Source
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 material
  • Kd <r> <g> <b> - Diffuse color (floats 0.0-1.0, clamped)

§Ignored Directives

  • Ka, Ks, Ns, Ke, illum, Ni, d, Tr - Silently skipped
  • map_Kd and other map_* - 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.