SA_Maths
Sapphire Suite's C++ Maths Library
|
Matrix 4x4 Sapphire-Maths class. More...
#include <Matrix4.hpp>
Public Member Functions | |
template<typename TIn , MatrixMajor majorIn> | |
constexpr | Mat4 (const Mat4< TIn, majorIn > &_other) noexcept |
Value constructor from another Mat4 type. | |
template<typename TIn , MatrixMajor majorIn> | |
constexpr | Mat4 (const Mat3< TIn, majorIn > &_other) noexcept |
Value constructor from another Mat3 type. | |
constexpr bool | IsZero () const noexcept |
Whether this matrix is a zero matrix. | |
constexpr bool | IsIdentity () const noexcept |
Whether this matrix is an identity matrix. | |
constexpr bool | Equals (const Mat4 &_other, T _threshold=std::numeric_limits< T >::epsilon()) const noexcept |
Compare 2 Matrix. | |
constexpr bool | operator== (const Mat4 &_rhs) const noexcept |
Compare 2 matrix equality. | |
constexpr bool | operator!= (const Mat4 &_rhs) const noexcept |
Compare 2 matrix inequality. | |
T * | Data () noexcept |
Getter of matrix data | |
const T * | Data () const noexcept |
Const Getter of matrix data | |
T & | At (uint32_t _index) |
Getter of Value at index. | |
const T & | At (uint32_t _index) const |
Const Getter of Value at index. | |
T & | At (uint32_t _x, uint32_t _y) |
Getter of Value at (x;y). | |
const T & | At (uint32_t _x, uint32_t _y) const |
Const Getter of Value at (x;y). | |
T & | operator[] (uint32_t _index) |
Access operator by index. | |
const T & | operator[] (uint32_t _index) const |
Const Access operator by index. | |
Mat4 & | Transpose () noexcept |
Transpose this matrix. | |
constexpr Mat4 | GetTransposed () const noexcept |
Transpose this matrix. | |
T | Determinant () const noexcept |
Compute the determinant of the matrix. | |
Mat4 & | Inverse () |
Inverse this matrix. | |
Mat4 | GetInversed () const |
Inverse this matrix. | |
template<typename TIn , MatrixMajor majorIn> | |
Mat4 & | operator= (const Mat4< TIn, majorIn > _rhs) noexcept |
Assignment operator from another Mat4 type. | |
constexpr Mat4 | operator- () const noexcept |
Getter of the opposite signed matrix. | |
template<typename TIn > | |
Mat4 | operator* (TIn _scale) const noexcept |
Scale each matrix component by _scale. | |
template<typename TIn > | |
Mat4 | operator/ (TIn _scale) const |
Inverse Scale each matrix component by _scale. | |
Mat4 | operator+ (const Mat4 &_rhs) const noexcept |
Add term by term matrix values. | |
Mat4 | operator- (const Mat4 &_rhs) const noexcept |
Subtract term by term matrix values. | |
Mat4 | operator* (const Mat4 &_rhs) const noexcept |
Multiply matrices. | |
Mat4 | operator/ (const Mat4 &_rhs) const |
Inverse multiply matrices. | |
Vec3< T > | operator* (const Vec3< T > &_rhs) const noexcept |
transform this vector by this matrix. | |
Vec4< T > | operator* (const Vec4< T > &_rhs) const noexcept |
transform this vector by this matrix. | |
template<typename TIn > | |
Mat4 & | operator*= (TIn _scale) noexcept |
Scale each matrix component by _scale. | |
template<typename TIn > | |
Mat4 & | operator/= (TIn _scale) |
Inverse Scale each matrix component by _scale. | |
Mat4 & | operator+= (const Mat4 &_rhs) noexcept |
Add term by term matrix values. | |
Mat4 & | operator-= (const Mat4 &_rhs) noexcept |
Subtract term by term matrix values. | |
Mat4 & | operator*= (const Mat4 &_rhs) noexcept |
Multiply matrices. | |
Mat4 & | operator/= (const Mat4 &_rhs) |
Inverse multiply matrices. | |
Static Public Member Functions | |
static Mat4 | Lerp (const Mat4 &_start, const Mat4 &_end, float _alpha) noexcept |
Clamped Lerp from _start to _end at _alpha. | |
static Mat4 | LerpUnclamped (const Mat4 &_start, const Mat4 &_end, float _alpha) noexcept |
Unclamped Lerp from _start to _end at _alpha. | |
static Mat4 | MakeTranslation (const Vec3< T > &_transl) noexcept |
Make translation matrix from vector3. | |
static Mat4 | MakeRotation (const Quat< T > &_rot) noexcept |
Make rotation matrix from quaternion. | |
static Mat4 | MakeScale (const Vec3< T > &_scale) noexcept |
Make scale matrix from vector3. | |
static Mat4 | MakeLookAt (const Vec3< T > &_eye, const Vec3< T > &_target, const Vec3< T > &_up) |
Make LookAt matrix from center, target and up. | |
static Mat4 | MakeInverseView (const Vec3< T > &_eye, const Vec3< T > &_forward, const Vec3< T > &_up) |
Make view matrix for camera. | |
static Mat4 | MakePerspective (T _fov=T(90.0), T _aspect=T(1.0), T _near=T(0.35), T _far=T(10.0)) noexcept |
Make perspective matrix . | |
Static Public Attributes | |
static const Mat4 | Zero |
Zero Mat4 constant. | |
static const Mat4 | Identity |
Identity Mat4 constant. | |
Matrix 4x4 Sapphire-Maths class.
must be align at 32 for intrinsics.
T | Type of the matrix. |
|
constexprnoexcept |
|
constexprnoexcept |
T & SA::Mat4< T, major >::At | ( | uint32_t | _index | ) |
Getter of Value at index.
[in] | _index | Index to access. |
const T & SA::Mat4< T, major >::At | ( | uint32_t | _index | ) | const |
Const Getter of Value at index.
[in] | _index | Index to access. |
T & SA::Mat4< T, major >::At | ( | uint32_t | _x, |
uint32_t | _y ) |
Getter of Value at (x;y).
[in] | _x | row index. |
[in] | _y | column index. |
const T & SA::Mat4< T, major >::At | ( | uint32_t | _x, |
uint32_t | _y ) const |
Const Getter of Value at (x;y).
[in] | _x | row index. |
[in] | _y | column index. |
|
noexcept |
Const Getter of matrix data
|
noexcept |
Getter of matrix data
|
noexcept |
Compute the determinant of the matrix.
|
constexprnoexcept |
Compare 2 Matrix.
[in] | _other | Other matrix to compare to. |
[in] | _threshold | Allowed threshold to accept equality. |
Mat4 SA::Mat4< T, major >::GetInversed | ( | ) | const |
Inverse this matrix.
|
constexprnoexcept |
Transpose this matrix.
Mat4 & SA::Mat4< T, major >::Inverse | ( | ) |
Inverse this matrix.
|
constexprnoexcept |
Whether this matrix is an identity matrix.
|
constexprnoexcept |
Whether this matrix is a zero matrix.
|
staticnoexcept |
Clamped Lerp from _start to _end at _alpha.
Reference: https://en.wikipedia.org/wiki/Linear_interpolation
_start | Starting point of the lerp. |
_end | Ending point of the lerp. |
_alpha | Alpha of the lerp. |
|
staticnoexcept |
Unclamped Lerp from _start to _end at _alpha.
Reference: https://en.wikipedia.org/wiki/Linear_interpolation
_start | Starting point of the lerp. |
_end | Ending point of the lerp. |
_alpha | Alpha of the lerp. |
|
static |
Make view matrix for camera.
_eye | Camera's world position |
_forward | Camera forward vector |
_up | Camera's up vector. |
Make inverse view matrix for camera.
_eye | Camera's world position |
_forward | Camera forward vector |
_up | Camera's up vector. |
|
static |
Make LookAt matrix from center, target and up.
[in] | _eye | Center (camera). |
[in] | _target | Target to look at. |
[in] | _up | Up vector (camera). |
|
staticnoexcept |
Make perspective matrix .
[in] | _fov | Perspective FOV. |
[in] | _aspect | Aspect ratio (width/height). |
[in] | _near | Near frustum. |
[in] | _far | Far frustum. |
|
staticnoexcept |
Make rotation matrix from quaternion.
[in] | _rot | quaternion to use for rotation. |
|
staticnoexcept |
Make scale matrix from vector3.
[in] | _scale | Vector for scaling. |
|
staticnoexcept |
Make translation matrix from vector3.
[in] | _transl | Vector to translate |
|
constexprnoexcept |
Compare 2 matrix inequality.
[in] | _rhs | Other matrix to compare to. |
|
noexcept |
Multiply matrices.
[in] | _rhs | Matrix to multiply to. |
|
noexcept |
transform this vector by this matrix.
Ignore 4th row/column component.
[in] | _rhs | Vector to transform. |
|
noexcept |
transform this vector by this matrix.
[in] | _rhs | Vector to transform. |
|
noexcept |
Scale each matrix component by _scale.
TIn | Type of the input scale. |
[in] | _scale | Scale value to apply on all components. |
|
noexcept |
Multiply matrices.
[in] | _rhs | Matrix to multiply to. |
|
noexcept |
Scale each matrix component by _scale.
TIn | Type of the input scale. |
[in] | _scale | Scale value to apply on all components. |
|
noexcept |
Add term by term matrix values.
[in] | _rhs | Matrix to add. |
|
noexcept |
Add term by term matrix values.
[in] | _rhs | Matrix to add. |
|
constexprnoexcept |
Getter of the opposite signed matrix.
|
noexcept |
Subtract term by term matrix values.
[in] | _rhs | Matrix to substract. |
|
noexcept |
Subtract term by term matrix values.
[in] | _rhs | Matrix to substract. |
Mat4 SA::Mat4< T, major >::operator/ | ( | const Mat4< T, major > & | _rhs | ) | const |
Inverse multiply matrices.
[in] | _rhs | Matrix to inverse multiply to. |
Mat4 SA::Mat4< T, major >::operator/ | ( | TIn | _scale | ) | const |
Inverse Scale each matrix component by _scale.
TIn | Type of the input scale. |
[in] | _scale | Inverse scale value to apply on all components. |
Mat4 & SA::Mat4< T, major >::operator/= | ( | const Mat4< T, major > & | _rhs | ) |
Inverse multiply matrices.
[in] | _rhs | Matrix to inverse multiply to. |
Mat4 & SA::Mat4< T, major >::operator/= | ( | TIn | _scale | ) |
Inverse Scale each matrix component by _scale.
TIn | Type of the input scale. |
[in] | _scale | Inverse scale value to apply on all components. |
|
noexcept |
|
constexprnoexcept |
Compare 2 matrix equality.
[in] | _rhs | Other matrix to compare to. |
T & SA::Mat4< T, major >::operator[] | ( | uint32_t | _index | ) |
Access operator by index.
[in] | _index | Index to access. |
const T & SA::Mat4< T, major >::operator[] | ( | uint32_t | _index | ) | const |
Const Access operator by index.
[in] | _index | Index to access. |
|
noexcept |
Transpose this matrix.
|
static |
Identity Mat4 constant.
{1, 0, 0, 0} {0, 1, 0, 0} {0, 0, 1, 0} {0, 0, 0, 1}
|
static |
Zero Mat4 constant.
{0, 0, 0, 0} {0, 0, 0, 0} {0, 0, 0, 0} {0, 0, 0, 0}