summaryrefslogtreecommitdiffstats
path: root/src/math/Matrix.h
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-07-08 17:07:34 +0200
committeraap <aap@papnet.eu>2019-07-08 17:07:34 +0200
commitedf5ac2626ce17b74037281aa3c9730902b4b1d4 (patch)
treedd3a4838a06a887af9e01d43d70d4c6a9307e24c /src/math/Matrix.h
parentcleaned up patching of virtual functions; started CAutomobile (diff)
downloadre3-edf5ac2626ce17b74037281aa3c9730902b4b1d4.tar
re3-edf5ac2626ce17b74037281aa3c9730902b4b1d4.tar.gz
re3-edf5ac2626ce17b74037281aa3c9730902b4b1d4.tar.bz2
re3-edf5ac2626ce17b74037281aa3c9730902b4b1d4.tar.lz
re3-edf5ac2626ce17b74037281aa3c9730902b4b1d4.tar.xz
re3-edf5ac2626ce17b74037281aa3c9730902b4b1d4.tar.zst
re3-edf5ac2626ce17b74037281aa3c9730902b4b1d4.zip
Diffstat (limited to 'src/math/Matrix.h')
-rw-r--r--src/math/Matrix.h46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/math/Matrix.h b/src/math/Matrix.h
index 5cc7d12f..eda75e4a 100644
--- a/src/math/Matrix.h
+++ b/src/math/Matrix.h
@@ -78,10 +78,10 @@ public:
return *this;
}
- CVector *GetPosition(void){ return (CVector*)&m_matrix.pos; }
- CVector *GetRight(void) { return (CVector*)&m_matrix.right; }
- CVector *GetForward(void) { return (CVector*)&m_matrix.up; }
- CVector *GetUp(void) { return (CVector*)&m_matrix.at; }
+ CVector &GetPosition(void){ return *(CVector*)&m_matrix.pos; }
+ CVector &GetRight(void) { return *(CVector*)&m_matrix.right; }
+ CVector &GetForward(void) { return *(CVector*)&m_matrix.up; }
+ CVector &GetUp(void) { return *(CVector*)&m_matrix.at; }
void SetScale(float s){
m_matrix.right.x = s;
m_matrix.right.y = 0.0f;
@@ -190,9 +190,9 @@ public:
m_matrix.pos.z = 0.0f;
}
void Reorthogonalise(void){
- CVector &r = *GetRight();
- CVector &f = *GetForward();
- CVector &u = *GetUp();
+ CVector &r = GetRight();
+ CVector &f = GetForward();
+ CVector &u = GetUp();
u = CrossProduct(r, f);
u.Normalise();
r = CrossProduct(f, u);
@@ -327,24 +327,24 @@ class CCompressedMatrixNotAligned
public:
void CompressFromFullMatrix(CMatrix &other)
{
- m_rightX = 127.0f * other.GetRight()->x;
- m_rightY = 127.0f * other.GetRight()->y;
- m_rightZ = 127.0f * other.GetRight()->z;
- m_upX = 127.0f * other.GetForward()->x;
- m_upY = 127.0f * other.GetForward()->y;
- m_upZ = 127.0f * other.GetForward()->z;
- m_vecPos = *other.GetPosition();
+ m_rightX = 127.0f * other.GetRight().x;
+ m_rightY = 127.0f * other.GetRight().y;
+ m_rightZ = 127.0f * other.GetRight().z;
+ m_upX = 127.0f * other.GetForward().x;
+ m_upY = 127.0f * other.GetForward().y;
+ m_upZ = 127.0f * other.GetForward().z;
+ m_vecPos = other.GetPosition();
}
void DecompressIntoFullMatrix(CMatrix &other)
{
- other.GetRight()->x = m_rightX / 127.0f;
- other.GetRight()->y = m_rightY / 127.0f;
- other.GetRight()->z = m_rightZ / 127.0f;
- other.GetForward()->x = m_upX / 127.0f;
- other.GetForward()->y = m_upY / 127.0f;
- other.GetForward()->z = m_upZ / 127.0f;
- *other.GetUp() = CrossProduct(*other.GetRight(), *other.GetForward());
- *other.GetPosition() = m_vecPos;
+ other.GetRight().x = m_rightX / 127.0f;
+ other.GetRight().y = m_rightY / 127.0f;
+ other.GetRight().z = m_rightZ / 127.0f;
+ other.GetForward().x = m_upX / 127.0f;
+ other.GetForward().y = m_upY / 127.0f;
+ other.GetForward().z = m_upZ / 127.0f;
+ other.GetUp() = CrossProduct(other.GetRight(), other.GetForward());
+ other.GetPosition() = m_vecPos;
other.Reorthogonalise();
}
-}; \ No newline at end of file
+};