Skip to main content

select_visible_instances

Function select_visible_instances 

pub fn select_visible_instances(
    instances: &[BoundedInstance],
    view_projection: [[f32; 4]; 4],
    visible_source_indices: &mut [u32],
) -> Result<usize, VisibilityListError>
Expand description

Append the visible source indices in stable input order.

The output capacity is checked against the worst case before any write, so failure never leaves a partially updated visibility list. The view-projection matrix is column-major and uses the WebGPU clip-depth range [0, w]. Frustum-plane rejection tests all eight transformed AABB corners; any non-finite or inverted input is retained rather than risking a false-negative.