StevEngine
StevEngine is a customizable C++ game engine.
|
4x4 matrix for 3D transformations More...
#include <utilities/Matrix4.hpp>
Public Member Functions | |
Matrix4 (double data[4][4]) | |
Create matrix from raw 4x4 array. | |
Matrix4 (const Vector4 &row1, const Vector4 &row2, const Vector4 &row3, const Vector4 &row4) | |
Create matrix from row vectors. | |
Matrix4 (const Matrix4 &matrix) | |
Copy constructor. | |
Matrix4 (double v) | |
Create matrix filled with value. | |
Matrix4 () | |
Create identity matrix. | |
Vector4 | GetRow (int i) const |
Get row vector. | |
Vector4 | GetColumn (int i) const |
Get column vector. | |
double | GetDeterminant () const |
Calculate matrix determinant. | |
Matrix4 & | Inverse () |
Invert this matrix. | |
Matrix4 & | Transpose () |
Transpose this matrix. | |
Matrix4 & | operator= (const Matrix4 &other) |
Assignment. | |
Matrix4 | operator* (const Matrix4 &matrix) const |
Matrix multiplication. | |
Vector3 | operator* (const Vector3 &point) const |
Point transformation. | |
Matrix4 | operator* (const double &value) const |
Scalar multiplication. | |
Matrix4 | operator/ (const double &value) const |
Scalar division. | |
bool | operator== (const Matrix4 &other) const |
Equality comparison. | |
operator std::string () const | |
Convert to string. | |
const float * | data () const |
Get raw float array. | |
Static Public Member Functions | |
static Matrix4 | Inverse (const Matrix4 &matrix) |
Create inverse of matrix. | |
static Matrix4 | Transpose (const Matrix4 &matrix) |
Create transpose of matrix. | |
static Matrix4 | FromTranslation (const Vector3 &position) |
Create translation matrix. | |
static Matrix4 | FromRotation (const Quaternion &rotation) |
Create rotation matrix. | |
static Matrix4 | FromScale (const Vector3 &scale) |
Create scale matrix. | |
static Matrix4 | FromTranslationRotationScale (const Vector3 &position, const Quaternion &rotation, const Vector3 &scale) |
Create combined TRS matrix. | |
static Matrix4 | FromOrthographic (float width, float height, float clipNear, float clipFar) |
Create orthographic projection. | |
static Matrix4 | FromOrthographic (float left, float right, float bottom, float top, float clipNear, float clipFar) |
Create orthographic projection with bounds. | |
static Matrix4 | FromPerspective (float fovx, float aspect, float clipNear, float clipFar) |
Create perspective projection. | |
Static Public Attributes | |
static const Matrix4 | identity |
Identity matrix. | |
static const Matrix4 | zero = Matrix4(0.0) |
Zero matrix. | |
4x4 matrix for 3D transformations
Implements common matrix operations for 3D transformations including translation, rotation, scaling, and projection matrices.
StevEngine::Utilities::Matrix4::Matrix4 | ( | double | data[4][4] | ) |
Create matrix from raw 4x4 array.
data | 4x4 array of values |
StevEngine::Utilities::Matrix4::Matrix4 | ( | const Vector4 & | row1, |
const Vector4 & | row2, | ||
const Vector4 & | row3, | ||
const Vector4 & | row4 ) |
Create matrix from row vectors.
row1 | First row vector |
row2 | Second row vector |
row3 | Third row vector |
row4 | Fourth row vector |
StevEngine::Utilities::Matrix4::Matrix4 | ( | const Matrix4 & | matrix | ) |
Copy constructor.
matrix | Matrix to copy |
StevEngine::Utilities::Matrix4::Matrix4 | ( | double | v | ) |
Create matrix filled with value.
v | Value to fill with |
|
static |
Create orthographic projection with bounds.
left | Left bound |
right | Right bound |
bottom | Bottom bound |
top | Top bound |
clipNear | Near clip plane |
clipFar | Far clip plane |
|
static |
Create orthographic projection.
width | View width |
height | View height |
clipNear | Near clip plane |
clipFar | Far clip plane |
|
static |
Create perspective projection.
fovx | Horizontal field of view in degrees |
aspect | Aspect ratio (width/height) |
clipNear | Near clip plane |
clipFar | Far clip plane |
|
static |
Create rotation matrix.
rotation | Rotation quaternion |
Create scale matrix.
scale | Scale vector |
Create translation matrix.
position | Translation vector |
|
static |
Create combined TRS matrix.
position | Translation |
rotation | Rotation |
scale | Scale |
Vector4 StevEngine::Utilities::Matrix4::GetColumn | ( | int | i | ) | const |
double StevEngine::Utilities::Matrix4::GetDeterminant | ( | ) | const |
Calculate matrix determinant.
Vector4 StevEngine::Utilities::Matrix4::GetRow | ( | int | i | ) | const |
Matrix4 & StevEngine::Utilities::Matrix4::Inverse | ( | ) |
Invert this matrix.
Create inverse of matrix.
matrix | Matrix to invert |
Matrix4 & StevEngine::Utilities::Matrix4::Transpose | ( | ) |
Transpose this matrix.
Create transpose of matrix.
matrix | Matrix to transpose |
|
static |