⚠️ This documentation corresponds to the latest development branch of axmol. It might diverge from the official releases.
Axmol Engine 2.4.0-ce063c5
|
Defines a 4 x 4 floating point matrix representing a 3D transformation. More...
#include <Mat4.h>
Public Member Functions | |
constexpr | Mat4 () |
Default constructor. | |
constexpr | Mat4 (float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44) |
Constructs a matrix initialized to the specified value. | |
Mat4 (const float *mat) | |
Creates a matrix initialized to the specified column-major array. | |
Mat4 (const Mat4 ©) | |
Constructs a new matrix by copying the values from the specified matrix. | |
void | add (float scalar) |
Adds a scalar value to each component of this matrix. | |
void | add (float scalar, Mat4 *dst) |
Adds a scalar value to each component of this matrix and stores the result in dst. | |
void | add (const Mat4 &mat) |
Adds the specified matrix to this matrix. | |
bool | decompose (Vec3 *scale, Quaternion *rotation, Vec3 *translation) const |
Decomposes the scale, rotation and translation components of this matrix. | |
float | determinant () const |
Computes the determinant of this matrix. | |
void | getScale (Vec3 *scale) const |
Gets the scalar component of this matrix in the specified vector. | |
bool | getRotation (Quaternion *rotation) const |
Gets the rotational component of this matrix in the specified quaternion. | |
void | getTranslation (Vec3 *translation) const |
Gets the translational component of this matrix in the specified vector. | |
void | getUpVector (Vec3 *dst) const |
Gets the up vector of this matrix. | |
void | getDownVector (Vec3 *dst) const |
Gets the down vector of this matrix. | |
void | getLeftVector (Vec3 *dst) const |
Gets the left vector of this matrix. | |
void | getRightVector (Vec3 *dst) const |
Gets the right vector of this matrix. | |
void | getForwardVector (Vec3 *dst) const |
Gets the forward vector of this matrix. | |
void | getBackVector (Vec3 *dst) const |
Gets the backward vector of this matrix. | |
bool | inverse () |
Inverts this matrix. | |
Mat4 | getInversed () const |
Get the inversed matrix. | |
bool | isIdentity () const |
Determines if this matrix is equal to the identity matrix. | |
void | multiply (float scalar) |
Multiplies the components of this matrix by the specified scalar. | |
void | multiply (float scalar, Mat4 *dst) const |
Multiplies the components of this matrix by a scalar and stores the result in dst. | |
void | multiply (const Mat4 &mat) |
Multiplies this matrix by the specified one. | |
void | negate () |
Negates this matrix. | |
Mat4 | getNegated () const |
Get the Negated matrix. | |
void | rotate (const Quaternion &q) |
Post-multiplies this matrix by the matrix corresponding to the specified quaternion rotation. | |
void | rotate (const Quaternion &q, Mat4 *dst) const |
Post-multiplies this matrix by the matrix corresponding to the specified quaternion rotation and stores the result in dst. | |
void | rotate (const Vec3 &axis, float angle) |
Post-multiplies this matrix by the matrix corresponding to the specified rotation about the specified axis. | |
void | rotate (const Vec3 &axis, float angle, Mat4 *dst) const |
Post-multiplies this matrix by the matrix corresponding to the specified rotation about the specified axis and stores the result in dst. | |
void | rotateX (float angle) |
Post-multiplies this matrix by the matrix corresponding to the specified rotation around the x-axis. | |
void | rotateX (float angle, Mat4 *dst) const |
Post-multiplies this matrix by the matrix corresponding to the specified rotation around the x-axis and stores the result in dst. | |
void | rotateY (float angle) |
Post-multiplies this matrix by the matrix corresponding to the specified rotation around the y-axis. | |
void | rotateY (float angle, Mat4 *dst) const |
Post-multiplies this matrix by the matrix corresponding to the specified rotation around the y-axis and stores the result in dst. | |
void | rotateZ (float angle) |
Post-multiplies this matrix by the matrix corresponding to the specified rotation around the z-axis. | |
void | rotateZ (float angle, Mat4 *dst) const |
Post-multiplies this matrix by the matrix corresponding to the specified rotation around the z-axis and stores the result in dst. | |
void | scale (float value) |
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation. | |
void | scale (float value, Mat4 *dst) const |
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation and stores the result in dst. | |
void | scale (float xScale, float yScale, float zScale) |
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation. | |
void | scale (float xScale, float yScale, float zScale, Mat4 *dst) const |
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation and stores the result in dst. | |
void | scale (const Vec3 &s) |
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation. | |
void | scale (const Vec3 &s, Mat4 *dst) const |
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation and stores the result in dst. | |
constexpr void | set (float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44) |
Sets the values of this matrix. | |
void | set (const float *mat) |
Sets the values of this matrix to those in the specified column-major array. | |
void | set (const Mat4 &mat) |
Sets the values of this matrix to those of the specified matrix. | |
constexpr void | setIdentity () |
Sets this matrix to the identity matrix. | |
void | setZero () |
Sets all elements of the current matrix to zero. | |
void | subtract (const Mat4 &mat) |
Subtracts the specified matrix from the current matrix. | |
void | transformPoint (Vec3 *point) const |
Transforms the specified point by this matrix. | |
void | transformPoint (const Vec3 &point, Vec3 *dst) const |
Transforms the specified point by this matrix, and stores the result in dst. | |
void | transformVector (Vec3 *vector) const |
Transforms the specified vector by this matrix by treating the fourth (w) coordinate as zero. | |
void | transformVector (const Vec3 &vector, Vec3 *dst) const |
Transforms the specified vector by this matrix by treating the fourth (w) coordinate as zero, and stores the result in dst. | |
void | transformVector (float x, float y, float z, float w, Vec3 *dst) const |
Transforms the specified vector by this matrix. | |
void | transformVector (Vec4 *vector) const |
Transforms the specified vector by this matrix. | |
void | transformVector (const Vec4 &vector, Vec4 *dst) const |
Transforms the specified vector by this matrix. | |
void | translate (float x, float y, float z) |
Post-multiplies this matrix by the matrix corresponding to the specified translation. | |
void | translate (float x, float y, float z, Mat4 *dst) const |
Post-multiplies this matrix by the matrix corresponding to the specified translation and stores the result in dst. | |
void | translate (const Vec3 &t) |
Post-multiplies this matrix by the matrix corresponding to the specified translation. | |
void | translate (const Vec3 &t, Mat4 *dst) const |
Post-multiplies this matrix by the matrix corresponding to the specified translation and stores the result in dst. | |
void | transpose () |
Transposes this matrix. | |
Mat4 | getTransposed () const |
Get the Transposed matrix. | |
Mat4 | operator+ (const Mat4 &mat) const |
Calculates the sum of this matrix with the given matrix. | |
Mat4 & | operator+= (const Mat4 &mat) |
Adds the given matrix to this matrix. | |
Mat4 | operator- (const Mat4 &mat) const |
Calculates the difference of this matrix with the given matrix. | |
Mat4 & | operator-= (const Mat4 &mat) |
Subtracts the given matrix from this matrix. | |
Mat4 | operator- () const |
Calculates the negation of this matrix. | |
Mat4 | operator* (const Mat4 &mat) const |
Calculates the matrix product of this matrix with the given matrix. | |
Mat4 & | operator*= (const Mat4 &mat) |
Right-multiplies this matrix by the given matrix. | |
Static Public Member Functions | |
static void | createLookAt (const Vec3 &eyePosition, const Vec3 &targetPosition, const Vec3 &up, Mat4 *dst) |
Creates a view matrix based on the specified input parameters. | |
static void | createLookAt (float eyePositionX, float eyePositionY, float eyePositionZ, float targetCenterX, float targetCenterY, float targetCenterZ, float upX, float upY, float upZ, Mat4 *dst) |
Creates a view matrix based on the specified input parameters. | |
static void | createPerspective (float fieldOfView, float aspectRatio, float zNearPlane, float zFarPlane, Mat4 *dst) |
Builds a perspective projection matrix based on a field of view and returns by value. | |
static void | createOrthographic (float width, float height, float zNearPlane, float zFarPlane, Mat4 *dst) |
Creates an orthographic projection matrix. | |
static void | createOrthographicOffCenter (float left, float right, float bottom, float top, float zNearPlane, float zFarPlane, Mat4 *dst) |
Creates an orthographic projection matrix. | |
static void | createBillboard (const Vec3 &objectPosition, const Vec3 &cameraPosition, const Vec3 &cameraUpVector, Mat4 *dst) |
Creates a spherical billboard that rotates around a specified object position. | |
static void | createBillboard (const Vec3 &objectPosition, const Vec3 &cameraPosition, const Vec3 &cameraUpVector, const Vec3 &cameraForwardVector, Mat4 *dst) |
Creates a spherical billboard that rotates around a specified object position with provision for a safe default orientation. | |
static void | createScale (const Vec3 &scale, Mat4 *dst) |
Creates a scale matrix. | |
static void | createScale (float xScale, float yScale, float zScale, Mat4 *dst) |
Creates a scale matrix. | |
static void | createRotation (const Quaternion &quat, Mat4 *dst) |
Creates a rotation matrix from the specified quaternion. | |
static void | createRotation (const Vec3 &axis, float angle, Mat4 *dst) |
Creates a rotation matrix from the specified axis and angle. | |
static void | createRotationX (float angle, Mat4 *dst) |
Creates a matrix describing a rotation around the x-axis. | |
static void | createRotationY (float angle, Mat4 *dst) |
Creates a matrix describing a rotation around the y-axis. | |
static void | createRotationZ (float angle, Mat4 *dst) |
Creates a matrix describing a rotation around the z-axis. | |
static void | createTranslation (const Vec3 &translation, Mat4 *dst) |
Creates a translation matrix. | |
static void | createTranslation (float xTranslation, float yTranslation, float zTranslation, Mat4 *dst) |
Creates a translation matrix. | |
static void | add (const Mat4 &m1, const Mat4 &m2, Mat4 *dst) |
Adds the specified matrices and stores the result in dst. | |
static void | multiply (const Mat4 &mat, float scalar, Mat4 *dst) |
Multiplies the components of the specified matrix by a scalar and stores the result in dst. | |
static void | multiply (const Mat4 &m1, const Mat4 &m2, Mat4 *dst) |
Multiplies m1 by m2 and stores the result in dst. | |
static void | subtract (const Mat4 &m1, const Mat4 &m2, Mat4 *dst) |
Subtracts the specified matrix from the current matrix. | |
Public Attributes | |
float | m [16] |
Stores the columns of this 4x4 matrix. | |
Static Public Attributes | |
static const Mat4 | ZERO |
equals to a matrix full of zeros | |
static const Mat4 | IDENTITY |
equals to the identity matrix | |
Defines a 4 x 4 floating point matrix representing a 3D transformation.
Vectors are treated as columns, resulting in a matrix that is represented as follows, where x, y and z are the translation components of the matrix:
1 0 0 x 0 1 0 y 0 0 1 z 0 0 0 1
This matrix class is directly compatible with OpenGL since its elements are laid out in memory exactly as they are expected by OpenGL. The matrix uses column-major format such that array indices increase down column first. Since matrix multiplication is not commutative, multiplication must be done in the correct order when combining transformations. Suppose we have a translation matrix T and a rotation matrix R. To first rotate an object around the origin and then translate it, you would multiply the two matrices as TR.
Likewise, to first translate the object and then rotate it, you would do RT. So generally, matrices must be multiplied in the reverse order in which you want the transformations to take place (this also applies to the scale, rotate, and translate methods below; these methods are convenience methods for post-multiplying by a matrix representing a scale, rotation, or translation).
In the case of repeated local transformations (i.e. rotate around the Z-axis by 0.76 radians, then translate by 2.1 along the X-axis, then ...), it is better to use the Transform class (which is optimized for that kind of usage).
|
inlineconstexpr |
Default constructor.
Constructs a matrix initialized to the identity matrix:
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
|
inlineconstexpr |
Constructs a matrix initialized to the specified value.
m11 | The first element of the first row. |
m12 | The second element of the first row. |
m13 | The third element of the first row. |
m14 | The fourth element of the first row. |
m21 | The first element of the second row. |
m22 | The second element of the second row. |
m23 | The third element of the second row. |
m24 | The fourth element of the second row. |
m31 | The first element of the third row. |
m32 | The second element of the third row. |
m33 | The third element of the third row. |
m34 | The fourth element of the third row. |
m41 | The first element of the fourth row. |
m42 | The second element of the fourth row. |
m43 | The third element of the fourth row. |
m44 | The fourth element of the fourth row. |
|
inline |
Creates a matrix initialized to the specified column-major array.
The passed-in array is in column-major order, so the memory layout of the array is as follows:
0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
mat | An array containing 16 elements in column-major order. |
Constructs a new matrix by copying the values from the specified matrix.
copy | The matrix to copy. |
|
static |
Creates a view matrix based on the specified input parameters.
eyePosition | The eye position. |
targetPosition | The target's center position. |
up | The up vector. |
dst | A matrix to store the result in. |
|
static |
Creates a view matrix based on the specified input parameters.
eyePositionX | The eye x-coordinate position. |
eyePositionY | The eye y-coordinate position. |
eyePositionZ | The eye z-coordinate position. |
targetCenterX | The target's center x-coordinate position. |
targetCenterY | The target's center y-coordinate position. |
targetCenterZ | The target's center z-coordinate position. |
upX | The up vector x-coordinate value. |
upY | The up vector y-coordinate value. |
upZ | The up vector z-coordinate value. |
dst | A matrix to store the result in. |
|
static |
Builds a perspective projection matrix based on a field of view and returns by value.
Projection space refers to the space after applying projection transformation from view space. After the projection transformation, visible content has x- and y-coordinates ranging from -1 to 1, and a z-coordinate ranging from 0 to 1. To obtain the viewable area (in world space) of a scene, create a BoundingFrustum and pass the combined view and projection matrix to the constructor.
fieldOfView | The field of view in the y direction (in degrees). |
aspectRatio | The aspect ratio, defined as view space width divided by height. |
zNearPlane | The distance to the near view plane. |
zFarPlane | The distance to the far view plane. |
dst | A matrix to store the result in. |
|
static |
Creates an orthographic projection matrix.
width | The width of the view. |
height | The height of the view. |
zNearPlane | The minimum z-value of the view volume. |
zFarPlane | The maximum z-value of the view volume. |
dst | A matrix to store the result in. |
|
static |
Creates an orthographic projection matrix.
Projection space refers to the space after applying projection transformation from view space. After the projection transformation, visible content has x and y coordinates ranging from -1 to 1, and z coordinates ranging from 0 to 1.
Unlike perspective projection, in orthographic projection there is no perspective foreshortening.
The viewable area of this orthographic projection extends from left to right on the x-axis, bottom to top on the y-axis, and zNearPlane to zFarPlane on the z-axis. These values are relative to the position and x, y, and z-axes of the view. To obtain the viewable area (in world space) of a scene, create a BoundingFrustum and pass the combined view and projection matrix to the constructor.
left | The minimum x-value of the view volume. |
right | The maximum x-value of the view volume. |
bottom | The minimum y-value of the view volume. |
top | The maximum y-value of the view volume. |
zNearPlane | The minimum z-value of the view volume. |
zFarPlane | The maximum z-value of the view volume. |
dst | A matrix to store the result in. |
|
static |
Creates a spherical billboard that rotates around a specified object position.
This method computes the facing direction of the billboard from the object position and camera position. When the object and camera positions are too close, the matrix will not be accurate. To avoid this problem, this method defaults to the identity rotation if the positions are too close. (See the other overload of createBillboard for an alternative approach).
objectPosition | The position of the object the billboard will rotate around. |
cameraPosition | The position of the camera. |
cameraUpVector | The up vector of the camera. |
dst | A matrix to store the result in. |
|
static |
Creates a spherical billboard that rotates around a specified object position with provision for a safe default orientation.
This method computes the facing direction of the billboard from the object position and camera position. When the object and camera positions are too close, the matrix will not be accurate. To avoid this problem, this method uses the specified camera forward vector if the positions are too close. (See the other overload of createBillboard for an alternative approach).
objectPosition | The position of the object the billboard will rotate around. |
cameraPosition | The position of the camera. |
cameraUpVector | The up vector of the camera. |
cameraForwardVector | The forward vector of the camera, used if the positions are too close. |
dst | A matrix to store the result in. |
Creates a scale matrix.
scale | The amount to scale. |
dst | A matrix to store the result in. |
|
static |
Creates a scale matrix.
xScale | The amount to scale along the x-axis. |
yScale | The amount to scale along the y-axis. |
zScale | The amount to scale along the z-axis. |
dst | A matrix to store the result in. |
|
static |
Creates a rotation matrix from the specified quaternion.
quat | A quaternion describing a 3D orientation. |
dst | A matrix to store the result in. |
Creates a rotation matrix from the specified axis and angle.
axis | A vector describing the axis to rotate about. |
angle | The angle (in radians). |
dst | A matrix to store the result in. |
|
static |
Creates a matrix describing a rotation around the x-axis.
angle | The angle of rotation (in radians). |
dst | A matrix to store the result in. |
|
static |
Creates a matrix describing a rotation around the y-axis.
angle | The angle of rotation (in radians). |
dst | A matrix to store the result in. |
|
static |
Creates a matrix describing a rotation around the z-axis.
angle | The angle of rotation (in radians). |
dst | A matrix to store the result in. |
Creates a translation matrix.
translation | The translation. |
dst | A matrix to store the result in. |
|
static |
Creates a translation matrix.
xTranslation | The translation on the x-axis. |
yTranslation | The translation on the y-axis. |
zTranslation | The translation on the z-axis. |
dst | A matrix to store the result in. |
void add | ( | float | scalar | ) |
Adds a scalar value to each component of this matrix.
scalar | The scalar to add. |
void add | ( | float | scalar, |
Mat4 * | dst ) |
Adds a scalar value to each component of this matrix and stores the result in dst.
scalar | The scalar value to add. |
dst | A matrix to store the result in. |
void add | ( | const Mat4 & | mat | ) |
Adds the specified matrix to this matrix.
mat | The matrix to add. |
Adds the specified matrices and stores the result in dst.
m1 | The first matrix. |
m2 | The second matrix. |
dst | The destination matrix to add to. |
bool decompose | ( | Vec3 * | scale, |
Quaternion * | rotation, | ||
Vec3 * | translation ) const |
Decomposes the scale, rotation and translation components of this matrix.
scale | The scale. |
rotation | The rotation. |
translation | The translation. |
float determinant | ( | ) | const |
Computes the determinant of this matrix.
void getScale | ( | Vec3 * | scale | ) | const |
Gets the scalar component of this matrix in the specified vector.
If the scalar component of this matrix has negative parts, it is not possible to always extract the exact scalar component; instead, a scale vector that is mathematically equivalent to the original scale vector is extracted and returned.
scale | A vector to receive the scale. |
bool getRotation | ( | Quaternion * | rotation | ) | const |
Gets the rotational component of this matrix in the specified quaternion.
rotation | A quaternion to receive the rotation. |
void getTranslation | ( | Vec3 * | translation | ) | const |
Gets the translational component of this matrix in the specified vector.
translation | A vector to receive the translation. |
void getUpVector | ( | Vec3 * | dst | ) | const |
Gets the up vector of this matrix.
dst | The destination vector. |
void getDownVector | ( | Vec3 * | dst | ) | const |
Gets the down vector of this matrix.
dst | The destination vector. |
void getLeftVector | ( | Vec3 * | dst | ) | const |
Gets the left vector of this matrix.
dst | The destination vector. |
void getRightVector | ( | Vec3 * | dst | ) | const |
Gets the right vector of this matrix.
dst | The destination vector. |
void getForwardVector | ( | Vec3 * | dst | ) | const |
Gets the forward vector of this matrix.
dst | The destination vector. |
void getBackVector | ( | Vec3 * | dst | ) | const |
Gets the backward vector of this matrix.
dst | The destination vector. |
bool inverse | ( | ) |
Inverts this matrix.
bool isIdentity | ( | ) | const |
Determines if this matrix is equal to the identity matrix.
void multiply | ( | float | scalar | ) |
Multiplies the components of this matrix by the specified scalar.
scalar | The scalar value. |
void multiply | ( | float | scalar, |
Mat4 * | dst ) const |
Multiplies the components of this matrix by a scalar and stores the result in dst.
scalar | The scalar value. |
dst | A matrix to store the result in. |
Multiplies the components of the specified matrix by a scalar and stores the result in dst.
mat | The matrix. |
scalar | The scalar value. |
dst | A matrix to store the result in. |
void multiply | ( | const Mat4 & | mat | ) |
Multiplies this matrix by the specified one.
mat | The matrix to multiply. |
Multiplies m1 by m2 and stores the result in dst.
m1 | The first matrix to multiply. |
m2 | The second matrix to multiply. |
dst | A matrix to store the result in. |
void rotate | ( | const Quaternion & | q | ) |
Post-multiplies this matrix by the matrix corresponding to the specified quaternion rotation.
q | The quaternion to rotate by. |
void rotate | ( | const Quaternion & | q, |
Mat4 * | dst ) const |
Post-multiplies this matrix by the matrix corresponding to the specified quaternion rotation and stores the result in dst.
q | The quaternion to rotate by. |
dst | A matrix to store the result in. |
void rotate | ( | const Vec3 & | axis, |
float | angle ) |
Post-multiplies this matrix by the matrix corresponding to the specified rotation about the specified axis.
axis | The axis to rotate about. |
angle | The angle (in radians). |
Post-multiplies this matrix by the matrix corresponding to the specified rotation about the specified axis and stores the result in dst.
axis | The axis to rotate about. |
angle | The angle (in radians). |
dst | A matrix to store the result in. |
void rotateX | ( | float | angle | ) |
Post-multiplies this matrix by the matrix corresponding to the specified rotation around the x-axis.
angle | The angle (in radians). |
void rotateX | ( | float | angle, |
Mat4 * | dst ) const |
Post-multiplies this matrix by the matrix corresponding to the specified rotation around the x-axis and stores the result in dst.
angle | The angle (in radians). |
dst | A matrix to store the result in. |
void rotateY | ( | float | angle | ) |
Post-multiplies this matrix by the matrix corresponding to the specified rotation around the y-axis.
angle | The angle (in radians). |
void rotateY | ( | float | angle, |
Mat4 * | dst ) const |
Post-multiplies this matrix by the matrix corresponding to the specified rotation around the y-axis and stores the result in dst.
angle | The angle (in radians). |
dst | A matrix to store the result in. |
void rotateZ | ( | float | angle | ) |
Post-multiplies this matrix by the matrix corresponding to the specified rotation around the z-axis.
angle | The angle (in radians). |
void rotateZ | ( | float | angle, |
Mat4 * | dst ) const |
Post-multiplies this matrix by the matrix corresponding to the specified rotation around the z-axis and stores the result in dst.
angle | The angle (in radians). |
dst | A matrix to store the result in. |
void scale | ( | float | value | ) |
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation.
value | The amount to scale along all axes. |
void scale | ( | float | value, |
Mat4 * | dst ) const |
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation and stores the result in dst.
value | The amount to scale along all axes. |
dst | A matrix to store the result in. |
void scale | ( | float | xScale, |
float | yScale, | ||
float | zScale ) |
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation.
xScale | The amount to scale along the x-axis. |
yScale | The amount to scale along the y-axis. |
zScale | The amount to scale along the z-axis. |
void scale | ( | float | xScale, |
float | yScale, | ||
float | zScale, | ||
Mat4 * | dst ) const |
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation and stores the result in dst.
xScale | The amount to scale along the x-axis. |
yScale | The amount to scale along the y-axis. |
zScale | The amount to scale along the z-axis. |
dst | A matrix to store the result in. |
void scale | ( | const Vec3 & | s | ) |
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation.
s | The scale values along the x, y and z axes. |
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation and stores the result in dst.
s | The scale values along the x, y and z axes. |
dst | A matrix to store the result in. |
|
inlineconstexpr |
Sets the values of this matrix.
m11 | The first element of the first row. |
m12 | The second element of the first row. |
m13 | The third element of the first row. |
m14 | The fourth element of the first row. |
m21 | The first element of the second row. |
m22 | The second element of the second row. |
m23 | The third element of the second row. |
m24 | The fourth element of the second row. |
m31 | The first element of the third row. |
m32 | The second element of the third row. |
m33 | The third element of the third row. |
m34 | The fourth element of the third row. |
m41 | The first element of the fourth row. |
m42 | The second element of the fourth row. |
m43 | The third element of the fourth row. |
m44 | The fourth element of the fourth row. |
|
inline |
Sets the values of this matrix to those in the specified column-major array.
mat | An array containing 16 elements in column-major format. |
|
inline |
Sets the values of this matrix to those of the specified matrix.
mat | The source matrix. |
void subtract | ( | const Mat4 & | mat | ) |
Subtracts the specified matrix from the current matrix.
mat | The matrix to subtract. |
Subtracts the specified matrix from the current matrix.
m1 | The first matrix. |
m2 | The second matrix. |
dst | A matrix to store the result in. |
|
inline |
Transforms the specified point by this matrix.
The result of the transformation is stored directly into point.
point | The point to transform and also a vector to hold the result in. |
Transforms the specified point by this matrix, and stores the result in dst.
point | The point to transform. |
dst | A vector to store the transformed point in. |
void transformVector | ( | Vec3 * | vector | ) | const |
Transforms the specified vector by this matrix by treating the fourth (w) coordinate as zero.
The result of the transformation is stored directly into vector.
vector | The vector to transform and also a vector to hold the result in. |
Transforms the specified vector by this matrix by treating the fourth (w) coordinate as zero, and stores the result in dst.
vector | The vector to transform. |
dst | A vector to store the transformed vector in. |
void transformVector | ( | float | x, |
float | y, | ||
float | z, | ||
float | w, | ||
Vec3 * | dst ) const |
Transforms the specified vector by this matrix.
x | The vector x-coordinate to transform by. |
y | The vector y-coordinate to transform by. |
z | The vector z-coordinate to transform by. |
w | The vector w-coordinate to transform by. |
dst | A vector to store the transformed point in. |
void transformVector | ( | Vec4 * | vector | ) | const |
Transforms the specified vector by this matrix.
The result of the transformation is stored directly into vector.
vector | The vector to transform. |
Transforms the specified vector by this matrix.
vector | The vector to transform. |
dst | A vector to store the transformed point in. |
void translate | ( | float | x, |
float | y, | ||
float | z ) |
Post-multiplies this matrix by the matrix corresponding to the specified translation.
x | The amount to translate along the x-axis. |
y | The amount to translate along the y-axis. |
z | The amount to translate along the z-axis. |
void translate | ( | float | x, |
float | y, | ||
float | z, | ||
Mat4 * | dst ) const |
Post-multiplies this matrix by the matrix corresponding to the specified translation and stores the result in dst.
x | The amount to translate along the x-axis. |
y | The amount to translate along the y-axis. |
z | The amount to translate along the z-axis. |
dst | A matrix to store the result in. |
void translate | ( | const Vec3 & | t | ) |
Post-multiplies this matrix by the matrix corresponding to the specified translation.
t | The translation values along the x, y and z axes. |
Post-multiplies this matrix by the matrix corresponding to the specified translation and stores the result in dst.
t | The translation values along the x, y and z axes. |
dst | A matrix to store the result in. |
Calculates the sum of this matrix with the given matrix.
Note: this does not modify this matrix.
mat | The matrix to add. |
Adds the given matrix to this matrix.
mat | The matrix to add. |
Calculates the difference of this matrix with the given matrix.
Note: this does not modify this matrix.
mat | The matrix to subtract. |
Subtracts the given matrix from this matrix.
mat | The matrix to subtract. |
|
inline |
Calculates the negation of this matrix.
Note: this does not modify this matrix.
Calculates the matrix product of this matrix with the given matrix.
Note: this does not modify this matrix.
mat | The matrix to multiply by. |
Right-multiplies this matrix by the given matrix.
mat | The matrix to multiply by. |