index_templates_by_rep

Function index_templates_by_rep 

Source
pub fn index_templates_by_rep<'a, T>(
    meshes: impl IntoIterator<Item = &'a MeshData>,
    info: impl FnMut(usize, &'a MeshData) -> T,
) -> FxHashMap<u128, T>
Expand description

The don’t-bake occurrence grouping, template selection and occurrence → flat MeshData recovery, shared with the browser batch (rust/wasm-bindings/src/api/gpu_meshes/instancing.rs) so each has one home rather than two clones. See their doc comments. Index the template meshes a set of occurrences can be placed against, by rep_identity. A template is a non-empty mesh whose instance metadata is instanceable; the FIRST such mesh per rep wins. info maps the winner’s position in meshes and the mesh itself to what the caller records: the native finalize keeps the index, the browser batch its shard eligibility. The caller decides the scope meshes covers (the whole model natively, one batch in the browser).