summaryrefslogtreecommitdiffstats
path: root/src/math/Matrix.h
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-07-08 21:37:47 +0200
committeraap <aap@papnet.eu>2019-07-08 21:37:47 +0200
commit2ae112fdf6b90bb4435dba34bcc2a23604e1e158 (patch)
tree5137e9ee1d2b01cd1a125409f1cb23a92a142d9f /src/math/Matrix.h
parentlittle changes; one more function of CAutomobile (diff)
downloadre3-2ae112fdf6b90bb4435dba34bcc2a23604e1e158.tar
re3-2ae112fdf6b90bb4435dba34bcc2a23604e1e158.tar.gz
re3-2ae112fdf6b90bb4435dba34bcc2a23604e1e158.tar.bz2
re3-2ae112fdf6b90bb4435dba34bcc2a23604e1e158.tar.lz
re3-2ae112fdf6b90bb4435dba34bcc2a23604e1e158.tar.xz
re3-2ae112fdf6b90bb4435dba34bcc2a23604e1e158.tar.zst
re3-2ae112fdf6b90bb4435dba34bcc2a23604e1e158.zip
Diffstat (limited to '')
-rw-r--r--src/math/Matrix.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/math/Matrix.h b/src/math/Matrix.h
index eda75e4a..b7d6c207 100644
--- a/src/math/Matrix.h
+++ b/src/math/Matrix.h
@@ -82,6 +82,32 @@ public:
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 SetTranslate(float x, float y, float z){
+ m_matrix.right.x = 1.0f;
+ m_matrix.right.y = 0.0f;
+ m_matrix.right.z = 0.0f;
+
+ m_matrix.up.x = 0.0f;
+ m_matrix.up.y = 1.0f;
+ m_matrix.up.z = 0.0f;
+
+ m_matrix.at.x = 0.0f;
+ m_matrix.at.y = 0.0f;
+ m_matrix.at.z = 1.0f;
+
+ m_matrix.pos.x = x;
+ m_matrix.pos.y = y;
+ m_matrix.pos.z = z;
+ }
+ void SetTranslate(const CVector &trans){ SetTranslate(trans.x, trans.y, trans.z); }
+ void Translate(float x, float y, float z){
+ m_matrix.pos.x += x;
+ m_matrix.pos.y += y;
+ m_matrix.pos.z += z;
+ }
+ void Translate(const CVector &trans){ Translate(trans.x, trans.y, trans.z); }
+
void SetScale(float s){
m_matrix.right.x = s;
m_matrix.right.y = 0.0f;
@@ -99,6 +125,7 @@ public:
m_matrix.pos.y = 0.0f;
m_matrix.pos.z = 0.0f;
}
+
void SetRotateXOnly(float angle){
float c = cos(angle);
float s = sin(angle);