Enable atdna for CQuaternion

This commit is contained in:
Phillip Stephens 2016-01-17 14:40:48 -08:00
parent 6256903a4d
commit 8c801b26b8
1 changed files with 33 additions and 0 deletions

View File

@ -14,6 +14,9 @@ namespace Zeus
{ {
class alignas(16) CQuaternion class alignas(16) CQuaternion
{ {
#if __atdna__ && ZE_ATHENA_TYPES
float clangVec __attribute__((__vector_size__(16)));
#endif
public: public:
ZE_DECLARE_ALIGNED_ALLOCATOR(); ZE_DECLARE_ALIGNED_ALLOCATOR();
@ -23,6 +26,36 @@ public:
CQuaternion(float r, const CVector3f& vec) : v(vec){ this->r = r;} CQuaternion(float r, const CVector3f& vec) : v(vec){ this->r = r;}
#if ZE_ATHENA_TYPES #if ZE_ATHENA_TYPES
CQuaternion(Athena::io::IStreamReader& input) { r = input.readFloat(); v = CVector3f(input);} CQuaternion(Athena::io::IStreamReader& input) { r = input.readFloat(); v = CVector3f(input);}
CQuaternion(const atVec4f& vec)
{
#if __SSE__
v.mVec128 = vec.mVec128;
#else
x = vec.vec[0]; y = vec.vec[1]; z = vec.vec[2]; r = vec.vec[3];
#endif
}
operator atVec4f()
{
atVec4f ret;
#if __SSE__
ret.mVec128 = v.mVec128;
#else
ret.vec = v;
#endif
return ret;
}
operator atVec4f() const
{
atVec4f ret;
#if __SSE__
ret.mVec128 = v.mVec128;
#else
ret.vec = v;
#endif
return ret;
}
#endif #endif
CQuaternion(const CVector3f& vec) { fromVector3f(vec); } CQuaternion(const CVector3f& vec) { fromVector3f(vec); }
CQuaternion(const CVector4f& vec) CQuaternion(const CVector4f& vec)