|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions
gameplay::Frustum Class Reference

`#include <Frustum.h>`

List of all members.

## 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)

## Detailed Description

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.

## Constructor & Destructor Documentation

gameplay::Frustum::Frustum | ( |  | ) |

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.

Parameters:

  matrix | The view projection matrix to create this frustum from.

gameplay::Frustum::Frustum | ( | const Frustum & | frustum | ) |

Constructs a new frustum from the given frustum.

Parameters:

  frustum | The frustum to create this frustum from.

gameplay::Frustum::~Frustum | ( |  | ) |

Destructor.

## Member Function Documentation

const Plane& gameplay::Frustum::getBottom | ( |  | ) | const

Gets the bottom plane of the frustum.

Returns:
  bottom The bottom plane.

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.

Parameters:

  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.

Returns:
  far The far plane.

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.

Parameters:

  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.

Returns:
  left The left plane.

void gameplay::Frustum::getMatrix | ( | Matrix * | dst | ) | const

Gets the projection matrix corresponding to the frustum in the specified matrix.

Parameters:

  dst | The projection matrix to copy into.

const Plane& gameplay::Frustum::getNear | ( |  | ) | const

Gets the near plane of the frustum.

Returns:
  near The near plane.

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.

Parameters:

  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.

Returns:
  right The right plane.

const Plane& gameplay::Frustum::getTop | ( |  | ) | const

Gets the top plane of the frustum.

Returns:
  top The top plane.

bool gameplay::Frustum::intersects | ( | const Vector3 & | point | ) | const

Tests whether this frustum intersects the specified point.

Parameters:

  point | The point to test intersection with.

Returns:
  true if the specified point intersects this frustum; false otherwise.

bool gameplay::Frustum::intersects | ( | float | x,
|  | float | y,
|  | float | z
| ) |  | const

Tests whether this frustum intersects the specified point.

Parameters:

  x | The x coordinate.
  y | The y coordinate.
  z | The z coordinate.

Returns:
  true if the specified point intersects this frustum; false otherwise.

bool gameplay::Frustum::intersects | ( | const BoundingSphere & | sphere | ) | const

Tests whether this frustum intersects the specified bounding sphere.

Parameters:

  sphere | The bounding sphere to test intersection with.

Returns:
  true if the specified bounding sphere intersects this frustum; false otherwise.

bool gameplay::Frustum::intersects | ( | const BoundingBox & | box | ) | const

Tests whether this frustum intersects the specified bounding box.

Parameters:

  box | The bounding box to test intersection with.

Returns:
  true if the specified bounding box intersects this frustum; false otherwise.

float gameplay::Frustum::intersects | ( | const Plane & | plane | ) | const

Tests whether this frustum intersects the specified plane.

Parameters:

  plane | The plane to test intersection with.

Returns:
  Plane::INTERSECTS_BACK if the specified bounding object is in the negative half-space of this plane, Plane::INTERSECTS_FRONT if it is in the positive half-space of this plane, and Plane::INTERSECTS_INTERSECTING if it intersects this plane.

float gameplay::Frustum::intersects | ( | const Ray & | ray | ) | const

Tests whether this frustum intersects the specified ray.

Parameters:

  ray | The ray to test intersection with.

Returns:
  Plane::INTERSECTS_BACK if the specified ray is in the negative half-space of this plane, Plane::INTERSECTS_FRONT if it is in the positive half-space of this plane, and Plane::INTERSECTS_INTERSECTING if it intersects this plane.

void gameplay::Frustum::set | ( | const Frustum & | frustum | ) |

Sets this frustum to the specified frustum.

Parameters:

  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.

Parameters:

  matrix | The view projection matrix.

All Classes Functions Variables Typedefs Enumerations Enumerator