Skip to main content

Module lod_chain

Module lod_chain 

Source
Expand description

LOD chain (P5.8): author mesh → decimate N LODs → serialize to .10d → renderer parses each level → plan_view selects the expected LOD. Gated like the scientific geometry stack (needs crate::specialized_libs). P5.8 — LOD chain: author mesh → decimate N LODs → serialize to .10d → renderer parses each level → plan_view selects the expected LOD.

This module is the serial integrator spine connecting P5.7 (decimate_3) to the .10d container format and the authoring planner (authoring.rs).

§Pipeline

  1. Author: a source Mesh (the highest-LOD asset).
  2. Decimate: produce N LOD levels by successive QEM decimation, each targeting a fraction of the previous level’s triangle count.
  3. Serialize: encode each LOD as a .10d QuantizedMesh section (mesh_section.rs), concatenated into a single buffer.
  4. Select: at render time, select_lod picks the appropriate LOD index based on OperationalMode (Full → LOD 0, Eco → LOD 1, Reserve → LOD 2).
  5. Parse: the renderer decodes the selected section back to a Mesh.

§Determinism

Decimation is deterministic (canonical vertex remap, sorted collapses). .10d encoding is deterministic (quantization is pure, section order is ascending). Two encodes of the same LOD chain produce byte-identical output.

§Budget rail

The plan_view integration adds a LodDisposition that combines the existing governance/attestation gates with LOD selection. On a constrained tier (Eco/Reserve), a Scene3D view selects a coarser LOD rather than collapsing to 2D — if a coarser LOD is available. If no coarser LOD exists, the existing Collapsed2D fallback applies.

Structs§

LodChainOptions
LOD chain configuration: how many levels and what fraction to decimate to at each level.
LodChainReport
Overall LOD chain build report.
LodLevelReport
Report for one LOD level after building the chain.

Enums§

LodChainError
Failure modes for the LOD chain.
LodViewDisposition
The LOD-aware disposition for a view, extending ViewDisposition with LOD selection for 3D scenes that have a LOD chain available.

Constants§

MAX_LOD_LEVELS
Maximum number of LOD levels supported (including LOD 0 = full resolution).

Functions§

build_lod_chain
Build a LOD chain from a source mesh and serialize all levels as .10d QuantizedMesh sections into out_buffer.
level_offsets
Extract the per-level byte offsets from a LodChainReport.
lod_chain_hash
Compute a simple FNV-1a hash over a byte slice (for determinism verification).
parse_lod_level
Parse a specific LOD level from a serialized LOD chain buffer.
plan_view_with_lod
Plan a view with LOD awareness. Applies the same gate order as authoring::plan_view (attestation → rights → budget), but instead of collapsing 3D to 2D on constrained tiers, selects a coarser LOD if available.
required_lod_buffer_size
Compute the total buffer size needed for a LOD chain with the given options and source mesh size. This is an upper bound (actual may be smaller if decimation stops early).
select_lod
Select the appropriate LOD index for a given OperationalMode.