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
}
operator atVec4f()
operator atVec4f&()
{
atVec4f ret;
#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;
return *reinterpret_cast<atVec4f*>(v);
}
operator atVec4f() const
operator const atVec4f&() const
{
atVec4f ret;
#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;
return *reinterpret_cast<const atVec4f*>(v);
}
#endif
@ -218,6 +200,7 @@ public:
{
float w, x, y, z;
};
float v[4];
};
static const CQuaternion skNoRotation;

View File

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

View File

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

View File

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