Change CQuaternion to use a CVector3f for the non-w coordinates

Former-commit-id: c9e5e494e0
This commit is contained in:
Henrique Gemignani Passos Lima 2022-11-04 14:33:59 +02:00
parent 9fbf5962f5
commit 2bbe0fcd20
1 changed files with 7 additions and 12 deletions

View File

@ -12,7 +12,7 @@ class CNUQuaternion;
class CQuaternion { class CQuaternion {
public: public:
CQuaternion(float w, float x, float y, float z) : w(w), x(x), y(y), z(z) {} CQuaternion(float w, float x, float y, float z) : w(w), imaginary(x, y, z) {}
// __ct__11CQuaternionFfRC9CVector3f // __ct__11CQuaternionFfRC9CVector3f
// CQuaternion(const CQuaternion& other) // CQuaternion(const CQuaternion& other)
@ -53,7 +53,7 @@ public:
// double x = -this->x; // double x = -this->x;
// double y = -this->y; // double y = -this->y;
// double z = -this->z; // double z = -this->z;
return CQuaternion(w, -x, -y, -z); return CQuaternion(w, -imaginary.GetX(), -imaginary.GetY(), -imaginary.GetZ());
} }
static CQuaternion FromMatrixRows(const CVector3f&, const CVector3f&, const CVector3f&); static CQuaternion FromMatrixRows(const CVector3f&, const CVector3f&, const CVector3f&);
@ -68,19 +68,14 @@ public:
} }
float GetW() const { return w; } float GetW() const { return w; }
float GetX() const { return x; } float GetX() const { return imaginary.GetX(); }
float GetY() const { return y; } float GetY() const { return imaginary.GetY(); }
float GetZ() const { return z; } float GetZ() const { return imaginary.GetZ(); }
const CVector3f& GetImaginary() const { const CVector3f& GetImaginary() const { return imaginary; }
// TODO: hack! has a Vector3f field?
return *reinterpret_cast<const CVector3f*>(&x);
}
private: private:
float w; float w;
float x; CVector3f imaginary;
float y;
float z;
static const CQuaternion sNoRotation; static const CQuaternion sNoRotation;
}; };