Ocular Engine
|
#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 |
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.
bool Ocular::Math::Frustum::contains | ( | Point3f const & | point | ) | const |
Tests to determine if the frustum contains the specified point.
[in] | point |
bool Ocular::Math::Frustum::contains | ( | BoundsSphere const & | bounds | ) | const |
Tests to determine if the frustum contains the specified bounding sphere.
[in] | bounds |
bool Ocular::Math::Frustum::contains | ( | BoundsAABB const & | bounds | ) | const |
Tests to determine if the frustum contains the specified AABB.
[in] | bounds |
bool Ocular::Math::Frustum::contains | ( | BoundsOBB const & | bounds | ) | const |
Tests to determine if the frustum contains the specified OBB.
[in] | bounds |
float Ocular::Math::Frustum::getAspectRatio | ( | ) | const |
Plane const & Ocular::Math::Frustum::getBottomPlane | ( | ) | const |
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 |
Plane const & Ocular::Math::Frustum::getFarPlane | ( | ) | const |
float Ocular::Math::Frustum::getFieldOfView | ( | ) | const |
Plane const & Ocular::Math::Frustum::getLeftPlane | ( | ) | const |
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 |
Plane const & Ocular::Math::Frustum::getNearPlane | ( | ) | const |
Vector3f const & Ocular::Math::Frustum::getOrigin | ( | ) | const |
Plane const & Ocular::Math::Frustum::getRightPlane | ( | ) | const |
Plane const & Ocular::Math::Frustum::getTopPlane | ( | ) | const |
float Ocular::Math::Frustum::getXMax | ( | ) | const |
float Ocular::Math::Frustum::getXMin | ( | ) | const |
float Ocular::Math::Frustum::getYMax | ( | ) | const |
float Ocular::Math::Frustum::getYMin | ( | ) | const |
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.
void Ocular::Math::Frustum::setViewMatrix | ( | Math::Matrix4x4 const & | viewMatrix | ) |
Sets the view matrix that helps define this frustum.