Skip to main content

Module surface

Module surface 

Source
Expand description

The surface paint chunk (SPEC.md, section 10): what a person painted on the faces of models, one mask per program, leaf and kind.

Each entry names the program it belongs to, so that one program’s paint never mixes with another’s: a program changes and drops only its own entries. Chunk version 1, which named no program, is still read.

Only the envelope is checked: each entry names a program and a leaf, and no two entries share a program, a leaf and a kind. Documents are carried without being read, since a document never makes a file unreadable; the program that uses the paint checks it against the leaf’s mesh, with SurfaceEntry::paint or the codecs of crate::paint.

entries   u32 count, then per entry:
          u32 length, the program's name (not in chunk version 1)
          u32 the leaf's node index in the scene chunk
          u8  the kind: 0 detail, 1 supports must touch, 2 must not touch,
              3 supports both ways
          u32 document version
          u32 length, document

Structs§

SurfaceEntry
One painted mask of one leaf.

Enums§

DecodeSurfaceError
Why a surface paint payload could not be decoded.
EncodeSurfaceError
Why a list of paint entries could not be encoded.

Constants§

SURFACE_TAG
The tag of the surface paint chunk.
SURFACE_VERSION
The surface paint payload layout this build writes. It reads version 1 too.

Functions§

decode_surface
Decodes a surface paint payload of version SURFACE_VERSION, checking it against scene, the scene of the same file.
decode_surface_v1
Decodes a surface paint payload of version 1, whose entries name no program, checking it against scene, the scene of the same file.
encode_surface
Encodes entries as a surface paint payload of version SURFACE_VERSION, in their order, checking them against scene. Every entry names its program.