#include <Frustum.h>
Public Member Functions | |
Frustum () | |
Frustum (const Matrix &matrix) | |
Frustum (const Frustum &frustum) | |
~Frustum () | |
const Plane & | getNear () const |
const Plane & | getFar () const |
const Plane & | getLeft () const |
const Plane & | getRight () const |
const Plane & | getBottom () const |
const Plane & | getTop () const |
void | getMatrix (Matrix *dst) const |
void | getCorners (Vector3 *corners) const |
void | getNearCorners (Vector3 *corners) const |
void | getFarCorners (Vector3 *corners) const |
bool | intersects (const Vector3 &point) const |
bool | intersects (float x, float y, float z) const |
bool | intersects (const BoundingSphere &sphere) const |
bool | intersects (const BoundingBox &box) const |
float | intersects (const Plane &plane) const |
float | intersects (const Ray &ray) const |
void | set (const Frustum &frustum) |
void | set (const Matrix &matrix) |
Defines a 3-dimensional frustum.
A frustum in computer graphics is generally a volume of 3D space, defined as the part of a rectangular pyramid that lies between two planes perpendicular to its center line. A frustum is often used to represent what a "camera" sees in your 3D space.
The Frustum class allows you to define a bounding frustum using a combined matrix that is generally the product of a view matrix and a projection matrix.
You can query a Frustum object for any one of its bounding planes, for its corners, and for whether it intersects with a given object. Since objects that don't intersect with your view frustum generally don't need to be rendered, culling them quickly can save you a lot of rendering time.
Constructs the default frustum (corresponds to the identity matrix).
gameplay::Frustum::Frustum | ( | const Matrix & | matrix | ) |
Constructs a new frustum from the specified view projection matrix.
matrix | The view projection matrix to create this frustum from. |
gameplay::Frustum::Frustum | ( | const Frustum & | frustum | ) |
Constructs a new frustum from the given frustum.
frustum | The frustum to create this frustum from. |
Destructor.
const Plane& gameplay::Frustum::getBottom | ( | ) | const |
Gets the bottom plane of the frustum.
void gameplay::Frustum::getCorners | ( | Vector3 * | corners | ) | const |
Gets the corners of the frustum in the specified array.
The corners are stored in the following order: (N-near, F-far, L-left, R-right, B-bottom, T-top) LTN, LBN, RBN, RTN, RTF, RBF, LBF, LTF.
corners | The array (of at least size 8) to store the corners in. |
const Plane& gameplay::Frustum::getFar | ( | ) | const |
Gets the far plane of the frustum.
void gameplay::Frustum::getFarCorners | ( | Vector3 * | corners | ) | const |
Gets the corners of the frustum's far plane in the specified array.
The corners are stored in the following order: right-top, right-bottom, left-bottom, left-top.
corners | The array (of at least size 4) to store the corners in. |
const Plane& gameplay::Frustum::getLeft | ( | ) | const |
Gets the left plane of the frustum.
void gameplay::Frustum::getMatrix | ( | Matrix * | dst | ) | const |
Gets the projection matrix corresponding to the frustum in the specified matrix.
dst | The projection matrix to copy into. |
const Plane& gameplay::Frustum::getNear | ( | ) | const |
Gets the near plane of the frustum.
void gameplay::Frustum::getNearCorners | ( | Vector3 * | corners | ) | const |
Gets the corners of the frustum's near plane in the specified array.
The corners are stored in the following order: left-top, left-bottom, right-bottom, right-top.
corners | The array (of at least size 4) to store the corners in. |
const Plane& gameplay::Frustum::getRight | ( | ) | const |
Gets the right plane of the frustum.
const Plane& gameplay::Frustum::getTop | ( | ) | const |
Gets the top plane of the frustum.
bool gameplay::Frustum::intersects | ( | const Vector3 & | point | ) | const |
Tests whether this frustum intersects the specified point.
point | The point to test intersection with. |
bool gameplay::Frustum::intersects | ( | float | x, |
float | y, | ||
float | z | ||
) | const |
Tests whether this frustum intersects the specified point.
x | The x coordinate. |
y | The y coordinate. |
z | The z coordinate. |
bool gameplay::Frustum::intersects | ( | const BoundingSphere & | sphere | ) | const |
Tests whether this frustum intersects the specified bounding sphere.
sphere | The bounding sphere to test intersection with. |
bool gameplay::Frustum::intersects | ( | const BoundingBox & | box | ) | const |
Tests whether this frustum intersects the specified bounding box.
box | The bounding box to test intersection with. |
float gameplay::Frustum::intersects | ( | const Plane & | plane | ) | const |
Tests whether this frustum intersects the specified plane.
plane | The plane to test intersection with. |
float gameplay::Frustum::intersects | ( | const Ray & | ray | ) | const |
Tests whether this frustum intersects the specified ray.
ray | The ray to test intersection with. |
void gameplay::Frustum::set | ( | const Frustum & | frustum | ) |
Sets this frustum to the specified frustum.
frustum | The frustum to set to. |
void gameplay::Frustum::set | ( | const Matrix & | matrix | ) |
Sets the frustum to the frustum corresponding to the specified view projection matrix.
matrix | The view projection matrix. |