Added skZero for other vector types

This commit is contained in:
Jack Andersen 2017-03-17 13:30:14 -10:00
parent f1e3db1c50
commit 8603353cf7
7 changed files with 11 additions and 36 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)