![]() |
PURE API 0.5
PR00F's Ultimate Rendering Engine full documentation
|
PURE 3D-transformation matrix class. More...
PURE 3D-transformation matrix class.
PURE uses the left-handed Cartesian coordinate system. This means the XZ plane is horizontal, the XY and and YZ planes are vertical, a positive X value means right, a positive Y value means up, and a positive Z value means forward.
Definition at line 23 of file PureTransformMatrix.h.
#include <PureTransformMatrix.h>
Public Member Functions | |
PureTransformMatrix () | |
Creates an identity matrix. | |
PureTransformMatrix (const PureTransformMatrix &cm) | |
PureTransformMatrix (const TPURE_NOTABLE_MATRICES &nm) | |
Creates the requested matrix. | |
virtual | ~PureTransformMatrix () |
void | SetRotationX (TPureFloat anglex) |
Sets the matrix to a rotation matrix around X-axis. | |
void | SetRotationY (TPureFloat angley) |
Sets the matrix to a rotation matrix around Y-axis. | |
void | SetRotationZ (TPureFloat anglez) |
Sets the matrix to a rotation matrix around Z-axis. | |
void | SetTranslation (TPureFloat x, TPureFloat y, TPureFloat z) |
Sets the matrix to a translation matrix. | |
TPureFloat | getScaleX () const |
Gets the scaling on the X-axis. | |
TPureFloat | getScaleY () const |
Gets the scaling on the Y-axis. | |
TPureFloat | getScaleZ () const |
Gets the scaling on the Z-axis. | |
void | SetScale (TPureFloat x, TPureFloat y, TPureFloat z) |
Sets the scalings on the 3 axes. | |
void | SetScaleX (TPureFloat x) |
Sets the matrix to a scaling matrix only on the X-axis. | |
void | SetScaleY (TPureFloat y) |
Sets the matrix to a scaling matrix only on the Y-axis. | |
void | SetScaleZ (TPureFloat z) |
Sets the matrix to a scaling matrix only on the Z-axis. | |
void | SetMirrorXY () |
Sets the matrix to a mirroring matrix on the XY planes. | |
void | SetMirrorXZ () |
Sets the matrix to a mirroring matrix on the XZ planes. | |
void | SetMirrorYZ () |
Sets the matrix to a mirroring matrix on the YZ planes. | |
void | SetFrustum (float left, float right, float bottom, float top, float n, float f) |
Sets the matrix to represent a viewing frustum in world coordinate system. | |
void | SetFrustumByFovX (float fovx, float aspect, float zNear, float zFar) |
Sets the matrix to represent a viewing frustum in world coordinate system. | |
void | SetFrustumByFovY (float fovy, float aspect, float zNear, float zFar) |
Sets the matrix to represent a viewing frustum in world coordinate system. | |
void | SetLookAt (const PureVector &pos, const PureVector &target, const PureVector &up) |
Sets the matrix to represent a view matrix in world coordinate system. | |
![]() | |
PureMatrix () | |
Creates an identity matrix. | |
PureMatrix (const PureMatrix &cm) | |
PureMatrix (const TPURE_NOTABLE_MATRICES &nm) | |
Creates the requested matrix. | |
virtual | ~PureMatrix () |
TPureFloat | get (TPureByte row, TPureByte col) const |
Gets the element at the given row and column. | |
void | Set (TPureByte row, TPureByte col, TPureFloat value) |
Sets the element at the given row and column. | |
const TPureFloat * | get () const |
Returns the matrix array as is. | |
TPureBool | isZero () const |
Is it a zero matrix? | |
void | SetZero () |
Sets the matrix to zero matrix. | |
TPureBool | isIdentity () const |
Is it an identity matrix? | |
void | SetIdentity () |
Sets the matrix to identity matrix. | |
void | Transpose () |
Transposes the matrix. | |
const TPureFloat * | getTransposed () |
Returns the matrix array in its transposed form without actually modifying the matrix. | |
TPureFloat | getDeterminant () const |
Returns the determinant of the matrix. | |
TPureBool | isInvertible () const |
Returns if the matrix is invertible. | |
TPureBool | invert () |
Inverts the matrix. | |
const TPureFloat * | getInverse () |
Returns the matrix array in its inverted form without actually modifying the matrix. | |
TPureBool | operator== (const PureMatrix &cm) const |
Equals to operator. | |
TPureBool | operator!= (const PureMatrix &cm) const |
Not equals to operator. | |
PureMatrix & | operator= (const PureMatrix &cm) |
Assignment operator. | |
PureMatrix | operator+ (const PureMatrix &cm) const |
Addition operator. | |
PureMatrix & | operator+= (const PureMatrix &cm) |
Addition assignment operator. | |
PureMatrix | operator- (const PureMatrix &cm) const |
Subtraction operator. | |
PureMatrix & | operator-= (const PureMatrix &cm) |
Subtraction assignment operator. | |
PureMatrix | operator* (const PureMatrix &cm) const |
Multiplication by matrix operator. | |
PureMatrix & | operator*= (const PureMatrix &cm) |
Multiplication assignment operator. | |
PureMatrix | operator* (const TPureFloat &scalar) const |
Multiplication by scalar operator. | |
PureMatrix & | operator*= (const TPureFloat &scalar) |
Multiplication assignment operator. | |
PureVector | operator* (const PureVector &vec) const |
Multiplication by vector operator. | |
TPureFloat & | operator() (const TPureByte &row, const TPureByte &col) |
Access element operator operator. | |
const TPureFloat & | operator() (const TPureByte &row, const TPureByte &col) const |
Access element operator operator. | |
Static Public Member Functions | |
static const PureTransformMatrix & | getZero () |
Gets a constant zero matrix. | |
static const PureTransformMatrix & | getIdentity () |
Gets a constant identity matrix. | |
![]() | |
static const PureMatrix & | getZero () |
Gets a constant zero matrix. | |
static const PureMatrix & | getIdentity () |
Gets a constant identity matrix. | |
Static Private Attributes | |
static PureTransformMatrix | matIdentity |
Static zero matrix. | |
static PureTransformMatrix | matZero |
Static identity matrix. | |
Additional Inherited Members | |
![]() | |
TPureFloat | mat [4][4] |
Values. | |
PureTransformMatrix::PureTransformMatrix | ( | ) |
Creates an identity matrix.
Definition at line 39 of file PureTransformMatrix.cpp.
PureTransformMatrix::PureTransformMatrix | ( | const PureTransformMatrix & | cm | ) |
Definition at line 44 of file PureTransformMatrix.cpp.
|
explicit |
Creates the requested matrix.
Definition at line 53 of file PureTransformMatrix.cpp.
|
virtual |
Definition at line 59 of file PureTransformMatrix.cpp.
|
static |
Gets a constant identity matrix.
Definition at line 30 of file PureTransformMatrix.cpp.
TPureFloat PureTransformMatrix::getScaleX | ( | ) | const |
Gets the scaling on the X-axis.
Definition at line 125 of file PureTransformMatrix.cpp.
TPureFloat PureTransformMatrix::getScaleY | ( | ) | const |
Gets the scaling on the Y-axis.
Definition at line 134 of file PureTransformMatrix.cpp.
TPureFloat PureTransformMatrix::getScaleZ | ( | ) | const |
Gets the scaling on the Z-axis.
Definition at line 143 of file PureTransformMatrix.cpp.
|
static |
Gets a constant zero matrix.
Definition at line 21 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetFrustum | ( | float | left, |
float | right, | ||
float | bottom, | ||
float | top, | ||
float | n, | ||
float | f ) |
Sets the matrix to represent a viewing frustum in world coordinate system.
It can be used to produce perspective projection, typically from eye space to clip space. Assuming that the eye is located at (0, 0, 0), following statements we can make:
Depth buffer precision is affected by the values specified for n and f. The greater the ratio of f to n is, the less effective the depth buffer will be at distinguishing between surfaces that are near each other.
left | Left clipping plane distance to the viewer in eye space on X direction. |
right | Right clipping plane distance to the viewer in eye space on X direction. Must be greater than left. |
bottom | Bottom clipping plane distance to the viewer in eye space on Y direction. |
top | Top clipping plane distance to the viewer in eye space on Y direction. Must be greater than bottom. |
n | Near clipping plane distance to the viewer in eye space on Z direction. Must be greater than 0. |
f | Far clipping plane distance to the viewer in eye space on Z direction. Must be greater than n. |
Definition at line 235 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetFrustumByFovX | ( | float | fovx, |
float | aspect, | ||
float | zNear, | ||
float | zFar ) |
Sets the matrix to represent a viewing frustum in world coordinate system.
It can be used to produce perspective projection, typically from eye space to clip space.
Depth buffer precision is affected by the values specified for zNear and zFar. The greater the ratio of zFar to zNear is, the less effective the depth buffer will be at distinguishing between surfaces that are near each other.
fovx | The field of vew angle in X direction. Must be greater than 0. |
aspect | Specifies the aspect ratio that determines the field of view in the X direction. Typically the aspect ratio is the ratio of viewport width to viewport height. Must be greater than 0. |
zNear | Near clipping plane distance to the viewer in eye space on Z direction. Must be greater than 0. |
zFar | Far clipping plane distance to the viewer in eye space on Z direction. Must be greater than zNear. |
Definition at line 278 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetFrustumByFovY | ( | float | fovy, |
float | aspect, | ||
float | zNear, | ||
float | zFar ) |
Sets the matrix to represent a viewing frustum in world coordinate system.
It can be used to produce perspective projection, typically from eye space to clip space.
Depth buffer precision is affected by the values specified for zNear and zFar. The greater the ratio of zFar to zNear is, the less effective the depth buffer will be at distinguishing between surfaces that are near each other.
fovy | The field of vew angle in Y direction. Must be greater than 0. |
aspect | Specifies the aspect ratio that determines the field of view in the X direction. Typically the aspect ratio is the ratio of viewport width to viewport height. Must be greater than 0. |
zNear | Near clipping plane distance to the viewer in eye space on Z direction. Must be greater than 0. |
zFar | Far clipping plane distance to the viewer in eye space on Z direction. Must be greater than zNear. |
Definition at line 309 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetLookAt | ( | const PureVector & | vPos, |
const PureVector & | vTarget, | ||
const PureVector & | vUp ) |
Sets the matrix to represent a view matrix in world coordinate system.
Transforms everything based on camera position and direction.
vPos | Eye position. |
vTarget | Where we are looking at. |
vUp | An Up vector representing positive direction on Y-angle, usually the camera's Up vector. |
Definition at line 337 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetMirrorXY | ( | ) |
Sets the matrix to a mirroring matrix on the XY planes.
Definition at line 192 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetMirrorXZ | ( | ) |
Sets the matrix to a mirroring matrix on the XZ planes.
Definition at line 202 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetMirrorYZ | ( | ) |
Sets the matrix to a mirroring matrix on the YZ planes.
Definition at line 212 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetRotationX | ( | TPureFloat | anglex | ) |
Sets the matrix to a rotation matrix around X-axis.
Definition at line 68 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetRotationY | ( | TPureFloat | angley | ) |
Sets the matrix to a rotation matrix around Y-axis.
Definition at line 83 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetRotationZ | ( | TPureFloat | anglez | ) |
Sets the matrix to a rotation matrix around Z-axis.
Definition at line 98 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetScale | ( | TPureFloat | x, |
TPureFloat | y, | ||
TPureFloat | z ) |
Sets the scalings on the 3 axes.
Definition at line 152 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetScaleX | ( | TPureFloat | x | ) |
Sets the matrix to a scaling matrix only on the X-axis.
Definition at line 165 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetScaleY | ( | TPureFloat | y | ) |
Sets the matrix to a scaling matrix only on the Y-axis.
Definition at line 174 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetScaleZ | ( | TPureFloat | z | ) |
Sets the matrix to a scaling matrix only on the Z-axis.
Definition at line 183 of file PureTransformMatrix.cpp.
void PureTransformMatrix::SetTranslation | ( | TPureFloat | x, |
TPureFloat | y, | ||
TPureFloat | z ) |
Sets the matrix to a translation matrix.
Definition at line 113 of file PureTransformMatrix.cpp.
|
staticprivate |
Static zero matrix.
Definition at line 74 of file PureTransformMatrix.h.
|
staticprivate |
Static identity matrix.
Definition at line 75 of file PureTransformMatrix.h.