Frustum
Frustum encodes the camera’s visible volume using six inward-facing planes: left, right, top, bottom, near, and far. It is typically constructed from a combined view–projection matrix and used by the renderer for view frustum culling.
The class provides containment and intersection tests against points, axis-aligned bounding boxes, and bounding spheres. All checks assume that plane normals point into the frustum interior.
Construction
Constructors
Frustum() constexpr
Constructs a frustum from a view–projection matrix.
Frustum::Frustum(const Matrix4& view_proj);| Parameter | Description |
|---|---|
| view_proj | View–projection matrix. |
Functions
ContainsPoint() bool
Checks whether a point lies inside the frustum.
bool Frustum::ContainsPoint(const Vector3& point) const;| Parameter | Description |
|---|---|
| point | World-space position to test. |
IntersectsWithBox3() bool
Checks whether an axis-aligned bounding box intersects the frustum.
Uses a fast AABB–frustum test based on plane normals to reject boxes that lie completely outside the view volume.
bool Frustum::IntersectsWithBox3(const Box3& box) const;| Parameter | Description |
|---|---|
| box | Box to test. |
IntersectsWithSphere() bool
Checks whether a sphere intersects the frustum.
bool Frustum::IntersectsWithSphere(const Sphere& sphere) const;| Parameter | Description |
|---|---|
| sphere | Bounding sphere to test. |
SetWithViewProjection() void
Updates the frustum from a view–projection matrix.
Extracts the six planes from the matrix and normalizes them.
void Frustum::SetWithViewProjection(const Matrix4& view_proj);| Parameter | Description |
|---|---|
| view_proj | View–projection matrix. |