CUGL 2.1
Cornell University Game Library
|
#include <CUFrustum.h>
Public Types | |
enum | Region { Region::INSIDE, Region::OUTSIDE, Region::INTERSECT } |
enum | Side : unsigned int { Side::CLOSE = 0, Side::AWAY = 1, Side::LEFT = 2, Side::RIGHT = 3, Side::TOP = 4, Side::BOTTOM = 5 } |
Public Member Functions | |
Frustum () | |
Frustum (const Mat4 &inverseView) | |
Frustum (const Frustum &frustum) | |
~Frustum () | |
Frustum & | operator= (const Mat4 &inverseView) |
Frustum & | operator= (const Frustum &frustum) |
Frustum & | set (const Mat4 &inverseView) |
Frustum & | set (const Frustum &frustum) |
const Plane & | getPlane (Side side) |
const Vec3 | getCorner (unsigned int index) |
Region | find (const Vec3 point) |
Region | find (float x, float y, float z) |
Region | findSphere (const Vec3 center, float radius) |
Region | findSphere (float x, float y, float z, float radius) |
Region | findSphereWithoutNearFar (const Vec3 center, float radius) |
Region | findSphereWithoutNearFar (float x, float y, float z, float radius) |
Region | findBox (const Vec3 center, const Vec3 dimension) |
Region | findBox (float x, float y, float z, float halfWidth, float halfHeight, float halfDepth) |
Static Public Attributes | |
static const int | PLANE_COUNT = 6 |
static const int | CORNER_COUNT = 8 |
This class is a truncated rectangular pyramid.
A frustum is used to define the viewable region and its projection onto the screen. Normally, we would embed this into a camera class. However, we do not want our cameras any more heavy weight than they are, so we pull them out.
|
strong |
|
strong |
|
inline |
Creates a frustum for the identity matrix.
|
inline |
Creates a frustum for the inverse projection view matrix.
inverseView | The inverse projection view matrix. |
|
inline |
Creates a copy of the given frustum.
frustum | The frustum to copy. |
|
inline |
Destroys this frustum, releasing all resources
Returns the location of the point with respect to the frustum.
point | The point to check. |
|
inline |
Returns the location of the point with respect to the frustum.
x | The x-coordinate of the point |
y | The y-coordinate of the point |
z | The z-coordinate of the point |
Returns the location of the bounding box with respect to the frustum.
The bounding box is a cube, defined by its center and dimenion along each axis.
center | The center of the bounding box |
dimension | The dimensions of the bounding box |
Region cugl::Frustum::findBox | ( | float | x, |
float | y, | ||
float | z, | ||
float | halfWidth, | ||
float | halfHeight, | ||
float | halfDepth | ||
) |
Returns the location of the bounding box with respect to the frustum.
The bounding box is a cube, defined by its center and dimenion along each axis.
x | The x-coordinate of the center of the bounding box |
y | The y-coordinate of the center of the bounding box |
z | The z-coordinate of the center of the bounding box |
halfWidth | Half of the width (x-axis) of the bounding box |
halfHeight | Half of the height (y-axis) of the bounding box |
halfDepth | Half of the depth (z-axis) of the bounding box |
Returns the location of the sphere with respect to the frustum.
center | The center of the sphere |
radius | The radius of the sphere |
|
inline |
Returns the location of the sphere with respect to the frustum.
x | The x-coordinate of the center of the sphere |
y | The y-coordinate of the center of the sphere |
z | The z-coordinate of the center of the sphere |
radius | The radius of the sphere |
Returns the location of the sphere with respect to the frustum.
This method does not check whether is the behind the near or far clipping planes.
center | The center of the sphere |
radius | The radius of the sphere |
|
inline |
Returns the location of the sphere with respect to the frustum.
This method does not check whether is the behind the near or far clipping planes.
x | The x-coordinate of the center of the sphere |
y | The y-coordinate of the center of the sphere |
z | The z-coordinate of the center of the sphere |
radius | The radius of the sphere |
|
inline |
Returns the frustum corner for the given index.
The order is counter clockwise, starting at bottom left
Returns the clipping plane for the given side.
See the enum Side for the available options.
side | The clipping plane side. |
Sets this frustum to be a copy of the given frustum.
frustum | The frustum to copy, |
Sets this frustum's clipping planes to the given inverse projection view matrix.
inverseView | The inverse projection view matrix. |
Sets this frustum to be a copy of the given frustum.
frustum | The frustum to copy, |
Sets this frustum's clipping planes to the given inverse projection view matrix.
inverseView | The inverse projection view matrix. |
|
static |
The number of corners in a frustum
|
static |
The number of planes in a frustum