Clutter Engine 0.0.1
|
A 4x4 matrix used for 3D transformations. More...
#include <Matrix4.h>
Public Member Functions | |
Matrix4 () | |
Default constructor that initializes to identity matrix. | |
Matrix4 (const array< float, 16 > &that) | |
Constructs a matrix from an array of 16 floats. | |
const float * | GetAsFloatPtr () const |
Gets a pointer to the raw matrix data. | |
float & | operator() (const int i, const int j) |
Accesses matrix elements by row and column indices. | |
Matrix4 & | operator= (const Matrix4 &that) |
Assignment operator. | |
Matrix4 | operator+ (const Matrix4 &that) const |
Addition operator. | |
Matrix4 & | operator+= (const Matrix4 &that) |
Compound addition operator. | |
Matrix4 | operator- (const Matrix4 &that) const |
Subtraction operator. | |
Matrix4 & | operator-= (const Matrix4 &that) |
Compound subtraction operator. | |
Matrix4 & | operator*= (Matrix4 &right) |
Compound multiplication operator. | |
void | Invert () |
Inverts the matrix. | |
Vector3 | GetTranslation () const |
Gets the translation component of the matrix. | |
Vector3 | GetXAxis () const |
Gets the normalized X axis of the matrix. | |
Vector3 | GetYAxis () const |
Gets the normalized Y axis of the matrix. | |
Vector3 | GetZAxis () const |
Gets the normalized Z axis of the matrix. | |
Vector3 | GetScale () const |
Gets the scale components of the matrix. | |
Static Public Member Functions | |
static Matrix4 | CreateScale (float xScale, float yScale, float zScale) |
Creates a scaling matrix with separate scale factors for each axis. | |
static Matrix4 | CreateScale (const Vector3 &scaleVector) |
Creates a scaling matrix from a Vector3. | |
static Matrix4 | CreateScale (float scale) |
Creates a uniform scaling matrix. | |
static Matrix4 | CreateRotationX (float theta) |
Creates a rotation matrix around the X axis. | |
static Matrix4 | CreateRotationY (float theta) |
Creates a rotation matrix around the Y axis. | |
static Matrix4 | CreateRotationZ (float theta) |
Creates a rotation matrix around the Z axis. | |
static Matrix4 | CreateTranslation (const Vector3 &trans) |
Creates a translation matrix. | |
static Matrix4 | CreateSimpleViewProj (float width, float height) |
Creates a simple 2D view-projection matrix. | |
static Matrix4 | CreateFromQuaternion (const Quaternion &q) |
Creates a rotation matrix from a quaternion. | |
static Matrix4 | CreateLookAt (const Vector3 &eye, const Vector3 &target, const Vector3 &up) |
Creates a view matrix for a camera. | |
static Matrix4 | CreateOrtho (float width, float height, float pNear, float pFar) |
Creates an orthographic projection matrix. | |
static Matrix4 | CreatePerspectiveFOV (float fovY, float width, float height, float pNear, float pFar) |
Creates a perspective projection matrix based on field of view. | |
static Matrix4 | CreatePerspective (float left, float right, float bottom, float top, float pNear, float pFar) |
Creates a perspective projection matrix based on explicit frustum dimensions. | |
Public Attributes | |
array< float, 16 > | mat |
The raw matrix data stored as a flat array of 16 floats in row-major order. | |
Static Public Attributes | |
static const Matrix4 | Identity |
Identity matrix constant. | |
Friends | |
Matrix4 | operator* (Matrix4 &a, Matrix4 &b) |
Matrix multiplication operator. | |
A 4x4 matrix used for 3D transformations.
The Matrix4 struct represents a 4x4 matrix primarily used for 3D transformations such as translation, rotation, scaling, and projection. The matrix is stored in row-major order.
|
inline |
Constructs a matrix from an array of 16 floats.
that | Array of 16 float values in row-major order. |
|
inlinestatic |
Creates a rotation matrix from a quaternion.
q | The quaternion representing the rotation. |
|
inlinestatic |
Creates a view matrix for a camera.
eye | Position of the camera. |
target | Point the camera is looking at. |
up | Up vector for the camera. |
|
inlinestatic |
Creates an orthographic projection matrix.
width | Width of the orthographic view volume. |
height | Height of the orthographic view volume. |
pNear | Distance to the near clipping plane. |
pFar | Distance to the far clipping plane. |
|
inlinestatic |
Creates a perspective projection matrix based on explicit frustum dimensions.
left | Left coordinate of the near clipping plane. |
right | Right coordinate of the near clipping plane. |
bottom | Bottom coordinate of the near clipping plane. |
top | Top coordinate of the near clipping plane. |
pNear | Distance to the near clipping plane. |
pFar | Distance to the far clipping plane. |
|
inlinestatic |
Creates a perspective projection matrix based on field of view.
fovY | Vertical field of view angle in radians. |
width | Width of the viewport. |
height | Height of the viewport. |
pNear | Distance to the near clipping plane. |
pFar | Distance to the far clipping plane. |
|
inlinestatic |
Creates a rotation matrix around the X axis.
theta | Rotation angle in radians. |
|
inlinestatic |
Creates a rotation matrix around the Y axis.
theta | Rotation angle in radians. |
|
inlinestatic |
Creates a rotation matrix around the Z axis.
theta | Rotation angle in radians. |
Creates a scaling matrix from a Vector3.
scaleVector | Vector containing scale factors for each axis. |
|
inlinestatic |
Creates a uniform scaling matrix.
scale | Uniform scale factor for all axes. |
|
inlinestatic |
Creates a scaling matrix with separate scale factors for each axis.
xScale | Scale factor for the X axis. |
yScale | Scale factor for the Y axis. |
zScale | Scale factor for the Z axis. |
|
inlinestatic |
Creates a simple 2D view-projection matrix.
width | Width of the viewport. |
height | Height of the viewport. |
Creates a translation matrix.
trans | Vector containing the translation amounts along each axis. |
|
inline |
Gets a pointer to the raw matrix data.
|
inline |
Gets the scale components of the matrix.
|
inline |
Gets the translation component of the matrix.
|
inline |
Gets the normalized X axis of the matrix.
|
inline |
Gets the normalized Y axis of the matrix.
|
inline |
Gets the normalized Z axis of the matrix.
void Matrix4::Invert | ( | ) |
Inverts the matrix.
|
inline |
Accesses matrix elements by row and column indices.
i | Row index (0-3). |
j | Column index (0-3). |
Compound multiplication operator.
right | The matrix to multiply this one by. |
Addition operator.
that | The matrix to add to this one. |
Compound addition operator.
that | The matrix to add to this one. |
Subtraction operator.
that | The matrix to subtract from this one. |
Compound subtraction operator.
that | The matrix to subtract from this one. |
Assignment operator.
that | The matrix to copy from. |
Matrix multiplication operator.
a | The left-hand side matrix. |
b | The right-hand side matrix. |