Fields
m11
Element at row R, column C (1-indexed). For example m.m12 is the
entry in row 1, column 2.
m12
m13
m14
m21
m22
m23
m24
m31
m32
m33
m34
m41
m42
m43
m44
Constructors
identity
values
fromTranslation
fromScale
y and z are omitted, uniform scaling
by x is applied to all axes.
fromRotationX
fromRotationY
fromRotationZ
perspective
fovY is in radians; near and far
are positive distances.
perspectiveReverseZ
lookAt
eye toward
center (GLM convention). up need not be normalized.
ortho
Mat4.perspective), e.g. for
shadow-map cascades or 2D overlays.
multiply
a * b into output, reusing its storage. Returns output.
Use this in tight loops to avoid allocating a new Mat4 per
multiplication. output may alias a or b.
multiplyAffine
Mat4.multiply, but assumes both inputs are affine (bottom row
[0, 0, 0, 1] — any composition of translation/scale/rotation matrices
qualifies). Skips the bottom-row work for ~25% fewer FLOPs per
multiplication. The result is always affine. Caller must ensure both
inputs are affine; passing a non-affine input gives an incorrect
result.
Static Functions
invert
input into output, returning true on
success or false if input is singular.
invertAffine
input into output. See
Mat4:invertAffine for the contract; faster than Mat4.invert.
Methods
invert
nil if the matrix is singular.
transpose
transformPoint
transformVec4
w (e.g. clip-space coordinates).
writeToBuffer
byteOffset. The buffer must have at least 64
bytes available from the offset.
__eq
__mul
proj * view * model. Allocates a new Mat4; in
tight loops prefer Mat4.multiply(out, a, b) to reuse storage.
invertAffine
fromTranslation/fromScale/fromRotationX/Y/Z
qualifies). Returns nil if the linear part is singular. Faster than
:invert() and avoids the full 4x4 cofactor work.