3PL_ALWAYS_INLINE plSimdMat4f::plSimdMat4f() =
default;
6 float f2r3,
float f3r3,
float f4r3,
float f1r4,
float f2r4,
float f3r4,
float f4r4)
9 res.m_col0.Set(f1r1, f1r2, f1r3, f1r4);
10 res.m_col1.Set(f2r1, f2r2, f2r3, f2r4);
11 res.m_col2.Set(f3r1, f3r2, f3r3, f3r4);
12 res.m_col3.Set(f4r1, f4r2, f4r3, f4r4);
29 res.m_col0.Load<4>(pData + 0);
30 res.m_col1.Load<4>(pData + 4);
31 res.m_col2.Load<4>(pData + 8);
32 res.m_col3.Load<4>(pData + 12);
40 res.m_col0.Load<4>(pData + 0);
41 res.m_col1.Load<4>(pData + 4);
42 res.m_col2.Load<4>(pData + 8);
43 res.m_col3.Load<4>(pData + 12);
56 tmp.m_col0.Store<4>(out_pData + 0);
57 tmp.m_col1.Store<4>(out_pData + 4);
58 tmp.m_col2.Store<4>(out_pData + 8);
59 tmp.m_col3.Store<4>(out_pData + 12);
75 res.m_col0.Set(1, 0, 0, 0);
76 res.m_col1.Set(0, 1, 0, 0);
77 res.m_col2.Set(0, 0, 1, 0);
78 res.m_col3.Set(0, 0, 0, 1);
98 return (m_col0.IsEqual(rhs.m_col0, fEpsilon) && m_col1.IsEqual(rhs.m_col1, fEpsilon) && m_col2.IsEqual(rhs.m_col2, fEpsilon) &&
99 m_col3.IsEqual(rhs.m_col3, fEpsilon))
105 return (m_col0.IsEqual(
plSimdVec4f(1, 0, 0, 0), fEpsilon) && m_col1.IsEqual(
plSimdVec4f(0, 1, 0, 0), fEpsilon) &&
112 return m_col0.IsValid<4>() && m_col1.IsValid<4>() && m_col2.IsValid<4>() && m_col3.IsValid<4>();
117 return m_col0.IsNaN<4>() || m_col1.IsNaN<4>() || m_col2.IsNaN<4>() || m_col3.IsNaN<4>();
135 ref_vRow0 = tmp.m_col0;
136 ref_vRow1 = tmp.m_col1;
137 ref_vRow2 = tmp.m_col2;
138 ref_vRow3 = tmp.m_col3;
144 result = m_col0 * v.x();
145 result += m_col1 * v.y();
146 result += m_col2 * v.z();
155 result = m_col0 * v.x();
156 result += m_col1 * v.y();
157 result += m_col2 * v.z();
166 result.m_col0 = m_col0 * rhs.m_col0.x();
167 result.m_col0 += m_col1 * rhs.m_col0.y();
168 result.m_col0 += m_col2 * rhs.m_col0.z();
169 result.m_col0 += m_col3 * rhs.m_col0.w();
171 result.m_col1 = m_col0 * rhs.m_col1.x();
172 result.m_col1 += m_col1 * rhs.m_col1.y();
173 result.m_col1 += m_col2 * rhs.m_col1.z();
174 result.m_col1 += m_col3 * rhs.m_col1.w();
176 result.m_col2 = m_col0 * rhs.m_col2.x();
177 result.m_col2 += m_col1 * rhs.m_col2.y();
178 result.m_col2 += m_col2 * rhs.m_col2.z();
179 result.m_col2 += m_col3 * rhs.m_col2.w();
181 result.m_col3 = m_col0 * rhs.m_col3.x();
182 result.m_col3 += m_col1 * rhs.m_col3.y();
183 result.m_col3 += m_col2 * rhs.m_col3.z();
184 result.m_col3 += m_col3 * rhs.m_col3.w();
189PL_ALWAYS_INLINE
void plSimdMat4f::operator*=(
const plSimdMat4f& rhs)
194PL_ALWAYS_INLINE
bool plSimdMat4f::operator==(
const plSimdMat4f& other)
const
196 return (m_col0 == other.m_col0 && m_col1 == other.m_col1 && m_col2 == other.m_col2 && m_col3 == other.m_col3).AllSet<4>();
199PL_ALWAYS_INLINE
bool plSimdMat4f::operator!=(
const plSimdMat4f& other)
const
201 return !(*
this == other);
A 4x4 matrix class.
Definition SimdMat4f.h:7
static plSimdMat4f MakeFromRowMajorArray(const float *const pData)
Creates a matrix from 16 values that are in row-major layout.
Definition SimdMat4f_inl.h:26
plSimdMat4f GetInverse(const plSimdFloat &fEpsilon=plMath::SmallEpsilon< float >()) const
Returns the inverse of this matrix.
Definition SimdMat4f_inl.h:89
static plSimdMat4f MakeFromColumns(const plSimdVec4f &vCol0, const plSimdVec4f &vCol1, const plSimdVec4f &vCol2, const plSimdVec4f &vCol3)
Creates a matrix from 4 column vectors.
Definition SimdMat4f_inl.h:16
bool IsValid() const
Checks whether all components are finite numbers.
Definition SimdMat4f_inl.h:110
bool IsNaN() const
Checks whether any component is NaN.
Definition SimdMat4f_inl.h:115
plResult Invert(const plSimdFloat &fEpsilon=plMath::SmallEpsilon< float >())
Inverts this matrix. Return value indicates whether the matrix could be inverted.
Definition SimdMat4f.cpp:8
static plSimdMat4f MakeFromColumnMajorArray(const float *const pData)
Creates a matrix from 16 values that are in column-major layout.
Definition SimdMat4f_inl.h:37
static plSimdMat4f MakeFromValues(float f1r1, float f2r1, float f3r1, float f4r1, float f1r2, float f2r2, float f3r2, float f4r2, float f1r3, float f2r3, float f3r3, float f4r3, float f1r4, float f2r4, float f3r4, float f4r4)
Creates a matrix from 16 values. Naming is "column-n row-m".
Definition SimdMat4f_inl.h:5
plSimdMat4f GetTranspose() const
Returns the transpose of this matrix.
Definition SimdMat4f_inl.h:82
void Transpose()
Transposes this matrix.
Definition FPUMat4f_inl.h:3
plSimdVec4f TransformPosition(const plSimdVec4f &v) const
Matrix-vector multiplication, assuming the 4th component of the vector is one (default behavior).
Definition SimdMat4f_inl.h:141
bool IsIdentity(const plSimdFloat &fEpsilon=plMath::DefaultEpsilon< float >()) const
Checks whether this is an identity matrix.
Definition SimdMat4f_inl.h:103
plSimdVec4f TransformDirection(const plSimdVec4f &v) const
Matrix-vector multiplication, assuming the 4th component of the vector is zero. So,...
Definition SimdMat4f_inl.h:152
static plSimdMat4f MakeZero()
Returns a zero matrix.
Definition SimdMat4f_inl.h:62
static plSimdMat4f MakeIdentity()
Returns an identity matrix.
Definition SimdMat4f_inl.h:72
bool IsEqual(const plSimdMat4f &rhs, const plSimdFloat &fEpsilon) const
Equality Check with epsilon.
Definition SimdMat4f_inl.h:96
A 4-component SIMD vector class.
Definition SimdVec4f.h:8
Enum
Definition Declarations.h:65
@ RowMajor
The matrix is stored in row-major format.
Definition Declarations.h:66
PL_ALWAYS_INLINE void IgnoreResult()
Used to silence compiler warnings, when success or failure doesn't matter.
Definition Types.h:69