From 33c357ecc642a8b52da23ab069e5ce05929c5c2a Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 13 Mar 2016 14:57:31 -1000 Subject: [PATCH] ZE_ATHENA_TYPES readers are now explicit-endian --- include/zeus/CAABox.hpp | 8 +++----- include/zeus/CColor.hpp | 21 ++++++++++----------- include/zeus/CMatrix3f.hpp | 12 ++++++++++++ include/zeus/CQuaternion.hpp | 6 +++++- include/zeus/CVector2f.hpp | 9 +++------ include/zeus/CVector3f.hpp | 9 ++++----- include/zeus/CVector4f.hpp | 14 +++++--------- 7 files changed, 42 insertions(+), 37 deletions(-) diff --git a/include/zeus/CAABox.hpp b/include/zeus/CAABox.hpp index 3524ee3..4cdb6e0 100644 --- a/include/zeus/CAABox.hpp +++ b/include/zeus/CAABox.hpp @@ -62,12 +62,10 @@ public: { } #if ZE_ATHENA_TYPES - CAABox(athena::io::IStreamReader& in) {readBoundingBox(in);} - - inline void readBoundingBox(athena::io::IStreamReader& in) + inline void readBoundingBoxBig(athena::io::IStreamReader& in) { - m_min = CVector3f(in); - m_max = CVector3f(in); + m_min.readBig(in); + m_max.readBig(in); } #endif diff --git a/include/zeus/CColor.hpp b/include/zeus/CColor.hpp index fd1d641..f803440 100644 --- a/include/zeus/CColor.hpp +++ b/include/zeus/CColor.hpp @@ -57,7 +57,6 @@ public: 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; } #if ZE_ATHENA_TYPES - CColor(athena::io::IStreamReader& reader) {readRGBA(reader);} CColor(const atVec4f& vec) #if __SSE__ || __GEKKO_PS__ : mVec128(vec.mVec128){} @@ -75,19 +74,19 @@ public: CColor& operator=(const CVector4f& other); #if ZE_ATHENA_TYPES - inline void readRGBA(athena::io::IStreamReader& reader) + inline void readRGBABig(athena::io::IStreamReader& reader) { - r = reader.readFloat(); - g = reader.readFloat(); - b = reader.readFloat(); - a = reader.readFloat(); + r = reader.readFloatBig(); + g = reader.readFloatBig(); + b = reader.readFloatBig(); + a = reader.readFloatBig(); } - inline void readBGRA(athena::io::IStreamReader& reader) + inline void readBGRABig(athena::io::IStreamReader& reader) { - b = reader.readFloat(); - g = reader.readFloat(); - r = reader.readFloat(); - a = reader.readFloat(); + b = reader.readFloatBig(); + g = reader.readFloatBig(); + r = reader.readFloatBig(); + a = reader.readFloatBig(); } #endif diff --git a/include/zeus/CMatrix3f.hpp b/include/zeus/CMatrix3f.hpp index 39bd7fc..881de85 100644 --- a/include/zeus/CMatrix3f.hpp +++ b/include/zeus/CMatrix3f.hpp @@ -59,6 +59,18 @@ public: vec[2].x = r2.vec[0]; vec[2].y = r2.vec[1]; vec[2].z = r2.vec[2]; #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 CMatrix3f(const CVector3f& axis, float angle); CMatrix3f(const CQuaternion& quat); diff --git a/include/zeus/CQuaternion.hpp b/include/zeus/CQuaternion.hpp index 9ef3c1f..d342d06 100644 --- a/include/zeus/CQuaternion.hpp +++ b/include/zeus/CQuaternion.hpp @@ -25,7 +25,11 @@ public: CQuaternion(float x, float y, float z) { fromVector3f(CVector3f(x, y, z)); } CQuaternion(float r, const CVector3f& vec) : v(vec){ this->r = r;} #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) { #if __SSE__ diff --git a/include/zeus/CVector2f.hpp b/include/zeus/CVector2f.hpp index ff71227..85bfbc2 100644 --- a/include/zeus/CVector2f.hpp +++ b/include/zeus/CVector2f.hpp @@ -68,16 +68,13 @@ public: return ret; } - void read(athena::io::IStreamReader& input) + void readBig(athena::io::IStreamReader& input) { - x = input.readFloat(); - y = input.readFloat(); + x = input.readFloatBig(); + y = input.readFloatBig(); v[2] = 0.0f; v[3] = 0.0f; } - - CVector2f(athena::io::IStreamReader& input) - { read(input); } #endif CVector2f(float xy) {splat(xy);} diff --git a/include/zeus/CVector3f.hpp b/include/zeus/CVector3f.hpp index 4ef0d22..4817f92 100644 --- a/include/zeus/CVector3f.hpp +++ b/include/zeus/CVector3f.hpp @@ -66,14 +66,13 @@ public: return ret; } - void read(athena::io::IStreamReader& input) + void readBig(athena::io::IStreamReader& input) { - x = input.readFloat(); - y = input.readFloat(); - z = input.readFloat(); + x = input.readFloatBig(); + y = input.readFloatBig(); + z = input.readFloatBig(); v[3] = 0.0f; } - CVector3f(athena::io::IStreamReader& input) {read(input);} #endif CVector3f(float xyz) {splat(xyz);} diff --git a/include/zeus/CVector4f.hpp b/include/zeus/CVector4f.hpp index b054d0f..5de4c76 100644 --- a/include/zeus/CVector4f.hpp +++ b/include/zeus/CVector4f.hpp @@ -68,17 +68,13 @@ public: return ret; } - void read(athena::io::IStreamReader& input) + void readBig(athena::io::IStreamReader& input) { - x = input.readFloat(); - y = input.readFloat(); - z = input.readFloat(); - w = input.readFloat(); + x = input.readFloatBig(); + y = input.readFloatBig(); + z = input.readFloatBig(); + w = input.readFloatBig(); } - - CVector4f(athena::io::IStreamReader& input) - { read(input); } - #endif CVector4f(float xyzw) {splat(xyzw);}