Skip to main content

Module frustum

Module frustum 

Source
Expand description

Backend-agnostic frustum culling.

Given a column-major view-projection matrix the six clip-space planes are extracted using the Gribb-Hartmann method (left/right/bottom/top/near/far). Frustum::intersects_aabb returns false only when an axis-aligned bounding box is fully outside at least one plane. False positives are acceptable for culling (a few extra draws), false negatives are not, so the test treats the box as visible whenever it overlaps any plane.

Structs§

Frustum
The six clip-space planes of a view frustum.
Plane
One frustum plane in clip space.

Functions§

aabb_distance_sq
Squared distance from cam to the closest point on the AABB. Returns 0 if cam is inside.
transform_aabb
Compute the world-space AABB enclosing a local-space AABB transformed by a column-major model matrix. All eight corners are transformed and min/max’d component-wise.