Skip to main content

SharedMappedItemCache

Type Alias SharedMappedItemCache 

Source
pub type SharedMappedItemCache = Arc<Mutex<FxHashMap<u32, Arc<Mesh>>>>;
Expand description

Shared IfcMappedItem source cache: maps an IfcRepresentationMap express id to its SOURCE-coordinate (pre-MappingTarget, pre-placement, colour-free) item mesh. Build ONE per loaded model with GeometryRouter::new_mapped_item_cache and inject it into every per-element / per-batch router via GeometryRouter::enable_shared_mapped_item_cache, so a source shared by many owning elements is meshed ONCE model-wide instead of once per element (a fresh router is built per element, so the per-router RefCell mapped_item_cache only dedups WITHIN one element — #1623). The value is the same source-coords mesh the RefCell would store; the per-occurrence MappingTarget transform + instance_meta are applied by the caller AFTER the lookup, so a cross-router cache hit is byte-identical to a fresh build.

Arc<Mutex<_>> so ONE cache outlives any single router (mirrors ItemDedupCache). The key is the source express id, stable per model; all routers in one pass share the same unit_scale / tessellation_quality / RTC (baked into the source mesh), so keying by id alone is sufficient within a pass — the wasm session drops this cache on a content swap AND on a setTessellationQuality change (which invalidates source-coord tessellation), exactly as the router’s own set_tessellation_quality clears the RefCell.

Aliased Type§

pub struct SharedMappedItemCache { /* private fields */ }