Expand description

Transformation matrix functions.

Functions

Inverts a Mat4 that represents a valid transformation in TRS order (= translation * rotation * scale). This function is more efficient than Mat4::invert by leveraging the properties of a TRS matrix.

Calculate the 4x4 view matrix for a camera at eye position looking at the center position with a given up direction.

Creates the {@link Mat4} orthographic projection matrix. To apply a glTF orthographic camera, use: left = -xmag, right = xmag, bottom = -ymag, top = ymag. See: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#projection-matrices

Creates the 4x4 perspective projection using glTF’s formula. Use infinite projection if zfar = Infinity. See: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#projection-matrices

Creates a 4x4 transformation matrix that represents a rotation by a quaternion.

Extracts the rotation quaternion component from a 4x4 TRS transformation matrix.

Creates a 4x4 transformation matrix that represents a scaling of (x, y, z).

Extracts the (x, y, z) scaling component from a 4x4 TRS transformation matrix.

Calculates the Mat4 model matrix for a camera at eye position looking at the center position with a given up direction.

Creates a 4x4 matrix that represents a transformation in TRS order (= translation * rotation * scaling).

Creates a 4x4 transformation matrix that represents a translation of (x, y, z).

Extracts the (x, y, z) translation component from a 4x4 TRS transformation matrix.