Ocular Engine
Ocular::Math::Frustum Class Reference

#include <Frustum.hpp>

Public Member Functions

void rebuild ()
 
void setViewMatrix (Math::Matrix4x4 const &viewMatrix)
 
void setProjectionMatrix (Math::Matrix4x4 const &projMatrix)
 
Math::Matrix4x4 getViewMatrix () const
 
Math::Matrix4x4 getProjectionMatrix () const
 
Vector3f const & getOrigin () const
 
std::array< Vector3f, 4 > const & getNearClipCorners () const
 
std::array< Vector3f, 4 > const & getFarClipCorners () const
 
bool contains (Point3f const &point) const
 
bool contains (BoundsSphere const &bounds) const
 
bool contains (BoundsAABB const &bounds) const
 
bool contains (BoundsOBB const &bounds) const
 
float getNearClipDistance () const
 
float getFarClipDistance () const
 
Plane const & getLeftPlane () const
 
Plane const & getRightPlane () const
 
Plane const & getTopPlane () const
 
Plane const & getBottomPlane () const
 
Plane const & getNearPlane () const
 
Plane const & getFarPlane () const
 
float getFieldOfView () const
 
float getAspectRatio () const
 
float getXMin () const
 
float getXMax () const
 
float getYMin () const
 
float getYMax () const
 

Detailed Description

A frustum is defined by a view and projection matrix and is used to perform culling tests which define what is and isn't visible.

For an object (point, bounding volume, etc.) to be considered inside of the frustum, it must not be outside of any of the 6 infinite planes that define it. The outside of a plane is defined as the positive half-space: the direction in which the plane's normal is pointing.

If an object is either inside and/or intersects all of the individual planes, then it is inside the frustum.

Member Function Documentation

bool Ocular::Math::Frustum::contains ( Point3f const &  point) const

Tests to determine if the frustum contains the specified point.

Parameters
[in]point
Returns
TRUE if bounds is inside or intersects.
bool Ocular::Math::Frustum::contains ( BoundsSphere const &  bounds) const

Tests to determine if the frustum contains the specified bounding sphere.

Parameters
[in]bounds
Returns
TRUE if bounds is inside or intersects.
bool Ocular::Math::Frustum::contains ( BoundsAABB const &  bounds) const

Tests to determine if the frustum contains the specified AABB.

Parameters
[in]bounds
Returns
TRUE if bounds is inside or intersects.
bool Ocular::Math::Frustum::contains ( BoundsOBB const &  bounds) const

Tests to determine if the frustum contains the specified OBB.

Parameters
[in]bounds
Returns
TRUE if bounds is inside or intersects.
float Ocular::Math::Frustum::getAspectRatio ( ) const
Returns
The aspect ratio. If an orthographic projection, returns 0
Plane const & Ocular::Math::Frustum::getBottomPlane ( ) const
Returns
The bottom infinite plane that helps define this frustum.
std::array< Vector3f, 4 > const & Ocular::Math::Frustum::getFarClipCorners ( ) const

Returns the four corners the comprise the finite portion of the far clip plane. These corners are ordered counter-clockwise from the bottom left:

[0] : Bottom left
[1] : Bottom right
[2] : Top right
[3] : Top left
float Ocular::Math::Frustum::getFarClipDistance ( ) const
Returns
The distance from the point-of-view to the far clip plane. Anything beyond this point will be culled.
Plane const & Ocular::Math::Frustum::getFarPlane ( ) const
Returns
The far infinite plane that helps define this frustum.
float Ocular::Math::Frustum::getFieldOfView ( ) const
Returns
The field-of-view. If an orthographic projection, returns 0
Plane const & Ocular::Math::Frustum::getLeftPlane ( ) const
Returns
The left infinite plane that helps define this frustum.
std::array< Vector3f, 4 > const & Ocular::Math::Frustum::getNearClipCorners ( ) const

Returns the four corners the comprise the finite portion of the near clip plane. These corners are ordered counter-clockwise from the bottom left:

[0] : Bottom left
[1] : Bottom right
[2] : Top right
[3] : Top left
float Ocular::Math::Frustum::getNearClipDistance ( ) const
Returns
The distance from the point-of-view to the near clip plane. Anything behind this point will be culled.
Plane const & Ocular::Math::Frustum::getNearPlane ( ) const
Returns
The near infinite plane that helps define this frustum.
Vector3f const & Ocular::Math::Frustum::getOrigin ( ) const
Returns
The point this frustum originates from.
Plane const & Ocular::Math::Frustum::getRightPlane ( ) const
Returns
The right infinite plane that helps define this frustum.
Plane const & Ocular::Math::Frustum::getTopPlane ( ) const
Returns
The top infinite plane that helps define this frustum.
float Ocular::Math::Frustum::getXMax ( ) const
Returns
The maximum x value. Used only with orthographic projections.
float Ocular::Math::Frustum::getXMin ( ) const
Returns
The minimum x value. Used only with orthographic projections.
float Ocular::Math::Frustum::getYMax ( ) const
Returns
The maximum y value. Used only with orthographic projections.
float Ocular::Math::Frustum::getYMin ( ) const
Returns
The minimum y value. Used only with orthographic projections.
void Ocular::Math::Frustum::rebuild ( )

Rebuilds the frustum using the current view and projection settings.

void Ocular::Math::Frustum::setProjectionMatrix ( Math::Matrix4x4 const &  projMatrix)

Sets the projection matrix that helps define this frustum.

Note
Must call rebuild to update the frustum.
void Ocular::Math::Frustum::setViewMatrix ( Math::Matrix4x4 const &  viewMatrix)

Sets the view matrix that helps define this frustum.

Note
Must call rebuild to update the frustum.

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