Skip to main content

Module mesh

Module mesh 

Source
Expand description

The mesh chunk: one triangle mesh, lossless (SPEC.md, section 6).

Vertices and triangles go through meshoptimizer’s codecs, which keep every vertex bit for bit. The triangle codec may start a triangle at another of its corners (same winding), so the payload also lists those triangles and the decoder turns them back: the mesh comes back identical, face order and first corners included.

Both codecs are pinned to version 1, whatever the library’s default, so a newer meshoptimizer cannot change what a chunk means. Facet normals a source STL declared are not kept: they are file data, not geometry.

metadata    u8 0 | 1, then name and comment (u8 0 | 1, u32 length, UTF-8)
vertices    u32 count, u32 length, meshopt vertex buffer of [f32; 3]
triangles   u32 count, u32 length, meshopt index buffer
rotations   u32 count, then per triangle: u32 gap from the previous
            listed triangle, u8 corner (1 | 2) the stored one starts at

Structs§

Mesh
A triangle mesh, as a mesh chunk keeps it.

Enums§

DecodeMeshError
Why a mesh payload could not be decoded.
EncodeMeshError
Why a mesh could not be encoded.

Constants§

MESH_TAG
The tag of a mesh chunk.
MESH_VERSION
The newest mesh payload layout this build reads. Version 1 is read too.

Functions§

decode_mesh
Decodes a mesh chunk payload.
encode_mesh
Encodes mesh as a mesh chunk payload.