diff --git a/include/zeus/CVector2f.hpp b/include/zeus/CVector2f.hpp index 2925a88..466f60d 100644 --- a/include/zeus/CVector2f.hpp +++ b/include/zeus/CVector2f.hpp @@ -94,7 +94,7 @@ public: { v[0] = x; v[1] = y; - v[2] = 0; + v[2] = 0.0f; v[3] = 0.0f; } CVector2f(float x, float y) { assign(x, y); } @@ -313,14 +313,7 @@ public: inline void zeroOut() { -#if __SSE__ - mVec128 = _mm_xor_ps(mVec128, mVec128); -#else - v[0] = 0.0; - v[1] = 0.0; - v[2] = 0.0; - v[3] = 0.0; -#endif + *this = CVector2f::skZero; } inline void splat(float xy) diff --git a/include/zeus/CVector3d.hpp b/include/zeus/CVector3d.hpp index 3c5468b..1c24e58 100644 --- a/include/zeus/CVector3d.hpp +++ b/include/zeus/CVector3d.hpp @@ -58,7 +58,6 @@ public: v[0] = x; v[1] = y; v[2] = z; - v[3] = 0.0; #endif } @@ -140,15 +139,7 @@ public: void zeroOut() { -#if __SSE__ - _mm_xor_pd(mVec128[0], mVec128[0]); - _mm_xor_pd(mVec128[1], mVec128[1]); -#else - v[0] = 0.0; - v[1] = 0.0; - v[2] = 0.0; - v[3] = 0.0; -#endif + *this = skZero; } inline CVector3d operator+(const CVector3d& rhs) const @@ -203,6 +194,8 @@ public: __m128d mVec128[2]; #endif }; + + static const CVector3d skZero; }; static inline CVector3d operator+(double lhs, const CVector3d& rhs) diff --git a/include/zeus/CVector3f.hpp b/include/zeus/CVector3f.hpp index eb8b3c6..3f217eb 100644 --- a/include/zeus/CVector3f.hpp +++ b/include/zeus/CVector3f.hpp @@ -317,14 +317,7 @@ public: inline void zeroOut() { -#if __SSE__ - mVec128 = _mm_xor_ps(mVec128, mVec128); -#else - v[0] = 0.0; - v[1] = 0.0; - v[2] = 0.0; - v[3] = 0.0; -#endif + *this = CVector3f::skZero; } inline void splat(float xyz) diff --git a/include/zeus/CVector4f.hpp b/include/zeus/CVector4f.hpp index 74bea97..81e82fc 100644 --- a/include/zeus/CVector4f.hpp +++ b/include/zeus/CVector4f.hpp @@ -347,14 +347,7 @@ public: inline void zeroOut() { -#if __SSE__ - mVec128 = _mm_xor_ps(mVec128, mVec128); -#else - v[0] = 0.0; - v[1] = 0.0; - v[2] = 0.0; - v[3] = 0.0; -#endif + *this = CVector4f::skZero; } inline void splat(float xyzw) diff --git a/src/CVector2f.cpp b/src/CVector2f.cpp index 210cd5f..3aea9ef 100644 --- a/src/CVector2f.cpp +++ b/src/CVector2f.cpp @@ -8,7 +8,7 @@ namespace zeus { const CVector2f CVector2f::skOne = CVector2f(1.0); const CVector2f CVector2f::skNegOne = CVector2f(-1.0); -const CVector2f CVector2f::skZero; +const CVector2f CVector2f::skZero(0.f, 0.f); float CVector2f::getAngleDiff(const CVector2f& a, const CVector2f& b) { diff --git a/src/CVector3f.cpp b/src/CVector3f.cpp index 4a9146f..d055e8b 100644 --- a/src/CVector3f.cpp +++ b/src/CVector3f.cpp @@ -18,6 +18,7 @@ const CVector3f CVector3f::skUp(0.f, 0.f, 1.f); const CVector3f CVector3f::skDown(0.f, 0.f, -1.f); const CVector3f CVector3f::skRadToDegVec(180.0f / M_PIF); const CVector3f CVector3f::skDegToRadVec(M_PIF / 180.0f); +const CVector3d CVector3d::skZero(0.0, 0.0, 0.0); CVector3f::CVector3f(const CVector3d& vec) { diff --git a/src/CVector4f.cpp b/src/CVector4f.cpp index 5d062a6..92af313 100644 --- a/src/CVector4f.cpp +++ b/src/CVector4f.cpp @@ -3,6 +3,8 @@ namespace zeus { +const CVector4f CVector4f::skZero(0.f, 0.f, 0.f, 0.f); + CVector4f::CVector4f(const zeus::CColor& other) : x(other.r), y(other.g), z(other.b), w(other.a) {} CVector4f& CVector4f::operator=(const CColor& other)