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/buildPrePassStreaminginwasm-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§
- Prepass
Spans - Entity spans a scan collected for post-scan resolution (no mid-scan decode).
- Resolve
Options - Resolution switches (both pipelines share the resolver).
- Resolved
Prepass - Everything the post-scan resolution produces.
- Unit
Scales - 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. ReturnsNonewhen the file has no project. - finish_
from_ wire - Decode one
[metallic, roughness]wire pair. A non-finite field is unauthored; a pair with neither field authored is no finish at all. - finish_
to_ wire - One style’s
[metallic, roughness]wire pair;f32::NANmarks a field the file did not author. Inverse:finish_from_wire. - flat_
material_ colors - Flat wire encoding of the element material colour lists (#407/#913 §2.3):
(element_ids, counts, rgba8)—counts[i]colours belong toelement_ids[i], in order, 4 bytes each. - flat_
styles_ rgba8 - Flat wire encodings of the resolved styles for the browser’s
styleIds/styleColorsarrays: 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_
styles_ with_ finishes flat_styles_rgba8plus the parallelstyleFinisheswire (#5582): twof32per style id,[metallic, roughness], in the SAME order asids,f32::NANfor an unauthored field. The id order is decided once, by the rgba8 flatten; the finishes are a per-id lookup over it intogeometry_finishes(crate::prepass_styled::resolve_geometry_finishesover the same styled items). A geometry style always wins its id in that flatten, so only geometry-style entries can carry a finish; the indexed-colour, material and element-colour fallbacks are colour-only and get[NAN, NAN].- flat_
voids - Flat wire encoding of the void index:
(keys, counts, values)in the shapeprocessGeometryBatchaccepts. - material_
colors_ from_ flat - Decode the flat material-colour wire arrays back into the canonical map —
the inverse of
flat_material_colors, used byprocessGeometryBatch. - merge_
indexed_ colours - Fold
IfcIndexedColourMapdominant colours into the style index, keyed by target geometry id.or_insertpreserves IFCSTYLEDITEM precedence: a geometry that already has a direct style keeps it; the indexed colour only fills the gaps (#913). - resolve_
geometry_ finishes - IFC-authored metallic/roughness per styled geometry item (#5582), keyed
exactly like the colour index
resolve_styled_items_intobuilds: the FIRST styled item (file order) that yields a style claims its geometry id, and the finish comes from that same chosen rendering style, so a mesh never pairs one style’s colour with another’s finish. A claim whose style authors no specular evidence is kept as an emptySpecularMaterial(it encodes to[NAN, NAN]), so a first-wins merge of sharded results cannot take a later item’s finish for it. Orphan (null-item) styled items are skipped, as they colour materials, not geometry. Fed tocrate::prepass::flat_styles_with_finishes. - resolve_
prepass - THE canonical post-scan resolution (file-order, first-wins precedence).
- resolve_
prepass_ with_ style_ seeds resolve_prepasswith PRE-RESOLVED styled maps (sharded pre-pass). Seeds MUST install before the material/void loops: the material chain consultsorphan_styled_items— injecting after loses material-dependent styles.- resolve_
styled_ item_ spans - Resolve geometry-attached styled-item spans into a style index — the
defer-mode replay (
fast_first_batch), and the building blockresolve_prepassuses internally. - resolve_
styled_ items_ into - The styled-item classification/resolution loop of [
resolve_prepass], exposed so the browser’s SHARDED pre-pass can fan slices of the (file- ordered) styled-item span list across workers: each worker resolves its contiguous slice with this exact loop, and the host merges shard results in shard order with first-wins per geometry id — reproducing the serial resolver’s file-order first-wins precedence (collect_geometry_style_infoskips ids already present). - resolve_
unit_ scales - Resolve BOTH unit scales once, against the decoder’s (possibly partial) entity index, with the documented fallback ladder:
- style_
finishes_ for_ ids - The
styleFinisheswire for an already-ordered id list:finish_of(id)’sfinish_to_wirepair per id, inidsorder. Shared by the serial flatten and the sharded finalize so both encode identically.
Type Aliases§
- Span
- One stashed entity span:
(express_id, start, end). - Style
Seeds - Pre-resolved styled maps:
(orphan id -> rgba, geometry id -> style info).