Expand description
Tessellated interchange: glTF 2.0, OBJ and PLY.
Three formats, one philosophy carried over from the DXF writer: the
functions take bare tessellations rather than a model, so anything that
produces a Triangulation (a solid, one face, a healed import)
exports without this module knowing where it came from. glTF is written
as GLB, the single-file binary form, with positions, normals, indices
and an optional base colour per mesh; OBJ and PLY are the plain-text
dialects every downstream tool reads.
§Reading is not writing backwards
What this module writes is one of many shapes each format allows, and a reader that assumed its own writer’s choices would read almost nothing. glTF is the sharp case: its geometry reaches the file through accessors over buffer views over buffers, any of which may stride, offset, use any of six component types, scale integers into fractions, or be overridden piecewise by a sparse block, and the whole is placed by a node hierarchy stated as a matrix or as translation, rotation and scale. All of that is read. What is not read is refused by name rather than approximated.
Structs§
- Export
Mesh - One mesh to export, with what the format can say about it.
- Imported
Mesh - One mesh read back out of a glTF document.
Functions§
- read_
glb - Read a GLB: glTF 2.0’s single-file binary form.
- read_
gltf - Read a
.gltf: the JSON form, whose buffers are data URIs. - read_
obj - Read an OBJ into a triangulation.
- read_
ply - Read an ASCII PLY into a triangulation.
- write_
glb - Write meshes as a GLB: glTF 2.0’s single-file binary form.
- write_
obj - Write meshes as Wavefront OBJ.
- write_
ply - Write one mesh as ASCII PLY.
- write_
vrml - Write meshes as VRML 97.