mirror of
https://github.com/AxioDL/zeus.git
synced 2025-12-09 05:27:56 +00:00
Bulk-run of clang-format
This commit is contained in:
@@ -12,19 +12,19 @@ CMatrix3f::CMatrix3f(const CQuaternion& quat)
|
||||
float x2 = nq.x * nq.x;
|
||||
float y2 = nq.y * nq.y;
|
||||
float z2 = nq.z * nq.z;
|
||||
|
||||
|
||||
m[0][0] = 1.0 - 2.0 * y2 - 2.0 * z2;
|
||||
m[1][0] = 2.0 * nq.x * nq.y - 2.0 * nq.z * nq.w;
|
||||
m[2][0] = 2.0 * nq.x * nq.z + 2.0 * nq.y * nq.w;
|
||||
|
||||
|
||||
m[0][1] = 2.0 * nq.x * nq.y + 2.0 * nq.z * nq.w;
|
||||
m[1][1] = 1.0 - 2.0 * x2 - 2.0 * z2;
|
||||
m[2][1] = 2.0 * nq.y * nq.z - 2.0 * nq.x * nq.w;
|
||||
|
||||
|
||||
m[0][2] = 2.0 * nq.x * nq.z - 2.0 * nq.y * nq.w;
|
||||
m[1][2] = 2.0 * nq.y * nq.z + 2.0 * nq.x * nq.w;
|
||||
m[2][2] = 1.0 - 2.0 * x2 - 2.0 * y2;
|
||||
|
||||
|
||||
m[0][3] = 0.0f;
|
||||
m[1][3] = 0.0f;
|
||||
m[2][3] = 0.0f;
|
||||
@@ -48,15 +48,15 @@ void CMatrix3f::transpose()
|
||||
vec[2].mVec128 = _mm_movelh_ps(T1, T3);
|
||||
#else
|
||||
float tmp;
|
||||
|
||||
|
||||
tmp = m[0][1];
|
||||
m[0][1] = m[1][0];
|
||||
m[1][0] = tmp;
|
||||
|
||||
|
||||
tmp = m[0][2];
|
||||
m[0][2] = m[2][0];
|
||||
m[2][0] = tmp;
|
||||
|
||||
|
||||
tmp = m[1][2];
|
||||
m[1][2] = m[2][1];
|
||||
m[2][1] = tmp;
|
||||
@@ -77,45 +77,36 @@ CMatrix3f CMatrix3f::transposed() const
|
||||
#else
|
||||
CMatrix3f ret(*this);
|
||||
float tmp;
|
||||
|
||||
|
||||
tmp = ret.m[0][1];
|
||||
ret.m[0][1] = ret.m[1][0];
|
||||
ret.m[1][0] = tmp;
|
||||
|
||||
|
||||
tmp = m[0][2];
|
||||
ret.m[0][2] = ret.m[2][0];
|
||||
ret.m[2][0] = tmp;
|
||||
|
||||
|
||||
tmp = m[1][2];
|
||||
ret.m[1][2] = ret.m[2][1];
|
||||
ret.m[2][1] = tmp;
|
||||
|
||||
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
CMatrix3f CMatrix3f::inverted() const
|
||||
{
|
||||
float det =
|
||||
m[0][0] * m[1][1] * m[2][2] +
|
||||
m[1][0] * m[2][1] * m[0][2] +
|
||||
m[2][0] * m[0][1] * m[1][2] -
|
||||
m[0][2] * m[1][1] * m[2][0] -
|
||||
m[1][2] * m[2][1] * m[0][0] -
|
||||
m[2][2] * m[0][1] * m[1][0];
|
||||
|
||||
float det = m[0][0] * m[1][1] * m[2][2] + m[1][0] * m[2][1] * m[0][2] + m[2][0] * m[0][1] * m[1][2] -
|
||||
m[0][2] * m[1][1] * m[2][0] - m[1][2] * m[2][1] * m[0][0] - m[2][2] * m[0][1] * m[1][0];
|
||||
|
||||
if (det == 0.0)
|
||||
return CMatrix3f();
|
||||
|
||||
|
||||
det = 1.0f / det;
|
||||
return CMatrix3f((m[1][1]*m[2][2] - m[1][2]*m[2][1]) * det,
|
||||
-(m[1][0]*m[2][2] - m[1][2]*m[2][0]) * det,
|
||||
(m[1][0]*m[2][1] - m[1][1]*m[2][0]) * det,
|
||||
-(m[0][1]*m[2][2] - m[0][2]*m[2][1]) * det,
|
||||
(m[0][0]*m[2][2] - m[0][2]*m[2][0]) * det,
|
||||
-(m[0][0]*m[2][1] - m[0][1]*m[2][0]) * det,
|
||||
(m[0][1]*m[1][2] - m[0][2]*m[1][1]) * det,
|
||||
-(m[0][0]*m[1][2] - m[0][2]*m[1][0]) * det,
|
||||
(m[0][0]*m[1][1] - m[0][1]*m[1][0]) * det);
|
||||
return CMatrix3f((m[1][1] * m[2][2] - m[1][2] * m[2][1]) * det, -(m[1][0] * m[2][2] - m[1][2] * m[2][0]) * det,
|
||||
(m[1][0] * m[2][1] - m[1][1] * m[2][0]) * det, -(m[0][1] * m[2][2] - m[0][2] * m[2][1]) * det,
|
||||
(m[0][0] * m[2][2] - m[0][2] * m[2][0]) * det, -(m[0][0] * m[2][1] - m[0][1] * m[2][0]) * det,
|
||||
(m[0][1] * m[1][2] - m[0][2] * m[1][1]) * det, -(m[0][0] * m[1][2] - m[0][2] * m[1][0]) * det,
|
||||
(m[0][0] * m[1][1] - m[0][1] * m[1][0]) * det);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user