Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
|
#include <Frustum.h>
Public Member Functions | |
Frustum () | |
void | CalculateFrustum (const float angle, const float ratio, const float near, const float far, const Vector3D &camPos, const Vector3D &lookAt, const Vector3D &up) |
void | AddPlane (const Plane &pl) |
bool | GetPlane (const int index, Plane *out) const |
int | GetTotalPlanes () const |
bool | IsPointVisible (const float x, const float y, const float z) |
bool | IsSphereVisible (const float x, const float y, const float z, const float radius) |
bool | IsCubeVisible (const float x, const float y, const float z, const float size) |
bool | IsBoxVisible (const Vector3D &min, const Vector3D &max) |
bool | IsObbVisible (const OBB &obb) |
Collection of 6 planes making up a 3d frustum.
Ult::Frustum::Frustum | ( | ) |
Frustum constructor.
void Ult::Frustum::AddPlane | ( | const Plane & | pl | ) |
Copy the input plane to the internal frustum planes.
void Ult::Frustum::CalculateFrustum | ( | const float | angle, |
const float | ratio, | ||
const float | near, | ||
const float | far, | ||
const Vector3D & | camPos, | ||
const Vector3D & | lookAt, | ||
const Vector3D & | up ) |
Initialize as a camera frustum from the input parameters.
bool Ult::Frustum::GetPlane | ( | const int | index, |
Plane * | out ) const |
Store the frustum plane at the given index into 'out'.
|
inline |
Return the number of stored frustum planes.
Returns true if the input box overlaps the frustum.
bool Ult::Frustum::IsCubeVisible | ( | const float | x, |
const float | y, | ||
const float | z, | ||
const float | size ) |
Returns true if the input cube overlaps the frustum.
x,y,z | The cube's center position. |
size | The half width/length/height of the cube. |
bool Ult::Frustum::IsObbVisible | ( | const OBB & | obb | ) |
Returns true if the input oriented bounding-box overlaps the frustum.
bool Ult::Frustum::IsPointVisible | ( | const float | x, |
const float | y, | ||
const float | z ) |
Returns true if the input point is within the frustum.
bool Ult::Frustum::IsSphereVisible | ( | const float | x, |
const float | y, | ||
const float | z, | ||
const float | radius ) |
Returns true if the input sphere overlaps the frustum.
x,y,z | The sphere's center position |