Contents

cullMeshInstances(_:indices:outIndices:configuration:)

Culls mesh instances against a frustum, writing surviving indices to an output span.

Declaration

static func cullMeshInstances(_ meshInstances: LowLevelMeshInstanceArray, indices: Span<Int>, outIndices: inout OutputSpan<Int>, configuration: LowLevelRenderer.CullConfiguration)

Parameters

  • meshInstances:

    The mesh instance array to test.

  • indices:

    The candidate indices to test.

  • outIndices:

    The span that receives surviving indices. Must have free capacity of at least indices.count.

  • configuration:

    The cull configuration supplying the frustum planes.

Discussion

Tests each instance’s bounds against the planes in configuration.frustum, using meshInstance.bounds when set and falling back to the mesh part’s bounds otherwise. Instances whose bounds lie entirely outside any single plane are discarded; the rest are appended to outIndices in the same order as indices. nil slots in meshInstances are skipped.

See Also

Culling and sorting instances