concinnity-core 0.18.64

Runtime vocabulary for the Concinnity engine: GPU layouts, ECS components, registry, CPU kernels
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! `ProceduralMesh`'s `Component` impl is generated centrally (see
//! `cn_impl_components!`); this module keeps the blob-residency helper
//! `PhysicsSystem` relies on.

use crate::components::ProceduralMesh;

/// Blob indices of heightfield-generator ProceduralMeshes. GraphicsSystem's
/// init release sweep must spare these blobs: PhysicsSystem inits afterwards and
/// reads the baked heightfield collider grid from the payload, mirroring the
/// AudioClip / SdfVolume precedent of holding a blob resident for a later system.
pub fn heightfield_blob_indices(
    ctx: &crate::ecs::PipelineContext,
) -> alloc::collections::BTreeSet<u32> {
    ctx.query::<ProceduralMesh>()
        .filter(|m| m.generator == "heightfield")
        .filter_map(|m| m.locator.as_ref().map(|l| l.blob_index))
        .collect()
}