|
3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
|
Represents a row-major 4x4 matrix. Used for 3D affine transformations, rotations, and projections. More...
#include <Matrix4x4.hpp>
Public Member Functions | |
| constexpr | Matrix4x4 (float m[16]) |
| Creates a matrix from an array of 16 floats. | |
| constexpr | Matrix4x4 (float m11=1, float m12=0, float m13=0, float m14=0, float m21=0, float m22=1, float m23=0, float m24=0, float m31=0, float m32=0, float m33=1, float m34=0, float m41=0, float m42=0, float m43=0, float m44=1) |
| Creates a matrix with the specified values. If no values are provided, it creates an identity matrix. | |
| Matrix4x4 & | Hadamard (const Matrix4x4 &m) |
| Element-wise (Hadamard) multiplication of this matrix with another matrix. | |
| Matrix4x4 | operator+ (const Matrix4x4 &m) const noexcept |
| Adds this matrix to another matrix and returns the result. | |
| Matrix4x4 & | operator+= (const Matrix4x4 &m) noexcept |
| Adds another matrix to this matrix in-place. | |
| Matrix4x4 | operator- (const Matrix4x4 &m) const noexcept |
| Subtracts another matrix from this matrix and returns the result. | |
| Matrix4x4 & | operator-= (const Matrix4x4 &m) noexcept |
| Subtracts another matrix from this matrix in-place. | |
| Matrix4x4 | operator* (const Matrix4x4 &m) const noexcept |
| Multiplies this matrix with another matrix (matrix product) and returns the result. | |
| Matrix4x4 & | operator*= (const Matrix4x4 &m) noexcept |
| Multiplies this matrix with another matrix (matrix product) in-place. | |
| Matrix4x4 | operator* (float scalar) const noexcept |
| Multiplies this matrix by a scalar and returns the result. | |
| Matrix4x4 & | operator*= (float scalar) noexcept |
| Multiplies this matrix by a scalar in-place. | |
| Matrix4x4 & | Transpose () |
| Transposes this matrix in-place. | |
| Matrix4x4 & | Invert () |
| Inverts this matrix in-place. | |
| float & | operator[] (unsigned index) |
| Returns a reference to the element at the specified index in the matrix, allowing for both reading and writing. | |
| float | Trace () const noexcept |
| Returns the trace of this matrix. | |
| float | Determinant () const noexcept |
| Returns the determinant of this matrix. | |
| Vector3 | Forward () const noexcept |
| Returns the forward direction vector encoded in this matrix. | |
| Vector3 | Backward () const noexcept |
| Returns the backward direction vector encoded in this matrix. | |
| Vector3 | Up () const noexcept |
| Returns the up direction vector encoded in this matrix. | |
| Vector3 | Down () const noexcept |
| Returns the down direction vector encoded in this matrix. | |
| Vector3 | Left () const noexcept |
| Returns the left direction vector encoded in this matrix. | |
| Vector3 | Right () const noexcept |
| Returns the right direction vector encoded in this matrix. | |
| Vector3 | Translation () const noexcept |
| Returns the translation vector encoded in this matrix. | |
Static Public Member Functions | |
| static Matrix4x4 | CreateTranslation (const Vector3 &pos) |
| Creates a 3D translation matrix. | |
| static Matrix4x4 | CreateScale (const Vector3 &scale) |
| Creates a 3D scaling matrix. | |
| static Matrix4x4 | CreateRotationX (float theta) |
| Creates a rotation matrix around the X-axis. | |
| static Matrix4x4 | CreateRotationY (float theta) |
| Creates a rotation matrix around the Y-axis. | |
| static Matrix4x4 | CreateRotationZ (float theta) |
| Creates a rotation matrix around the Z-axis. | |
| static Matrix4x4 | CreateFromQuaternion (const Quaternion &q) |
| Creates a rotation matrix from a quaternion. | |
| static Matrix4x4 | CreateRotationYawPitchRoll (float yaw, float pitch, float roll) |
| Creates a rotation matrix from yaw, pitch, and roll angles. | |
| static Matrix4x4 | CreateLookAtView (const Vector3 &pos, const Vector3 &look_at, const Vector3 &up_dir) |
| Creates a right-hand look at view matrix. | |
| static Matrix4x4 | CreatePerspectiveProjection (float aspectRatio, float FOV, float npd, float fpd) |
| Creates a right-handed perspective projection matrix. | |
| static Matrix4x4 | CreateOrthographicProjection (const Point &screenSize, float npd, float fpd) |
| Creates a right-handed orthographic projection matrix. | |
| static Matrix4x4 | CreateSphericalBillboard (const Vector3 &objectPos, const Vector3 &cameraPos, const Vector3 &cameraUp, const Vector3 &cameraForward) |
| Creates a spherical billboard matrix that always faces the camera position. | |
| static Matrix4x4 | CreateCylindricalBillboard (const Vector3 &objectPos, const Vector3 &cameraPos, const Vector3 &cameraUp, const Vector3 &cameraForward, const Vector3 &axis, std::optional< Vector3 > objectForward) |
| Creates a cylindrical billboard matrix that rotates around a fixed axis to face the camera. | |
| static Matrix4x4 | Hadamard (const Matrix4x4 &a, const Matrix4x4 &b) |
| Element-wise (Hadamard) product of two matrices. | |
| static Matrix4x4 | Transpose (const Matrix4x4 &m) |
| Returns the transpose of the specified matrix. | |
| static Matrix4x4 | Invert (const Matrix4x4 &m) |
| Returns the inverse of the specified matrix. | |
Public Attributes | |
| 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 |
Represents a row-major 4x4 matrix. Used for 3D affine transformations, rotations, and projections.
|
explicitconstexpr |
Creates a matrix from an array of 16 floats.
| m | The array containing the 16 matrix elements in row-major order. |
|
explicitconstexpr |
Creates a matrix with the specified values. If no values are provided, it creates an identity matrix.
| m11 | The value for the first row, first column. |
| m12 | The value for the first row, second column. |
| m13 | The value for the first row, third column. |
| m14 | The value for the first row, fourth column. |
| m21 | The value for the second row, first column. |
| m22 | The value for the second row, second column. |
| m23 | The value for the second row, third column. |
| m24 | The value for the second row, fourth column. |
| m31 | The value for the third row, first column. |
| m32 | The value for the third row, second column. |
| m33 | The value for the third row, third column. |
| m34 | The value for the third row, fourth column. |
| m41 | The value for the fourth row, first column. |
| m42 | The value for the fourth row, second column. |
| m43 | The value for the fourth row, third column. |
| m44 | The value for the fourth row, fourth column. |
|
noexcept |
Returns the backward direction vector encoded in this matrix.
|
static |
Creates a cylindrical billboard matrix that rotates around a fixed axis to face the camera.
| objectPos | The position of the object. |
| cameraPos | The position of the camera. |
| cameraUp | The up vector of the camera. |
| cameraForward | The forward vector of the camera. |
| axis | The fixed rotation axis for the billboard. |
| objectForward | An optional forward vector for the object, used to resolve ambiguity when the object is aligned with the axis. |
|
static |
Creates a rotation matrix from a quaternion.
| q | The quaternion representing the rotation. |
|
static |
Creates a right-hand look at view matrix.
| pos | Camera position |
| look_at | Camera look direction |
| up_dir | Camera normal |
|
static |
Creates a right-handed orthographic projection matrix.
| screenSize | The width and height of the projection view volume. |
| npd | The near plane distance. |
| fpd | The far plane distance. |
|
static |
Creates a right-handed perspective projection matrix.
| aspectRatio | The aspect ratio (width / height) of the viewport. |
| FOV | The vertical field of view in radians. |
| npd | The near plane distance. |
| fpd | The far plane distance. |
Creates a rotation matrix around the X-axis.
| theta | The rotation angle in radians. |
Creates a rotation matrix around the Y-axis.
| theta | The rotation angle in radians. |
Creates a rotation matrix from yaw, pitch, and roll angles.
| yaw | The yaw angle in radians (rotation around the Y-axis). |
| pitch | The pitch angle in radians (rotation around the X-axis). |
| roll | The roll angle in radians (rotation around the Z-axis). |
Creates a rotation matrix around the Z-axis.
| theta | The rotation angle in radians. |
Creates a 3D scaling matrix.
| scale | The scaling vector. |
|
static |
Creates a spherical billboard matrix that always faces the camera position.
| objectPos | The position of the object. |
| cameraPos | The position of the camera. |
| cameraUp | The up vector of the camera. |
| cameraForward | The forward vector of the camera. |
Creates a 3D translation matrix.
| pos | The translation vector. |
|
noexcept |
Returns the determinant of this matrix.
|
noexcept |
Returns the down direction vector encoded in this matrix.
|
noexcept |
Returns the forward direction vector encoded in this matrix.
Element-wise (Hadamard) product of two matrices.
| a | The first matrix. |
| b | The second matrix. |
Element-wise (Hadamard) multiplication of this matrix with another matrix.
| m | The matrix to multiply with. |
| Matrix4x4 & Matrix4x4::Invert | ( | ) |
Inverts this matrix in-place.
Returns the inverse of the specified matrix.
| m | The matrix to invert. |
|
noexcept |
Returns the left direction vector encoded in this matrix.
Multiplies this matrix with another matrix (matrix product) and returns the result.
| m | The matrix to multiply with. |
Multiplies this matrix by a scalar and returns the result.
| scalar | The scalar value to multiply with. |
Multiplies this matrix with another matrix (matrix product) in-place.
| m | The matrix to multiply with. |
Multiplies this matrix by a scalar in-place.
| scalar | The scalar value to multiply with. |
Adds this matrix to another matrix and returns the result.
| m | The matrix to add. |
Adds another matrix to this matrix in-place.
| m | The matrix to add. |
Subtracts another matrix from this matrix and returns the result.
| m | The matrix to subtract. |
Subtracts another matrix from this matrix in-place.
| m | The matrix to subtract. |
| float & Matrix4x4::operator[] | ( | unsigned | index | ) |
Returns a reference to the element at the specified index in the matrix, allowing for both reading and writing.
| index | Index, between 0 and 15. |
|
noexcept |
Returns the right direction vector encoded in this matrix.
|
noexcept |
Returns the trace of this matrix.
|
noexcept |
Returns the translation vector encoded in this matrix.
| Matrix4x4 & Matrix4x4::Transpose | ( | ) |
Transposes this matrix in-place.
Returns the transpose of the specified matrix.
| m | The matrix to transpose. |
|
noexcept |
Returns the up direction vector encoded in this matrix.
| float Engine3DRadSpace.Math::Matrix4x4::M11 |
| float Engine3DRadSpace.Math::Matrix4x4::M12 |
| float Engine3DRadSpace.Math::Matrix4x4::M13 |
| float Engine3DRadSpace.Math::Matrix4x4::M14 |
| float Engine3DRadSpace.Math::Matrix4x4::M21 |
| float Engine3DRadSpace.Math::Matrix4x4::M22 |
| float Engine3DRadSpace.Math::Matrix4x4::M23 |
| float Engine3DRadSpace.Math::Matrix4x4::M24 |
| float Engine3DRadSpace.Math::Matrix4x4::M31 |
| float Engine3DRadSpace.Math::Matrix4x4::M32 |
| float Engine3DRadSpace.Math::Matrix4x4::M33 |
| float Engine3DRadSpace.Math::Matrix4x4::M34 |
| float Engine3DRadSpace.Math::Matrix4x4::M41 |
| float Engine3DRadSpace.Math::Matrix4x4::M42 |
| float Engine3DRadSpace.Math::Matrix4x4::M43 |
| float Engine3DRadSpace.Math::Matrix4x4::M44 |