Describes a geometrical frustrum for projection calculations. More...
#include <frustrum.h>
Classes | |
class | FrustrumPrivate |
Public Member Functions | |
Frustrum () | |
virtual | ~Frustrum () |
Frustrum (const Frustrum &other) | |
Frustrum & | operator= (const Frustrum &other) |
QMatrix4x4 | projectionMatrix () |
bool | containsPoint (const QVector3D &point) |
bool | containsSphere (const QVector3D &point, float radius) |
float | nearPlane () |
float | farPlane () |
QRectF | viewPlane () |
void | setOrthographic (float left, float right, float bottom, float top, float near, float far) |
void | setOrthoAdjusted (const QSizeF &area, float aspect, float near, float far) |
void | setPerspective (float fov, float aspect, float near, float far) |
void | updateFrustrum (float aspect) |
Describes a geometrical frustrum for projection calculations.
A frustrum is essentially a pyramid with the top removed. It is used for projection calculations and a technqiue called frustrum culling.
Definition at line 41 of file frustrum.h.
Frustrum::Frustrum | ( | ) |
Frustrum::~Frustrum | ( | ) | [virtual] |
Destructor.
Definition at line 76 of file frustrum.cpp.
Frustrum::Frustrum | ( | const Frustrum & | other | ) |
Definition at line 62 of file frustrum.cpp.
bool Frustrum::containsPoint | ( | const QVector3D & | point | ) |
Check whether a point falls within the frustrum.
point | The point to check whether it is inside the frustrum. |
Definition at line 88 of file frustrum.cpp.
bool Frustrum::containsSphere | ( | const QVector3D & | point, | |
float | radius | |||
) |
Check whether a sphere falls within the frustrum.
point | The centre point of the sphere that needs to be checked.
|
Definition at line 94 of file frustrum.cpp.
float Frustrum::farPlane | ( | ) |
Retrieve the distance to the far plane of this frustrum.
Definition at line 104 of file frustrum.cpp.
float Frustrum::nearPlane | ( | ) |
Retrieve the distance to the near plane of this frustrum.
Definition at line 99 of file frustrum.cpp.
Definition at line 68 of file frustrum.cpp.
QMatrix4x4 Frustrum::projectionMatrix | ( | ) |
Retrieve the projection matrix.
Definition at line 82 of file frustrum.cpp.
void Frustrum::setOrthoAdjusted | ( | const QSizeF & | area, | |
float | aspect, | |||
float | near, | |||
float | far | |||
) |
Set this frustrum to use an orthographic projection, adjusted for aspect ratio.
Note that the view plane will always be centred on 0,0; that is, the view plane's left coordinate will be -(area.width / 2).
area | The area describing the width and height of the view plane.
|
Definition at line 129 of file frustrum.cpp.
void Frustrum::setOrthographic | ( | float | left, | |
float | right, | |||
float | bottom, | |||
float | top, | |||
float | near, | |||
float | far | |||
) |
Set this frustrum to use an orthographic projection.
left | The left coordinate of the view plane.
|
Definition at line 115 of file frustrum.cpp.
void Frustrum::setPerspective | ( | float | fov, | |
float | aspect, | |||
float | near, | |||
float | far | |||
) |
Set this frustrum to use a perspective projection.
fov | The field of view, in radians.
|
Definition at line 155 of file frustrum.cpp.
void Frustrum::updateFrustrum | ( | float | aspect | ) |
Update the frustrum to account for a new aspect ratio.
aspect | The new aspect ratio to use. |
Definition at line 169 of file frustrum.cpp.
QRectF Frustrum::viewPlane | ( | ) |
Retrieve the view plane of this frustrum.
The view plane is equal to the near plane.
Definition at line 109 of file frustrum.cpp.