This class defines a View Frustum Volume as a set of 6 planes. More...
#include <Frustum.h>
Public Types | |
enum | PlaneNames { PLANE_LEFT = 0, PLANE_RIGHT = 1, PLANE_BOTTOM = 2, PLANE_TOP = 3, PLANE_NEAR = 4, PLANE_FAR = 5 } |
An enum to name the plane indicies. More... | |
typedef DATA_TYPE | DataType |
typedef Frustum< DATA_TYPE > | FrustumType |
Public Member Functions | |
Frustum () | |
Constructs a new frustum with all planes in default state. | |
Frustum (const gmtl::Matrix< DATA_TYPE, 4, 4 > &projMatrix) | |
Constructs a new frustum with the given projection matrix. | |
Frustum (const gmtl::Matrix< DATA_TYPE, 4, 4 > &modelviewMatrix, const gmtl::Matrix< DATA_TYPE, 4, 4 > &projMatrix) | |
Constructs a new frustum with given projection and modelview matricies. | |
void | extractPlanes (const gmtl::Matrix< DATA_TYPE, 4, 4 > &modelviewMatrix, const gmtl::Matrix< DATA_TYPE, 4, 4 > &projMatrix) |
Extracts the planes from the given projection matrix. | |
void | extractPlanes (const gmtl::Matrix< DATA_TYPE, 4, 4 > &projMatrix) |
Extracts the planes from the given projection and modelview matricies. | |
Public Attributes | |
gmtl::Plane< DATA_TYPE > | mPlanes [6] |
This class defines a View Frustum Volume as a set of 6 planes.
Definition at line 23 of file Frustum.h.
typedef DATA_TYPE gmtl::Frustum< DATA_TYPE >::DataType |
typedef Frustum<DATA_TYPE> gmtl::Frustum< DATA_TYPE >::FrustumType |
enum gmtl::Frustum::PlaneNames |
An enum to name the plane indicies.
To have you not must remember those numbers.
Definition at line 33 of file Frustum.h.
{ PLANE_LEFT = 0, PLANE_RIGHT = 1, PLANE_BOTTOM = 2, PLANE_TOP = 3, PLANE_NEAR = 4, PLANE_FAR = 5 };
gmtl::Frustum< DATA_TYPE >::Frustum | ( | ) | [inline] |
gmtl::Frustum< DATA_TYPE >::Frustum | ( | const gmtl::Matrix< DATA_TYPE, 4, 4 > & | projMatrix | ) | [inline] |
Constructs a new frustum with the given projection matrix.
projMatrix | The projection matrix of your camera or light etc. to construct the planes from. |
Definition at line 57 of file Frustum.h.
{ extractPlanes(projMatrix); }
gmtl::Frustum< DATA_TYPE >::Frustum | ( | const gmtl::Matrix< DATA_TYPE, 4, 4 > & | modelviewMatrix, | |
const gmtl::Matrix< DATA_TYPE, 4, 4 > & | projMatrix | |||
) | [inline] |
Constructs a new frustum with given projection and modelview matricies.
the matricies are multiplied in this order:
M = projMatrix * modelviewMatrix
The planes are then extracted from M.
modelviewMatrix | The modelview matrix of you camera or light etc. to construct the planes from. | |
projMatrix | The projection matrix of your camera or light or whatever. |
Definition at line 77 of file Frustum.h.
{ extractPlanes(modelviewMatrix, projMatrix); }
void gmtl::Frustum< DATA_TYPE >::extractPlanes | ( | const gmtl::Matrix< DATA_TYPE, 4, 4 > & | modelviewMatrix, | |
const gmtl::Matrix< DATA_TYPE, 4, 4 > & | projMatrix | |||
) | [inline] |
Extracts the planes from the given projection matrix.
projMatrix | The projection matrix of you camera or light or what ever. |
Definition at line 89 of file Frustum.h.
{ extractPlanes(projMatrix * modelviewMatrix); }
void gmtl::Frustum< DATA_TYPE >::extractPlanes | ( | const gmtl::Matrix< DATA_TYPE, 4, 4 > & | projMatrix | ) | [inline] |
Extracts the planes from the given projection and modelview matricies.
The matricies are multiplied in this order:
M = projMatrix * modelviewMatrix
The planes are then extracted from M.
modelviewMatrix | The modelview matrix of you camera or light etc. to construct the planes from. | |
projMatrix | The projection matrix of you camera or light etc. to construct the planes from. |
Definition at line 110 of file Frustum.h.
{ const gmtl::Matrix<DATA_TYPE, 4, 4>& m = projMatrix; //left mPlanes[PLANE_LEFT].setNormal(gmtl::Vec<DATA_TYPE, 3>(m[3][0] + m[0][0], m[3][1] + m[0][1], m[3][2] + m[0][2])); mPlanes[PLANE_LEFT].setOffset(m[3][3] + m[0][3]); //right mPlanes[PLANE_RIGHT].setNormal(gmtl::Vec<DATA_TYPE, 3>(m[3][0] - m[0][0], m[3][1] - m[0][1], m[3][2] - m[0][2])); mPlanes[PLANE_RIGHT].setOffset(m[3][3] - m[0][3]); //bottom mPlanes[PLANE_BOTTOM].setNormal(gmtl::Vec<DATA_TYPE, 3>(m[3][0] + m[1][0], m[3][1] + m[1][1], m[3][2] + m[1][2])); mPlanes[PLANE_BOTTOM].setOffset(m[3][3] + m[1][3]); //top mPlanes[PLANE_TOP].setNormal(gmtl::Vec<DATA_TYPE, 3>(m[3][0] - m[1][0], m[3][1] - m[1][1], m[3][2] - m[1][2])); mPlanes[PLANE_TOP].setOffset(m[3][3] - m[1][3]); //near mPlanes[PLANE_NEAR].setNormal(gmtl::Vec<DATA_TYPE, 3>(m[3][0] + m[2][0], m[3][1] + m[2][1], m[3][2] + m[2][2])); mPlanes[PLANE_NEAR].setOffset(m[2][3] + m[3][3]); //far mPlanes[PLANE_FAR].setNormal(gmtl::Vec<DATA_TYPE, 3>(m[3][0] - m[2][0], m[3][1] - m[2][1], m[3][2] - m[2][2])); mPlanes[PLANE_FAR].setOffset(m[3][3] - m[2][3]); }
gmtl::Plane<DATA_TYPE> gmtl::Frustum< DATA_TYPE >::mPlanes[6] |