Skip to main content

recover_occurrences_flat

Function recover_occurrences_flat 

Source
pub fn recover_occurrences_flat(
    rep: u128,
    occs: &[RawInstanceOccurrence],
    mapped_item_cache: &SharedMappedItemCache,
    rtc: [f64; 3],
    out: &mut Vec<MeshData>,
) -> bool
Expand description

The don’t-bake occurrence → flat MeshData recovery, shared with the browser batch (rust/wasm-bindings/src/api/gpu_meshes/instancing.rs) so the mapping has one home rather than two clones. See its doc comment. Rebuild each don’t-bake occurrence of rep as a standalone flat MeshData, baked from the shared mapped-source registry at the occurrence’s world transform (post-RTC) — geometrically identical to the occurrence the flat path would have produced. No instancing benefit, but correct and never a silent loss.

ONE home for the occurrence → MeshData mapping. The native finalize below and the browser batch’s resolve_batch_occurrences (rust/wasm-bindings/src/api/gpu_meshes/instancing.rs) are the same recovery on two targets, and were near-verbatim clones: the same lookup, the same bake, the same empty check, the same MeshData literal. #2985’s dropped item id had to be found, fixed and tested twice because of that. The next per-occurrence field is added here once.

Returns false when rep’s source is absent from the registry, so nothing was recovered. That is the ONLY thing the two callers differ on, and it stays at the call sites: the native side logs it, the browser side has no tracing sink and cannot reach the case anyway.