Skip to main content

Module stream_meta

Module stream_meta 

Source
Expand description

Shared streaming pre-pass meta resolution.

The browser pre-passes (buildPrePassOnce / buildPrePassStreaming in wasm-bindings) each need the same bundle of load-time metadata before workers can start meshing: the length/plane-angle unit scales, the RTC (relative-to-centre) offset plus its needs-shift flag, and the building rotation from IfcSite. This module is the single home for that resolution logic so the three call sites can no longer drift.

Only the RESOLUTION logic lives here — the wasm side keeps ownership of WHEN the resulting StreamMeta is emitted. In particular the streaming pre-pass still emits its meta event MID-SCAN (as soon as RTC_SAMPLE_THRESHOLD geometry jobs are buffered, near the top of the file) so workers spin up early — the ~17 s → ~3 s time-to-first-geometry win on a 986 MB file. This helper does not change that timing; it only factors out the two-vs-three-stage RTC ladder that the two emission sites previously copied.

Everything here COMPOSES the existing canonical primitives: resolve_unit_scales, EntityDecoder::seed_unit_scales, GeometryRouter::with_scale, GeometryRouter::detect_rtc_offset_from_jobs, GeometryRouter::detect_rtc_offset_with_fallback, and the shared LARGE_COORD_THRESHOLD_METERS needs-shift constant.

Structs§

StreamMeta
The load-time metadata both pre-passes emit before workers start meshing.

Enums§

MetaMode
Which RTC-detection ladder resolve_stream_meta should run.

Functions§

coord_is_large
True when any component of the offset exceeds the shared large-coordinate threshold — the single needs-shift predicate, sharing LARGE_COORD_THRESHOLD_METERS with the router’s own sampling so both sides make the identical decision.
resolve_stream_meta
Resolve the full StreamMeta bundle for one pre-pass emission point.

Type Aliases§

Job
A geometry job span as the pre-passes carry it: (id, start, end, type).