Skip to main content

Module reader

Module reader 

Source
Expand description

Reading a file: LumenFile, including random access to one layer.

Opening validates, then parses only what is needed: the fixed header, the directory, LTBL and the chunks that describe the print. Layer masks are decoded on demand, one LAYR chunk at a time, so reading layer 1 of a 2,000-layer print decompresses the one chunk that holds it rather than the whole file. For a firmware reader that pulls layers through a fixed buffer, that is the whole point of the chunked design ([spec/12-compression.md] section 6.2), and the cache here holds exactly one decompressed chunk at a time - the one last asked for.

A (layer, sector) is addressed by its LTBL entry: the entry names the LAYR chunk holding the layer’s run and the slice of that chunk’s output the layer occupies, so a single-sector layer costs one chunk read and a multi-sector layer costs as many as it has sectors. A reader that prints one material reads the layer’s first entry and nothing else, which is what LumenFile::layer does; LumenFile::layer_sectors reads every sector, and LumenFile::is_single_material_complete says whether the first way loses anything.

Opening validates and then parses, so a caller that also runs crate::validate separately pays for the container walk twice. Callers that want only a verdict should not open the file.

Structs§

DecodedSector
One sector’s decoded mask on one layer.
LayrChunk
One LAYR chunk: a sector’s masks for one group of layers.
LumenFile
An open LUMEN file.