Skip to main content

Module mesh_v2

Module mesh_v2 

Source
Expand description

Mesh chunk version 2 (SPEC.md, sections 6.6 to 6.9): the same mesh as version 1, kept as exactly, in fewer bytes.

Triangles go in their own order (connectivity A) or in the order the triangle codec compresses best, with the way back (connectivity B). Vertices go through meshoptimizer’s vertex codec, or are predicted from the triangles around them and only the difference is stored: entropy-coded with rANS, or as byte planes for the chunk’s zstd.

metadata      as in version 1
counts        u32 vertices, u32 triangles
codings       u8 connectivity (0 A, 1 B), u8 vertex coding
              (0 meshopt, 1 predicted + rANS, 2 predicted + planes)
parts         u32 length + bytes each:
              A: index buffer, corners
              B: index buffer, permutation, corners
              then meshopt: vertex buffer; rANS: tables, stream, raw
              bits; planes: 12 byte planes

Structs§

MeshCoding
The codings a version 2 mesh payload uses.

Enums§

Connectivity
How a version 2 mesh stores its triangles.
VertexCoding
How a version 2 mesh stores its vertices.

Functions§

decode_mesh_v2
Decodes a mesh chunk payload of version 2.
encode_mesh_v2
Encodes mesh as a mesh chunk payload of version 2, choosing the codings that store it smallest.
encode_mesh_v2_with
Encodes mesh as a mesh chunk payload of version 2 with the given codings.