Skip to main content

Module prepass

Module prepass 

Source
Expand description

Canonical prepass resolution — the single post-scan step that turns the entity spans a scan collected into the style / material / void context the per-element producer (crate::element) consumes.

Both pipelines run this exact code:

  • the native orchestrator (processor.rs) span-stashes during its scan and resolves here before the rayon loop;
  • the browser prepasses (buildPrePassOnce / buildPrePassStreaming in wasm-bindings) span-stash during their scans and resolve here before serialising the flat wire arrays.

The two scan loops remain per-pipeline (they are mechanical match-arms over type names with pipeline-specific extras: quick-metadata, properties, incremental job emission), but everything SEMANTIC — styled-item precedence, IfcIndexedColourMap fallback, the #407 material chain, void collection and aggregate propagation (#845), and unit-scale resolution — lives here exactly once. The historic #858/#913-class drift was always in this resolution layer, not in the span stashing.

Structs§

PrepassSpans
Entity spans a scan collected for post-scan resolution. Both scan loops fill this; neither decodes these entities mid-scan.
ResolveOptions
Resolution switches. Both pipelines use the same resolver with different collection needs.
ResolvedPrepass
Everything the post-scan resolution produces.
UnitScales
The file’s unit scales, resolved exactly once per parse.

Functions§

find_ifcproject_id
Find the singleton IFCPROJECT’s express id by SIMD substring search — no full entity scan. Returns None when the file has no project.
flat_material_colors
Flat wire encoding of the element material colour lists (#407/#913 §2.3): (element_ids, counts, rgba8)counts[i] colours belong to element_ids[i], in order, 4 bytes each.
flat_styles_rgba8
Flat wire encodings of the resolved styles for the browser’s styleIds/styleColors arrays: the rich style index flattened to (ids, rgba8), with IfcIndexedColourMap dominants, flat material colours, and per-element first material colours filling the gaps — the exact layered precedence the browser prepasses have always shipped.
flat_voids
Flat wire encoding of the void index: (keys, counts, values) in the shape processGeometryBatch accepts.
material_colors_from_flat
Decode the flat material-colour wire arrays back into the canonical map — the inverse of flat_material_colors, used by processGeometryBatch.
merge_indexed_colours
Fold IfcIndexedColourMap dominant colours into the style index, keyed by target geometry id. or_insert preserves IFCSTYLEDITEM precedence: a geometry that already has a direct style keeps it; the indexed colour only fills the gaps (#913).
resolve_prepass
THE canonical post-scan resolution. Spans are processed in file order so first-wins precedence matches what the historic inline scans produced.
resolve_styled_item_spans
Resolve geometry-attached styled-item spans into a style index — the defer-mode replay (fast_first_batch), and the building block resolve_prepass uses internally.
resolve_unit_scales
Resolve BOTH unit scales once, against the decoder’s (possibly partial) entity index, with the documented fallback ladder:

Type Aliases§

Span
One stashed entity span: (express_id, start, end).