4x4 Matrix structure for 3D transformations and projections. More...
#include <Mat4.h>
Public Member Functions | |
Mat4 () | |
Constructs an identity matrix. | |
Mat4 | operator* (const Mat4 &other) const |
Multiplies this matrix by another matrix. | |
Vec3 | MultiplyVec3 (const Vec3 &v) const |
Transforms a Vec3 by this matrix (assumes w=1). | |
Vec4 | MultiplyVec4 (const Vec4 &v) const |
Transforms a Vec4 by this matrix. | |
Mat4 | Inverse () const |
Returns the inverse of this matrix. | |
Static Public Member Functions | |
static Mat4 | Identity () |
Returns an identity matrix. | |
static Mat4 | Translate (const Vec3 &translation) |
Creates a translation matrix. | |
static Mat4 | Scale (const Vec3 &scale) |
Creates a scaling matrix. | |
static Mat4 | RotateX (float angleRad) |
Creates a rotation matrix around the X axis. | |
static Mat4 | RotateY (float angleRad) |
Creates a rotation matrix around the Y axis. | |
static Mat4 | RotateZ (float angleRad) |
Creates a rotation matrix around the Z axis. | |
static Mat4 | LookAt (const Vec3 &eye, const Vec3 ¢er, const Vec3 &up) |
Creates a view matrix using the LookAt method. | |
static Mat4 | Perspective (float fovRadians, float aspect, float near, float far) |
Creates a perspective projection matrix. | |
static Mat4 | Orthographic (float left, float right, float bottom, float top, float near, float far) |
Creates an orthographic projection matrix. | |
Public Attributes | |
float | data [16] |
Matrix data in column-major order. | |
4x4 Matrix structure for 3D transformations and projections.
Provides basic matrix operations and utilities for 3D graphics, including identity, multiplication, translation, scaling, rotation (Z axis), view (LookAt), and perspective projection matrices.
Data is stored in a 16-element float array in column-major order.
Mat4::Mat4 | ( | ) |
Constructs an identity matrix.
Mat4 Mat4::Inverse | ( | ) | const |
Returns the inverse of this matrix.
Creates a view matrix using the LookAt method.
eye | Camera position. |
center | Target position. |
up | Up direction vector. |
Multiplies this matrix by another matrix.
other | The matrix to multiply with. |
|
static |
Creates an orthographic projection matrix.
left | Left clipping plane. |
right | Right clipping plane. |
bottom | Bottom clipping plane. |
top | Top clipping plane. |
near | Near clipping plane. |
far | Far clipping plane. |
|
static |
Creates a perspective projection matrix.
fovRadians | Field of view in radians. |
aspect | Aspect ratio (width/height). |
near | Near clipping plane. |
far | Far clipping plane. |
|
static |
Creates a rotation matrix around the X axis.
angleRad | Rotation angle in radians. |
|
static |
Creates a rotation matrix around the Y axis.
angleRad | Rotation angle in radians. |
|
static |
Creates a rotation matrix around the Z axis.
angleRad | Rotation angle in radians. |
Creates a scaling matrix.
scale | The scaling vector. |
Creates a translation matrix.
translation | The translation vector. |
float Mat4::data[16] |
Matrix data in column-major order.