Ocular Engine
|
A 4x4 column-major float matrix. More...
#include <Matrix4x4.hpp>
Public Member Functions | |
Matrix4x4 (float x0, float y0, float z0, float w0, float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float x3, float y3, float z3, float w3) | |
Matrix4x4 (Matrix3x3 const &matrix) | |
Matrix4x4 (float const *values) | |
Matrix4x4 (Vector4< float > const &col0, Vector4< float > const &col1, Vector4< float > const &col2, Vector4< float > const &col3) | |
Matrix4x4 (Vector3< float > const &position, Quaternion const &rotation) | |
Matrix4x4 (Vector3< float > const &position, Vector3< float > const &eulerRotation) | |
Matrix4x4 (Vector3< float > const &position, Quaternion const &rotation, Vector3< float > const &scale) | |
Matrix4x4 (Matrix4x4_Internal const &data) | |
Matrix4x4 (Matrix4x4 const &other) | |
Matrix4x4 () | |
float | operator[] (uint32_t index) |
Matrix4x4 & | operator= (Matrix4x4 const &rhs) |
Matrix4x4 & | operator+= (Matrix4x4 const &rhs) |
Matrix4x4 & | operator-= (Matrix4x4 const &rhs) |
Matrix4x4 & | operator*= (Matrix4x4 const &rhs) |
Matrix4x4 & | operator*= (Vector4< float > const &rhs) |
Matrix4x4 & | operator*= (float rhs) |
void | setElement (uint32_t index, float value) |
float | getElement (uint32_t index) const |
void | setRow (uint32_t index, Vector4< float > const &row) |
void | setRow (uint32_t index, Vector3< float > const &row) |
void | getRow (uint32_t index, Vector4< float > &row) const |
Vector4< float > | getRow (uint32_t index) const |
void | setCol (uint32_t index, Vector4< float > const &col) |
void | setCol (uint32_t index, Vector3< float > const &col) |
void | getCol (uint32_t index, Vector4< float > &col) const |
Vector4< float > | getCol (uint32_t index) const |
void | setData (float const *data) |
void | getData (float *data) const |
void | invert () |
Matrix4x4 | getInverse () const |
float | getDeterminant () const |
Matrix4x4 | getTranspose () const |
bool | isIdentity () const |
Matrix4x4_Internal * | getInternal () const |
Static Public Member Functions | |
static Matrix4x4 | CreateTranslationMatrix (Vector3< float > const &translate, Matrix4x4 const &matrix=Matrix4x4()) |
static Matrix4x4 | CreateScaleMatrix (Vector3< float > const &scale, Matrix4x4 const &matrix=Matrix4x4()) |
static Matrix4x4 | CreateLookAtMatrix (Vector3< float > const &from, Vector3< float > const &to, Vector3< float > const &up) |
static Matrix4x4 | CreateOrthographicMatrix (float xMin, float xMax, float yMin, float yMax, float nearClip, float farClip) |
static Matrix4x4 | CreatePerspectiveMatrix (float fov, float aspectRatio, float nearClip, float farClip) |
A 4x4 column-major float matrix.
x.x y.x z.x t.x x.y y.y z.y t.y x.z y.z z.z t.z 0.0 0.0 0.0 1.0
00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33
00 04 08 12 01 05 09 13 02 06 10 14 03 07 11 15
Ocular::Math::Matrix4x4::Matrix4x4 | ( | float | x0, |
float | y0, | ||
float | z0, | ||
float | w0, | ||
float | x1, | ||
float | y1, | ||
float | z1, | ||
float | w1, | ||
float | x2, | ||
float | y2, | ||
float | z2, | ||
float | w2, | ||
float | x3, | ||
float | y3, | ||
float | z3, | ||
float | w3 | ||
) |
Creates a new 4x4 column-major matrix.
[in] | x0 | First element of the x-rotation column |
[in] | y0 | First element of the y-rotation column |
[in] | z0 | First element of the z-rotation column |
[in] | w0 | First element of the position column |
[in] | x1 | Second element of the x-rotation column |
[in] | y1 | Second element of the y-rotation column |
[in] | z1 | Second element of the z-rotation column |
[in] | w1 | Second element of the position column |
[in] | x2 | Third element of the x-rotation column |
[in] | y2 | Third element of the y-rotation column |
[in] | z2 | Third element of the z-rotation column |
[in] | w2 | Third element of the position column |
[in] | x3 | Fourth element of the x-rotation column |
[in] | y3 | Fourth element of the y-rotation column |
[in] | z3 | Fourth element of the z-rotation column |
[in] | w3 | Fourth element of the position column |
Ocular::Math::Matrix4x4::Matrix4x4 | ( | Matrix3x3 const & | matrix | ) |
Creates a new 4x4 column-major matrix from an existing 3x3 column-major matrix.
[in] | matrix |
Ocular::Math::Matrix4x4::Matrix4x4 | ( | float const * | values | ) |
Creates a new 4x4 column-major matrix.
[in] | values | 16-element float array of values in column-major order ({x0, x1, x2, x3, ..., w0, w1, w2, w3}) |
Ocular::Math::Matrix4x4::Matrix4x4 | ( | Vector3< float > const & | position, |
Quaternion const & | rotation | ||
) |
Constructs a 4x4 matrix using a position and rotation.
[in] | position | |
[in] | rotation |
Ocular::Math::Matrix4x4::Matrix4x4 | ( | Vector3< float > const & | position, |
Vector3< float > const & | eulerRotation | ||
) |
Constructs a 4x4 matrix using a set of euler angles and position.
[in] | position | |
[in] | eulerRotation | (pitch, yaw, roll) |
Ocular::Math::Matrix4x4::Matrix4x4 | ( | ) |
Creates a new identity Matrix
|
static |
[in] | from | Origin (eye) point |
[in] | to | Point in space to look at |
[in] | up | The up vector |
|
static |
[in] | xMin | |
[in] | xMax | |
[in] | yMin | |
[in] | yMax | |
[in] | nearClip | Distance to the near clipping plane |
[in] | farClip | Distance to the far clipping plane |
|
static |
[in] | fov | Field-of-view in degrees |
[in] | aspectRatio | Relation between the view width and height (width / height) |
[in] | nearClip | Distance to the near clipping plane |
[in] | farClip | Distance to the far clipping plane |
|
static |
[in] | scale | The scaling to apply |
[in] | matrix | Optional matrix to apply the scaling to |
|
static |
[in] | translate | The translate vector to apply |
[in] | matrix | Optional matrix to apply the translation to |
void Ocular::Math::Matrix4x4::getCol | ( | uint32_t | index, |
Vector4< float > & | col | ||
) | const |
Retrieves the value of a single column of the matrix.
[in] | index | Column index [0, 4) |
[out] | col | Vector to store the column values |
void Ocular::Math::Matrix4x4::getData | ( | float * | data | ) | const |
Retrieves the matrix data values as an array of floats.
[out] | data | An array of at least 16 floating point values (if more, only the first 16 are filled). |
float Ocular::Math::Matrix4x4::getElement | ( | uint32_t | index | ) | const |
Returns an individual element of the matrix. Matrix elements are ordered as follows:
{rotX.x, rotX.y, rotX.z, rotX.w, rotY.x, rotY.y, rotY.z, rotY.w, rotZ.x, rotZ.y, rotZ.z, rotZ.w, pos.x, pos.y, pos.z, pos.w}
or
00 04 08 12 01 05 09 13 02 06 10 14 03 07 11 15
[in] | index | Element index to retrieve [0, 16) |
Matrix4x4_Internal * Ocular::Math::Matrix4x4::getInternal | ( | ) | const |
For internal use only. Only modify this pointer if you want your application to crash.
void Ocular::Math::Matrix4x4::getRow | ( | uint32_t | index, |
Vector4< float > & | row | ||
) | const |
Retrieves the value of a single row of the matrix.
[in] | index | Row index [0, 4) |
[out] | row | Vector to store the row values |
bool Ocular::Math::Matrix4x4::isIdentity | ( | ) | const |
void Ocular::Math::Matrix4x4::setCol | ( | uint32_t | index, |
Vector4< float > const & | col | ||
) |
Sets the value of a single column of the matrix.
[in] | index | Column index [0,4) |
[in] | col | Vector of column values |
void Ocular::Math::Matrix4x4::setData | ( | float const * | data | ) |
Sets the matrix data values from an array of floats.
[in] | data | An array of at least 16 floating point values (if more, only the first 16 are used). |
void Ocular::Math::Matrix4x4::setElement | ( | uint32_t | index, |
float | value | ||
) |
Sets an individual element of the matrix. Matrix elements are ordered as follows:
{rotX.x, rotX.y, rotX.z, rotX.w, rotY.x, rotY.y, rotY.z, rotY.w, rotZ.x, rotZ.y, rotZ.z, rotZ.w, pos.x, pos.y, pos.z, pos.w}
or
00 04 08 12 01 05 09 13 02 06 10 14 03 07 11 15
[in] | index | Element index to set [0, 16) |
[in] | value | Value to set the element to |
void Ocular::Math::Matrix4x4::setRow | ( | uint32_t | index, |
Vector4< float > const & | row | ||
) |
Sets the value of a single row of the matrix.
[in] | index | Row index [0,4) |
[in] | row | Vector of row values |