Skip to content

Frustum

Represents a view frustum defined by six clipping planes.

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

planes std::array<Plane, 6 >

cpp
std::array<Plane, 6 > planes

The six clipping planes of the frustum: left, right, top, bottom, near, far.

Functions

ContainsPoint() auto

cpp
auto vglx::Frustum::ContainsPoint(const Vector3 &point) const
ParameterDescription
pointWorld-space position to test.

Checks whether a point is inside the frustum.

Frustum() constexpr

cpp
vglx::Frustum::Frustum(const Matrix4 &projection)
ParameterDescription
projectionView-projection matrix (typically proj * view).

Constructs a Frustum object from a view-projection matrix.

IntersectsWithBox3() auto

cpp
auto vglx::Frustum::IntersectsWithBox3(const Box3 &box) const
ParameterDescription
boxBox 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

cpp
auto vglx::Frustum::IntersectsWithSphere(const Sphere &sphere) const
ParameterDescription
sphereBounding sphere to test.

Checks whether a sphere intersects the frustum.

SetWithViewProjection() auto

cpp
auto vglx::Frustum::SetWithViewProjection(const Matrix4 &projection)
ParameterDescription
projectionView-projection matrix.

Updates the frustum using a new view-projection matrix. The planes are extracted directly from the matrix and normalized.

Released under the MIT License.