Kemena3D
Loading...
Searching...
No Matches
kemena::kFrustum Class Reference

View frustum defined by six planes extracted from a view-projection matrix. More...

#include <koctree.h>

Public Member Functions

void extractFromMatrix (const kMat4 &viewProjection)
 Extract the six frustum planes from a combined view-projection matrix.
kFrustumTestResult testAABB (const kAABB &aabb) const
 Test an AABB against the frustum.
bool intersectsAABB (const kAABB &aabb) const
 Quick reject: returns false if the AABB is fully outside.

Detailed Description

View frustum defined by six planes extracted from a view-projection matrix.

Call extractFromMatrix() with (projection * view) each frame before querying.

Member Function Documentation

◆ extractFromMatrix()

void kemena::kFrustum::extractFromMatrix ( const kMat4 & viewProjection)

Extract the six frustum planes from a combined view-projection matrix.

Uses the Gribb-Hartmann method (row combination of the VP matrix). The planes are stored in the form n·x + d = 0 where positive values are inside the frustum.

Parameters
viewProjectionprojection * view matrix.

◆ intersectsAABB()

bool kemena::kFrustum::intersectsAABB ( const kAABB & aabb) const

Quick reject: returns false if the AABB is fully outside.

◆ testAABB()

kFrustumTestResult kemena::kFrustum::testAABB ( const kAABB & aabb) const

Test an AABB against the frustum.

Returns
Outside — AABB is fully outside at least one plane. Intersecting — AABB crosses one or more planes. Inside — AABB is fully inside all six planes.

The documentation for this class was generated from the following file: