Skip to main content

Module export

Module export 

Source
Expand description

Writing a model back out, for the viewer’s Export: Wavefront OBJ (with an MTL of the material colours), binary STL, glTF 2.0 (binary GLB, or a .gltf with its buffer embedded), binary PLY and ASCII OFF. Only what falcon holds is written: positions, normals where the file had them, vertex colours, triangles and material colours (OFF keeps positions and triangles only). 3DM, which Eagle’s viewer also writes, is not.

Structs§

Hit
A point where a ray meets a visible triangle.
Measure
What the measure tool shows for two picked points: their distance, the angle between the faces (degrees) and, when the faces are parallel, the distance between their planes.

Enums§

Format
Formats the viewer exports to.

Functions§

glb
A binary glTF (GLB) of meshes: the 12-byte header, the JSON chunk (padded with spaces) and the BIN chunk.
gltf
A .gltf of meshes: the JSON with its buffer as a base64 data URI.
measure
obj
The OBJ text of meshes, referring to mtl_name when any has a material, and the MTL text (empty when there are no materials).
off
ASCII OFF of meshes merged into one: OFF, the vertex and face counts and a zero edge count, a line per vertex, then 3 a b c per triangle with zero-based indices offset per mesh.
pick
The nearest triangle of the meshes for which visible(i) holds that the ray from origin along dir meets (Möller–Trumbore), for the viewer’s measure tool.
ply
Binary little-endian PLY of meshes merged into one: positions, normals when every mesh has them, and colours (vertex colours, else the mesh’s material colour, else the viewer’s default) when any mesh has either; then the triangles.
stl
Binary STL of meshes: an 80-byte header, the triangle count, then per triangle its face normal, three corners and a zero attribute word.
write
Writes meshes to path in format; an OBJ gets its MTL next to it (same name, .mtl) when it has materials.