Expand description
Wavefront OBJ ASCII parser + serialiser.
Polygonal subset (vertex / face / line / point / grouping / material
directives) is fully decoded into the typed Scene3D model. The
free-form curve/surface directives — vp, cstype, deg, curv,
curv2, surf, parm, trim, hole, scrv, sp, end, plus
the superseded bzp / bsp patches — are captured verbatim into
Scene3D::extras["obj:vp"] and
Scene3D::extras["obj:freeform_directives"] so a decode → encode
round-trip preserves the directive sequence and arguments without
semantic interpretation. The .mod binary form remains out of
scope.
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.
Structs§
- Parse
Options - Parser configuration knobs.
- Serialize
Options - Serialiser configuration. Keeps the public free-function signature
stable while letting the
crate::ObjEncoderthread richer options through.
Functions§
- parse_
obj - Parse an OBJ document (no MTL resolution).
- parse_
obj_ from_ path - Parse an OBJ document at
path, resolvingmtllibreferences against the OBJ file’s parent directory. - parse_
obj_ with_ options - Parse an OBJ document with explicit
ParseOptionsand a caller-suppliedmtllibresolver. Lifts the option struct out of the otherwise-identicalparse_obj_with_resolversignature. - parse_
obj_ with_ resolver - Parse an OBJ document, calling
resolveonce permtllibentry to fetch the bytes of the named material library. Each library is parsed viaparse_mtland its materials merged into the resulting scene; references inusemtldirectives bind to those materials by name. - serialize_
obj - Serialise a
Scene3Dto OBJ format. - serialize_
obj_ with_ options - Serialise a
Scene3Dto OBJ format with explicit options.