Reference: https://learnopengl.com/Guest-Articles/2021/Scene/Frustum-Culling

Constructor

new(?projection:Matrix3D)

Parameters:

projection

Create frustum planes from a projection matrix

Variables

@:value([new Vector3D(), new Vector3D(), new Vector3D(), new Vector3D(), new Vector3D(), new Vector3D()])planes:ReadOnlyArray<Vector3D> = [new Vector3D(), new Vector3D(), new Vector3D(), new Vector3D(), new Vector3D(), new Vector3D()]

An array containing 6 planes, each for one side of the frustum. Since Vector3D already has a 4th component, we can just use that for distance

Methods

fromProjection(projection:Matrix3D):Void

Stores each plane of the projection frustum for culling calculations

Because the purpose is merely for frustum culling, we abs() all plane normals here to prevent doing that for every check

If you want robust frustum collision detection, use the (upcoming) physics engine instead

inlinetestAABBPlane(plane:Vector3D, box:BoundingBox):Bool

Tests if the plane is intersecting a BoundingBox

AABB Plane intersection

overlapsBox(box:BoundingBox):Bool

Tests if a BoundingBox is inside the frustum