ZE_ATHENA_TYPES readers are now explicit-endian

This commit is contained in:
Jack Andersen 2016-03-13 14:57:31 -10:00
parent 8154c82d78
commit 33c357ecc6
7 changed files with 42 additions and 37 deletions

View File

@ -62,12 +62,10 @@ public:
{ {
} }
#if ZE_ATHENA_TYPES #if ZE_ATHENA_TYPES
CAABox(athena::io::IStreamReader& in) {readBoundingBox(in);} inline void readBoundingBoxBig(athena::io::IStreamReader& in)
inline void readBoundingBox(athena::io::IStreamReader& in)
{ {
m_min = CVector3f(in); m_min.readBig(in);
m_max = CVector3f(in); m_max.readBig(in);
} }
#endif #endif

View File

@ -57,7 +57,6 @@ public:
CColor(float rgb, float a = 1.0) { splat(rgb, a); } CColor(float rgb, float a = 1.0) { splat(rgb, a); }
CColor(float r, float g, float b, float a = 1.0f) {v[0] = r; v[1] = g; v[2] = b; v[3] = a; } CColor(float r, float g, float b, float a = 1.0f) {v[0] = r; v[1] = g; v[2] = b; v[3] = a; }
#if ZE_ATHENA_TYPES #if ZE_ATHENA_TYPES
CColor(athena::io::IStreamReader& reader) {readRGBA(reader);}
CColor(const atVec4f& vec) CColor(const atVec4f& vec)
#if __SSE__ || __GEKKO_PS__ #if __SSE__ || __GEKKO_PS__
: mVec128(vec.mVec128){} : mVec128(vec.mVec128){}
@ -75,19 +74,19 @@ public:
CColor& operator=(const CVector4f& other); CColor& operator=(const CVector4f& other);
#if ZE_ATHENA_TYPES #if ZE_ATHENA_TYPES
inline void readRGBA(athena::io::IStreamReader& reader) inline void readRGBABig(athena::io::IStreamReader& reader)
{ {
r = reader.readFloat(); r = reader.readFloatBig();
g = reader.readFloat(); g = reader.readFloatBig();
b = reader.readFloat(); b = reader.readFloatBig();
a = reader.readFloat(); a = reader.readFloatBig();
} }
inline void readBGRA(athena::io::IStreamReader& reader) inline void readBGRABig(athena::io::IStreamReader& reader)
{ {
b = reader.readFloat(); b = reader.readFloatBig();
g = reader.readFloat(); g = reader.readFloatBig();
r = reader.readFloat(); r = reader.readFloatBig();
a = reader.readFloat(); a = reader.readFloatBig();
} }
#endif #endif

View File

@ -59,6 +59,18 @@ public:
vec[2].x = r2.vec[0]; vec[2].y = r2.vec[1]; vec[2].z = r2.vec[2]; vec[2].x = r2.vec[0]; vec[2].y = r2.vec[1]; vec[2].z = r2.vec[2];
#endif #endif
} }
void readBig(athena::io::IStreamReader& input)
{
m[0][0] = input.readFloatBig();
m[1][0] = input.readFloatBig();
m[2][0] = input.readFloatBig();
m[0][1] = input.readFloatBig();
m[1][1] = input.readFloatBig();
m[2][1] = input.readFloatBig();
m[0][2] = input.readFloatBig();
m[1][2] = input.readFloatBig();
m[2][2] = input.readFloatBig();
}
#endif #endif
CMatrix3f(const CVector3f& axis, float angle); CMatrix3f(const CVector3f& axis, float angle);
CMatrix3f(const CQuaternion& quat); CMatrix3f(const CQuaternion& quat);

View File

@ -25,7 +25,11 @@ public:
CQuaternion(float x, float y, float z) { fromVector3f(CVector3f(x, y, z)); } CQuaternion(float x, float y, float z) { fromVector3f(CVector3f(x, y, z)); }
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);} inline void readBig(athena::io::IStreamReader& input)
{
r = input.readFloatBig();
v.readBig(input);
}
CQuaternion(const atVec4f& vec) CQuaternion(const atVec4f& vec)
{ {
#if __SSE__ #if __SSE__

View File

@ -68,16 +68,13 @@ public:
return ret; return ret;
} }
void read(athena::io::IStreamReader& input) void readBig(athena::io::IStreamReader& input)
{ {
x = input.readFloat(); x = input.readFloatBig();
y = input.readFloat(); y = input.readFloatBig();
v[2] = 0.0f; v[2] = 0.0f;
v[3] = 0.0f; v[3] = 0.0f;
} }
CVector2f(athena::io::IStreamReader& input)
{ read(input); }
#endif #endif
CVector2f(float xy) {splat(xy);} CVector2f(float xy) {splat(xy);}

View File

@ -66,14 +66,13 @@ public:
return ret; return ret;
} }
void read(athena::io::IStreamReader& input) void readBig(athena::io::IStreamReader& input)
{ {
x = input.readFloat(); x = input.readFloatBig();
y = input.readFloat(); y = input.readFloatBig();
z = input.readFloat(); z = input.readFloatBig();
v[3] = 0.0f; v[3] = 0.0f;
} }
CVector3f(athena::io::IStreamReader& input) {read(input);}
#endif #endif
CVector3f(float xyz) {splat(xyz);} CVector3f(float xyz) {splat(xyz);}

View File

@ -68,17 +68,13 @@ public:
return ret; return ret;
} }
void read(athena::io::IStreamReader& input) void readBig(athena::io::IStreamReader& input)
{ {
x = input.readFloat(); x = input.readFloatBig();
y = input.readFloat(); y = input.readFloatBig();
z = input.readFloat(); z = input.readFloatBig();
w = input.readFloat(); w = input.readFloatBig();
} }
CVector4f(athena::io::IStreamReader& input)
{ read(input); }
#endif #endif
CVector4f(float xyzw) {splat(xyzw);} CVector4f(float xyzw) {splat(xyzw);}