mirror of
https://github.com/AxioDL/zeus.git
synced 2025-12-18 01:15:38 +00:00
Various optimizations
This commit is contained in:
@@ -30,33 +30,6 @@ CMatrix3f::CMatrix3f(const CQuaternion& quat)
|
||||
m[2][3] = 0.0f;
|
||||
}
|
||||
|
||||
CMatrix3f operator*(const CMatrix3f& lhs, const CMatrix3f& rhs)
|
||||
{
|
||||
#if __SSE__
|
||||
unsigned i;
|
||||
TVectorUnion resVec[3];
|
||||
for (i=0 ; i<3 ; ++i) {
|
||||
resVec[i].mVec128 =
|
||||
_mm_add_ps(_mm_add_ps(
|
||||
_mm_mul_ps(lhs[0].mVec128, ze_splat_ps(rhs[i].mVec128, 0)),
|
||||
_mm_mul_ps(lhs[1].mVec128, ze_splat_ps(rhs[i].mVec128, 1))),
|
||||
_mm_mul_ps(lhs[2].mVec128, ze_splat_ps(rhs[i].mVec128, 2)));
|
||||
resVec[i].v[3] = 0.0;
|
||||
}
|
||||
return CMatrix3f(resVec[0].mVec128, resVec[1].mVec128, resVec[2].mVec128);
|
||||
#else
|
||||
return CMatrix3f(lhs[0][0] * rhs[0][0] + lhs[1][0] * rhs[0][1] + lhs[2][0] * rhs[0][2],
|
||||
lhs[0][0] * rhs[1][0] + lhs[1][0] * rhs[1][1] + lhs[2][0] * rhs[1][2],
|
||||
lhs[0][0] * rhs[2][0] + lhs[1][0] * rhs[2][1] + lhs[2][0] * rhs[2][2],
|
||||
lhs[0][1] * rhs[0][0] + lhs[1][1] * rhs[0][1] + lhs[2][1] * rhs[0][2],
|
||||
lhs[0][1] * rhs[1][0] + lhs[1][1] * rhs[1][1] + lhs[2][1] * rhs[1][2],
|
||||
lhs[0][1] * rhs[2][0] + lhs[1][1] * rhs[2][1] + lhs[2][1] * rhs[2][2],
|
||||
lhs[0][2] * rhs[0][0] + lhs[1][2] * rhs[0][1] + lhs[2][2] * rhs[0][2],
|
||||
lhs[0][2] * rhs[1][0] + lhs[1][2] * rhs[1][1] + lhs[2][2] * rhs[1][2],
|
||||
lhs[0][2] * rhs[2][0] + lhs[1][2] * rhs[2][1] + lhs[2][2] * rhs[2][2]);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CMatrix3f::transpose()
|
||||
{
|
||||
#if __SSE__
|
||||
|
||||
@@ -64,7 +64,7 @@ void detectCPU()
|
||||
}
|
||||
|
||||
|
||||
const CPUInfo cpuFeatures() { return g_cpuFeatures; }
|
||||
const CPUInfo& cpuFeatures() { return g_cpuFeatures; }
|
||||
|
||||
namespace Math
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user