Matrix elements in the form of a flat array.
Static
Readonly
IDENTITYA constant matrix set to the identity.
Static
Readonly
ZEROA constant matrix with all elements set to 0.
Reports whether two matrices are equal.
The other matrix.
True if the matrices are equal and false otherwise.
Extracts the Euler angles equivalent to the rotational portion of the specified matrix. The returned Euler angles are in XYZ order an in degrees.
Optional
eulers: Vec3 = ...A 3-d vector to receive the Euler angles.
A 3-d vector containing the Euler angles.
Multiplies the specified 4x4 matrices together and stores the result in the current instance. This function assumes the matrices are affine transformation matrices, where the upper left 3x3 elements are a rotation matrix, and the bottom left 3 elements are translation. The rightmost column is assumed to be [0, 0, 0, 1]. The parameters are not verified to be in the expected format. This function is faster than general Mat4#mul2.
Self for chaining.
Sets the specified matrix to a rotation matrix equivalent to a rotation around an axis. The axis must be normalized (unit length) and the angle must be specified in degrees.
The normalized axis vector around which to rotate.
The angle of rotation in degrees.
Self for chaining.
Sets the specified matrix to a rotation matrix defined by Euler angles. The Euler angles are specified in XYZ order and in degrees.
Angle to rotate around X axis in degrees.
Angle to rotate around Y axis in degrees.
Angle to rotate around Z axis in degrees.
Self for chaining.
Sets the specified matrix to a viewing matrix derived from an eye point, a target point and an up vector. The matrix maps the target point to the negative z-axis and the eye point to the origin, so that when you use a typical projection matrix, the center of the scene maps to the center of the viewport. Similarly, the direction described by the up vector projected onto the viewing plane is mapped to the positive y-axis so that it points upward in the viewport. The up vector must not be parallel to the line of sight from the eye to the reference point.
Self for chaining.
Sets the specified matrix to an orthographic projection matrix. The function's parameters define the shape of a cuboid-shaped frustum.
The x-coordinate for the left edge of the camera's projection plane in eye space.
The x-coordinate for the right edge of the camera's projection plane in eye space.
The y-coordinate for the bottom edge of the camera's projection plane in eye space.
The y-coordinate for the top edge of the camera's projection plane in eye space.
The near clip plane in eye coordinates.
The far clip plane in eye coordinates.
Self for chaining.
Sets the specified matrix to a perspective projection matrix. The function's parameters define the shape of a frustum.
The frustum's field of view in degrees. The fovIsHorizontal parameter controls whether this is a vertical or horizontal field of view. By default, it's a vertical field of view.
The aspect ratio of the frustum's projection plane (width / height).
The near clip plane in eye coordinates.
The far clip plane in eye coordinates.
Optional
fovIsHorizontal: booleanSet to true to treat the fov as horizontal (x-axis) and false for vertical (y-axis). Defaults to false.
Self for chaining.
A 4x4 matrix.