Make vectors and quaternions implicitly convertible to athena vectors

This commit is contained in:
Jack Andersen 2018-02-23 20:16:08 -10:00
parent 5282ae6308
commit 527b503bd7
4 changed files with 17 additions and 70 deletions

View File

@ -61,31 +61,13 @@ public:
#endif #endif
} }
operator atVec4f() operator atVec4f&()
{ {
atVec4f ret; return *reinterpret_cast<atVec4f*>(v);
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec[0] = w;
ret.vec[1] = x;
ret.vec[2] = y;
ret.vec[3] = z;
#endif
return ret;
} }
operator atVec4f() const operator const atVec4f&() const
{ {
atVec4f ret; return *reinterpret_cast<const atVec4f*>(v);
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec[0] = w;
ret.vec[1] = x;
ret.vec[2] = y;
ret.vec[3] = z;
#endif
return ret;
} }
#endif #endif
@ -218,6 +200,7 @@ public:
{ {
float w, x, y, z; float w, x, y, z;
}; };
float v[4];
}; };
static const CQuaternion skNoRotation; static const CQuaternion skNoRotation;

View File

@ -52,25 +52,13 @@ public:
} }
#endif #endif
operator atVec2f() operator atVec2f&()
{ {
atVec2f ret; return *reinterpret_cast<atVec2f*>(v);
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec = v;
#endif
return ret;
} }
operator atVec2f() const operator const atVec2f&() const
{ {
atVec2f ret; return *reinterpret_cast<const atVec2f*>(v);
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec = v;
#endif
return ret;
} }
void readBig(athena::io::IStreamReader& input) void readBig(athena::io::IStreamReader& input)

View File

@ -50,25 +50,13 @@ public:
} }
#endif #endif
operator atVec3f() operator atVec3f&()
{ {
atVec3f ret; return *reinterpret_cast<atVec3f*>(v);
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec = v;
#endif
return ret;
} }
operator atVec3f() const operator const atVec3f&() const
{ {
atVec3f ret; return *reinterpret_cast<const atVec3f*>(v);
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec = v;
#endif
return ret;
} }
void readBig(athena::io::IStreamReader& input) void readBig(athena::io::IStreamReader& input)

View File

@ -48,25 +48,13 @@ public:
} }
#endif #endif
operator atVec4f() operator atVec4f&()
{ {
atVec4f ret; return *reinterpret_cast<atVec4f*>(v);
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec = v;
#endif
return ret;
} }
operator atVec4f() const operator const atVec4f&() const
{ {
atVec4f ret; return *reinterpret_cast<const atVec4f*>(v);
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec = v;
#endif
return ret;
} }
void readBig(athena::io::IStreamReader& input) void readBig(athena::io::IStreamReader& input)