Expand description
The documents of the surface paint chunk (SPEC.md, section 10.1): the
masks themselves, which crate::surface carries without reading.
Version 1 gives every triangle of a mesh one value, as runs. Version 2 gives every painted triangle a tree that splits it into smaller pieces, each with its own value: what a support brush paints when it covers part of a triangle.
version 1 u32 triangle count, 48 bytes fingerprint,
u32 count, then per run: u32 length, u8 value
version 2 u32 triangle count, 48 bytes fingerprint,
u32 count, then per painted triangle: u32 gap,
u32 length, the trees as a bit stream of 4-bit groupsA document that breaks a rule never makes a file unreadable: a reader
treats its entry as absent. SurfaceEntry::paint does that check, with
the leaf’s mesh, and gives the document only when it applies.
Structs§
- Paint
Piece - A piece of a painted triangle, the leaf of its tree.
- Paint
Run - Triangles in a row that have the same value.
- Paint
Runs - A version 1 document: the value of every triangle, as runs.
- Paint
Trees - A version 2 document: the painted triangles and their trees.
- Painted
Triangle - One painted triangle of a version 2 document.
Enums§
- Decode
Paint Error - Why a document could not be decoded.
- Encode
Paint Error - Why a document could not be encoded.
- Paint
Document - A surface paint document.
- Paint
Node - A node of a version 2 tree.
Constants§
- FINGERPRINT_
SIZE - The size of a mesh fingerprint, a SHA-384 digest.
- MAX_
PAINT_ DEPTH - How deep a node of a version 2 tree may be: the root is at depth 0.
- MUST_
NOT_ TOUCH - The value of kind
PAINT_SUPPORTS_BOTH_WAYSwhere supports must not touch. - MUST_
TOUCH - The value of kind
PAINT_SUPPORTS_BOTH_WAYSwhere supports must touch. - PAINT_
DETAIL - The kind of paint that marks details to keep: values 0 to 255.
- PAINT_
SUPPORTS_ BOTH_ WAYS - The kind of paint that marks both, as a support brush paints them: 0 bare, 1 supports must touch, 2 supports must not touch.
- PAINT_
SUPPORTS_ MUST_ NOT_ TOUCH - The kind of paint that marks where supports must not touch: values 0 to 255.
- PAINT_
SUPPORTS_ MUST_ TOUCH - The kind of paint that marks where supports must touch: values 0 to 255.
Functions§
- decode_
paint - Decodes a surface paint document of
version. - encode_
paint - Encodes a surface paint document, as the version
PaintDocument::versiongives. - mesh_
fingerprint - The fingerprint that names a mesh in a paint document (section 10.1): the
SHA-384 digest of the vertex count as a
u64, the bits of every coordinate asu32s, the triangle count as au64, and every triangle’s indices asu32s, all little-endian.