struct

Mat4

Module
Math
Header
#include "Math/Mat4.h"
Namespace
Mowo

Properties

TypeNameDescription
float[4][4]m

Constructors

SignatureNameDescription
Mat4()Mat4
Mat4(float diagonal)Mat4

Public functions

ReturnsNameDescription
float*operator[]
const float*operator[]
Mat4operator*
Vec4operator*
Mat4Transposed
Mat4Transpose
Mat4InverseReturns identity if the matrix is singular.
Mat4Identity
Mat4Translation
Mat4Translation
Mat4Scale
Mat4Scale
Mat4Scale
Mat4RotationX
Mat4RotationY
Mat4RotationZ
Mat4LookAt
Mat4Perspective
Mat4Orthographic
Mat4TRSCreate TRS matrix (Translation * Rotation * Scale)
Mat4RotationFromQuaternion
const float*Data
float*Data
voidDecomposeMatrixDecompose a TRS matrix into position, rotation (euler radians), and scale.

Function details

Mat4

C++
Mat4()

Mat4

C++
Mat4(float diagonal)

operator[]

C++
float* operator[](int row)

operator[]

C++
const float* operator[](int row) const

operator*

C++
Mat4 operator*(const Mat4& other) const

operator*

C++
Vec4 operator*(const Vec4& v) const

Transposed

C++
Mat4 Transposed() const

Transpose

C++
Mat4 Transpose() const

Inverse

C++
Mat4 Inverse() const

Returns identity if the matrix is singular.

Identity

C++
static Mat4 Identity()

Translation

C++
static Mat4 Translation(const Vec3& v)

Translation

C++
static Mat4 Translation(float x, float y, float z)

Scale

C++
static Mat4 Scale(const Vec3& v)

Scale

C++
static Mat4 Scale(float x, float y, float z)

Scale

C++
static Mat4 Scale(float uniform)

RotationX

C++
static Mat4 RotationX(float angleRad)

RotationY

C++
static Mat4 RotationY(float angleRad)

RotationZ

C++
static Mat4 RotationZ(float angleRad)

LookAt

C++
static Mat4 LookAt(const Vec3& eye, const Vec3& target, const Vec3& up)

Perspective

C++
static Mat4 Perspective(float fovY, float aspect, float nearZ, float farZ)

Orthographic

C++
static Mat4 Orthographic(float left, float right, float bottom, float top, float nearZ, float farZ)

TRS

C++
static Mat4 TRS(const Vec3& translation, const Quat& rotation, const Vec3& scale)

Create TRS matrix (Translation * Rotation * Scale)

RotationFromQuaternion

C++
static Mat4 RotationFromQuaternion(const Quat& q)

Data

C++
const float* Data() const

Data

C++
float* Data()

DecomposeMatrix

C++
static void DecomposeMatrix(const Mat4& mat, Vec3& outPos, Vec3& outRot, Vec3& outScale)

Decompose a TRS matrix into position, rotation (euler radians), and scale. Row-major layout: translation at m[0][3], m[1][3], m[2][3]. The euler comes out in the engine's Rx * Ry * Rz order so it feeds straight back through Quat::FromEuler / TransformComponent::GetLocalMatrix without changing the rotation.

Generated from Math/Mat4.h via math.json · Nov 4, 2026Version 1.0.0