Skip to main content

Module obj

Module obj 

Source
Expand description

Wavefront OBJ ASCII parser + serialiser.

Strictly the polygonal subset (vertex / face / line / grouping / material directives). Free-form curves/surfaces and the .mod binary form are intentionally not handled.

The grammar is line-oriented; whitespace-separated; # introduces a comment to end of line. Continuation lines (trailing \\) are supported by gluing the next line on before tokenisation.

Functions§

parse_obj
Parse an OBJ document (no MTL resolution).
parse_obj_with_resolver
Parse an OBJ document, calling resolve once per mtllib entry to fetch the bytes of the named material library. Each library is parsed via parse_mtl and its materials merged into the resulting scene; references in usemtl directives bind to those materials by name.
serialize_obj
Serialise a Scene3D to OBJ format.