* Add Athena vector types

This commit is contained in:
Phillip Stephens 2015-07-29 14:59:03 -07:00
parent 829cf51c37
commit 3a25f59adb
4 changed files with 33 additions and 2 deletions

View File

@ -10,11 +10,11 @@ class ZE_ALIGN(16) CTransform
{
public:
ZE_DECLARE_ALIGNED_ALLOCATOR();
CTransform() : m_basis(false) {}
CTransform(const CMatrix3f& basis, const CVector3f& offset=CVector3f::skZero) :
m_basis(basis), m_origin(offset) {}
inline CTransform operator*(const CTransform& rhs) const
{return CTransform(m_basis * rhs.m_basis, m_origin + (m_basis * rhs.m_origin));}

View File

@ -17,6 +17,16 @@ class ZE_ALIGN(16) CVector2f
inline CVector2f() {zeroOut();}
#if __SSE__
CVector2f(const __m128& mVec128) : mVec128(mVec128) {v[2] = 0.0f; v[3] = 0.0f;}
#endif
#if ZE_ATHENA_TYPES
CVector2f(const atVec2f& vec)
#if __SSE__
: mVec128(vec.mVec128){}
#else
{
x = vec.vec[0], y = vec.vec[1], v[2] = 0.0f, v[3] = 0.0f;
}
#endif
#endif
CVector2f(float xy) {splat(xy);}
CVector2f(float x, float y) {v[0] = x; v[1] = y; v[2] = 0; v[3] = 0.0;}

View File

@ -16,6 +16,16 @@ public:
inline CVector3f() {zeroOut();}
#if __SSE__
CVector3f(const __m128& mVec128) : mVec128(mVec128) {v[3] = 0.0f;}
#endif
#if ZE_ATHENA_TYPES
CVector3f(const atVec3f& vec)
#if __SSE__
: mVec128(vec.mVec128){}
#else
{
x = vec.vec[0], y = vec.vec[1], z = vec.vec[2], v[3] = 0.0f;
}
#endif
#endif
CVector3f(float xyz) {splat(xyz);}
CVector3f(float x, float y, float z) {v[0] = x; v[1] = y; v[2] = z; v[3] = 0.0;}

View File

@ -18,6 +18,17 @@ class ZE_ALIGN(16) CVector4f
#if __SSE__
CVector4f(const __m128& mVec128) : mVec128(mVec128) {}
#endif
#if ZE_ATHENA_TYPES
CVector4f(const atVec4f& vec)
#if __SSE__
: mVec128(vec.mVec128){}
#else
{
x = vec.vec[0], y = vec.vec[1], z = vec.vec[2], w = vec.vec[3];
}
#endif
#endif
CVector4f(float xyzw) {splat(xyzw);}
CVector4f(float x, float y, float z, float w) {v[0] = x; v[1] = y; v[2] = z; v[3] = w;}
CVector4f(Athena::io::IStreamReader& input)