#include <Matrix4x4.h>
Public Member Functions | |
AZ_TYPE_INFO (Matrix4x4, "{157193C7-B673-4A2B-8B43-5681DCC3DEC3}") | |
Matrix4x4 ()=default | |
Default constructor does not initialize the matrix. | |
Matrix4x4 (const Matrix4x4 &rhs)=default | |
Matrix4x4 (Simd::Vec4::FloatArgType row0, Simd::Vec4::FloatArgType row1, Simd::Vec4::FloatArgType row2, Simd::Vec4::FloatArgType row3) | |
void | StoreToRowMajorFloat16 (float *values) const |
void | StoreToColumnMajorFloat16 (float *values) const |
float | operator() (int32_t row, int32_t col) const |
Indexed access using operator(). | |
Matrix4x4 | operator- () const |
Operator for negating all matrix's elements. | |
Vector3 | operator* (const Vector3 &rhs) const |
Vector4 | operator* (const Vector4 &rhs) const |
Post-multiplies the matrix by a vector. | |
Vector3 | TransposedMultiply3x3 (const Vector3 &v) const |
Vector3 | Multiply3x3 (const Vector3 &v) const |
Post-multiplies the matrix by a vector, using only the upper 3x3 submatrix. | |
Vector3 | RetrieveScale () const |
Gets the scale part of the transformation, i.e. the length of the scale components. | |
Vector3 | RetrieveScaleSq () const |
Gets the squared scale part of the transformation (the squared length of the basis vectors). | |
Vector3 | ExtractScale () |
Gets the scale part of the transformation as in RetrieveScale, and also removes this scaling from the matrix. | |
void | MultiplyByScale (const Vector3 &scale) |
Quick multiplication by a scale matrix, equivalent to m*=Matrix4x4::CreateScale(scale). | |
Matrix4x4 | GetReciprocalScaled () const |
Returns a matrix with the reciprocal scale, keeping the same rotation and translation. | |
bool | IsClose (const Matrix4x4 &rhs, float tolerance=Constants::Tolerance) const |
bool | operator== (const Matrix4x4 &rhs) const |
bool | operator!= (const Matrix4x4 &rhs) const |
void | SetRotationPartFromQuaternion (const Quaternion &q) |
sets the upper 3x3 rotation part of the matrix from a quaternion. | |
Vector4 | GetDiagonal () const |
bool | IsFinite () const |
const Simd::Vec4::FloatType * | GetSimdValues () const |
Simd::Vec4::FloatType * | GetSimdValues () |
float | GetElement (int32_t row, int32_t col) const |
void | SetElement (int32_t row, int32_t col, float value) |
Vector4 | GetRow (int32_t row) const |
Vector3 | GetRowAsVector3 (int32_t row) const |
void | GetRows (Vector4 *row0, Vector4 *row1, Vector4 *row2, Vector4 *row3) const |
void | SetRow (int32_t row, float x, float y, float z, float w) |
void | SetRow (int32_t row, const Vector3 &v) |
void | SetRow (int32_t row, const Vector3 &v, float w) |
void | SetRow (int32_t row, const Vector4 &v) |
void | SetRows (const Vector4 &row0, const Vector4 &row1, const Vector4 &row2, const Vector4 &row3) |
Vector4 | GetColumn (int32_t col) const |
Vector3 | GetColumnAsVector3 (int32_t col) const |
void | GetColumns (Vector4 *col0, Vector4 *col1, Vector4 *col2, Vector4 *col3) const |
void | SetColumn (int32_t col, float x, float y, float z, float w) |
void | SetColumn (int32_t col, const Vector3 &v) |
void | SetColumn (int32_t col, const Vector3 &v, float w) |
void | SetColumn (int32_t col, const Vector4 &v) |
void | SetColumns (const Vector4 &col0, const Vector4 &col1, const Vector4 &col2, const Vector4 &col3) |
Vector4 | GetBasisX () const |
Vector3 | GetBasisXAsVector3 () const |
void | SetBasisX (float x, float y, float z, float w) |
void | SetBasisX (const Vector4 &v) |
Vector4 | GetBasisY () const |
Vector3 | GetBasisYAsVector3 () const |
void | SetBasisY (float x, float y, float z, float w) |
void | SetBasisY (const Vector4 &v) |
Vector4 | GetBasisZ () const |
Vector3 | GetBasisZAsVector3 () const |
void | SetBasisZ (float x, float y, float z, float w) |
void | SetBasisZ (const Vector4 &v) |
void | GetBasisAndTranslation (Vector4 *basisX, Vector4 *basisY, Vector4 *basisZ, Vector4 *pos) const |
void | SetBasisAndTranslation (const Vector4 &basisX, const Vector4 &basisY, const Vector4 &basisZ, const Vector4 &pos) |
Vector3 | GetTranslation () const |
void | SetTranslation (float x, float y, float z) |
void | SetTranslation (const Vector3 &v) |
Matrix4x4 | operator+ (const Matrix4x4 &rhs) const |
Matrix4x4 & | operator+= (const Matrix4x4 &rhs) |
Matrix4x4 | operator- (const Matrix4x4 &rhs) const |
Matrix4x4 & | operator-= (const Matrix4x4 &rhs) |
Matrix4x4 | operator* (const Matrix4x4 &rhs) const |
Matrix4x4 & | operator*= (const Matrix4x4 &rhs) |
Matrix4x4 | operator* (float multiplier) const |
Matrix4x4 & | operator*= (float multiplier) |
Matrix4x4 | operator/ (float divisor) const |
Matrix4x4 & | operator/= (float divisor) |
Matrix4x4 | GetTranspose () const |
void | Transpose () |
Matrix4x4 | GetInverseFull () const |
void | InvertFull () |
Matrix4x4 | GetInverseTransform () const |
void | InvertTransform () |
Matrix4x4 | GetInverseFast () const |
void | InvertFast () |
Static Public Member Functions | |
static void | Reflect (ReflectContext *context) |
static Matrix4x4 | CreateIdentity () |
static Matrix4x4 | CreateZero () |
static Matrix4x4 | CreateFromValue (float value) |
Constructs a matrix with all components set to the specified value. | |
static Matrix4x4 | CreateFromRowMajorFloat16 (const float *values) |
Constructs from an array of 16 floats stored in row-major order. | |
static Matrix4x4 | CreateFromRows (const Vector4 &row0, const Vector4 &row1, const Vector4 &row2, const Vector4 &row3) |
static Matrix4x4 | CreateFromColumnMajorFloat16 (const float *values) |
Constructs from an array of 16 floats stored in column-major order. | |
static Matrix4x4 | CreateFromColumns (const Vector4 &col0, const Vector4 &col1, const Vector4 &col2, const Vector4 &col3) |
static Matrix4x4 | CreateFromQuaternion (const Quaternion &q) |
Sets the matrix from a quaternion, translation is set to zero. | |
static Matrix4x4 | CreateFromQuaternionAndTranslation (const Quaternion &q, const Vector3 &p) |
Sets the matrix from a quaternion and a translation. | |
static Matrix4x4 | CreateFromMatrix3x4 (const Matrix3x4 &matrix3x4) |
Creates a Matrix4x4 from a Matrix3x4, setting the bottom row to (0, 0, 0, 1). | |
static Matrix4x4 | CreateFromTransform (const Transform &transform) |
Creates a Matrix3x4 from a Transform, setting the bottom row to (0, 0, 0, 1). | |
static Matrix4x4 | CreateScale (const Vector3 &scale) |
Sets the matrix to be a scale matrix. | |
static Matrix4x4 | CreateDiagonal (const Vector4 &diagonal) |
Sets the matrix to be a diagonal matrix. | |
static Matrix4x4 | CreateTranslation (const Vector3 &translation) |
Sets the matrix to be a translation matrix. | |
static Matrix4x4 | CreateProjection (float fovY, float aspectRatio, float nearDist, float farDist) |
Creates a projection matrix using the vertical field of view and the aspect ratio. | |
static Matrix4x4 | CreateProjectionFov (float fovX, float fovY, float nearDist, float farDist) |
static Matrix4x4 | CreateProjectionOffset (float left, float right, float bottom, float top, float nearDist, float farDist) |
Creates an off-center projection matrix. | |
static Matrix4x4 | CreateInterpolated (const Matrix4x4 &m1, const Matrix4x4 &m2, float t) |
Interpolates between two matrices; linearly for scale/translation, spherically for rotation. | |
static Matrix4x4 | CreateRotationX (float angle) |
static Matrix4x4 | CreateRotationY (float angle) |
static Matrix4x4 | CreateRotationZ (float angle) |
Static Public Attributes | |
static constexpr int32_t | RowCount = 4 |
static constexpr int32_t | ColCount = 4 |
The general matrix class. Stores all 4 rows and 4 columns, so can be used for all types of transformations. If you don't need perspective, consider using Transform. if you don't need translation, consider using Matrix3x3.
When multiplying with a Vector3, it assumes the w-component of the Vector3 is 1.0. Use the Multiply3x3 functions to multiply by the upper 3x3 submatrix only, e.g. for transforming normals.
|
static |
Creates a projection matrix using the vertical and horizontal field of view. Note that the relationship between field of view and aspect ratio is not linear, so prefer CreateProjection().
|
static |
Sets the matrix to be a rotation around a specified axis.
AZ_MATH_INLINE Vector4 AZ::Matrix4x4::GetBasisX | ( | ) | const |
Basis (column) access functions.
AZ_MATH_INLINE Vector4 AZ::Matrix4x4::GetColumn | ( | int32_t | col | ) | const |
Column access functions.
AZ_MATH_INLINE float AZ::Matrix4x4::GetElement | ( | int32_t | row, |
int32_t | col | ||
) | const |
Indexed accessor functions.
AZ_MATH_INLINE Matrix4x4 AZ::Matrix4x4::GetInverseFast | ( | ) | const |
Fast inversion. Assumes the matrix consists of an upper 3x3 orthogonal matrix (i.e. a rotation) and a translation in the last column.
Matrix4x4 AZ::Matrix4x4::GetInverseFull | ( | ) | const |
Performs a full inversion for an arbitrary 4x4 matrix. Using GetInverseTransform or GetFastInverse will often be possible, use them in preference to this.
Matrix4x4 AZ::Matrix4x4::GetInverseTransform | ( | ) | const |
Gets the inverse of the matrix. Assumes that the last row is (0,0,0,1), use GetInverseFull if this is not true.
AZ_MATH_INLINE Vector4 AZ::Matrix4x4::GetRow | ( | int32_t | row | ) | const |
Row access functions.
AZ_MATH_INLINE Vector3 AZ::Matrix4x4::GetTranslation | ( | ) | const |
Position (last column) access functions.
AZ_MATH_INLINE Matrix4x4 AZ::Matrix4x4::GetTranspose | ( | ) | const |
Transpose operations.
Operator for matrix-matrix multiplication.
Post-multiplies the matrix by a vector. Assumes that the w-component of the Vector3 is 1.0.
AZ_MATH_INLINE Matrix4x4 AZ::Matrix4x4::operator* | ( | float | multiplier | ) | const |
Operator for multiplying all matrix's elements with a scalar
Operator for matrix-matrix addition.
Operator for matrix-matrix substraction.
AZ_MATH_INLINE Matrix4x4 AZ::Matrix4x4::operator/ | ( | float | divisor | ) | const |
Operator for dividing all matrix's elements with a scalar
|
static |
AzCore Reflection.
context | reflection context |
AZ_MATH_INLINE void AZ::Matrix4x4::StoreToColumnMajorFloat16 | ( | float * | values | ) | const |
Stores the matrix into to an array of 16 floats. The floats need only be 4 byte aligned, 16 byte alignment is not required.
AZ_MATH_INLINE void AZ::Matrix4x4::StoreToRowMajorFloat16 | ( | float * | values | ) | const |
Stores the matrix into to an array of 16 floats. The floats need only be 4 byte aligned, 16 byte alignment is not required.
Pre-multiplies the matrix by a vector, using only the upper 3x3 submatrix. Note that this is not the usual multiplication order for transformations.