From 3a25f59adbf9219c565d8c343f80ad0b09104f8b Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Wed, 29 Jul 2015 14:59:03 -0700 Subject: [PATCH] * Add Athena vector types --- CTransform.hpp | 4 ++-- CVector2f.hpp | 10 ++++++++++ CVector3f.hpp | 10 ++++++++++ CVector4f.hpp | 11 +++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/CTransform.hpp b/CTransform.hpp index cd2de4b..36c220e 100644 --- a/CTransform.hpp +++ b/CTransform.hpp @@ -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));} diff --git a/CVector2f.hpp b/CVector2f.hpp index 47f961f..7f07c6a 100644 --- a/CVector2f.hpp +++ b/CVector2f.hpp @@ -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;} diff --git a/CVector3f.hpp b/CVector3f.hpp index ab23e3e..d4e7383 100644 --- a/CVector3f.hpp +++ b/CVector3f.hpp @@ -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;} diff --git a/CVector4f.hpp b/CVector4f.hpp index 934d76b..dbd10bf 100644 --- a/CVector4f.hpp +++ b/CVector4f.hpp @@ -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)