Frustum
A [Frustum](/reference/math/frustum)
is used for view frustum culling by the renderer, enabling efficient rejection of geometry outside the visible camera volume. It is constructed from a view-projection matrix and defines six planes: left, right, top, bottom, near, and far.
This class supports containment and intersection tests with points, axis-aligned bounding boxes (AABB), and bounding spheres. All tests assume the frustum planes face inward.
Properties
The six clipping planes of the frustum: left, right, top, bottom, near, far.
Functions
ContainsPoint() auto
auto vglx::Frustum::ContainsPoint(const Vector3 &point) const
Parameter | Description |
---|---|
point | World-space position to test. |
Checks whether a point is inside the frustum.
Frustum() constexpr
vglx::Frustum::Frustum(const Matrix4 &projection)
Parameter | Description |
---|---|
projection | View-projection matrix (typically proj * view ). |
Constructs a Frustum object from a view-projection matrix.
IntersectsWithBox3() auto
auto vglx::Frustum::IntersectsWithBox3(const Box3 &box) const
Parameter | Description |
---|---|
box | Box to test against the frustum. |
Checks whether an axis-aligned bounding box intersects the frustum. Uses the "fast AABB frustum test" based on the frustum's plane normals.
IntersectsWithSphere() auto
auto vglx::Frustum::IntersectsWithSphere(const Sphere &sphere) const
Parameter | Description |
---|---|
sphere | Bounding sphere to test. |
Checks whether a sphere intersects the frustum.
SetWithViewProjection() auto
auto vglx::Frustum::SetWithViewProjection(const Matrix4 &projection)
Parameter | Description |
---|---|
projection | View-projection matrix. |
Updates the frustum using a new view-projection matrix. The planes are extracted directly from the matrix and normalized.