From 21ce0a4b28a1842dad91433362d250089ec491b8 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 31 May 2020 17:05:49 +0200 Subject: CAutomobile done --- src/math/Matrix.h | 14 ++++++++++---- src/math/math.cpp | 6 ++++++ 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'src/math') diff --git a/src/math/Matrix.h b/src/math/Matrix.h index 1d26cc20..90f66d7a 100644 --- a/src/math/Matrix.h +++ b/src/math/Matrix.h @@ -130,13 +130,18 @@ public: { float *pFloatMatrix = (float*)&m_matrix; for (int i = 0; i < 3; i++) -#ifdef FIX_BUGS // BUGFIX from VC for (int j = 0; j < 3; j++) -#else - for (int j = 0; j < 4; j++) -#endif pFloatMatrix[i * 4 + j] *= scale; } + void Scale(float sx, float sy, float sz) + { + float *pFloatMatrix = (float*)&m_matrix; + for (int i = 0; i < 3; i++){ + pFloatMatrix[i * 4 + 0] *= sx; + pFloatMatrix[i * 4 + 1] *= sy; + pFloatMatrix[i * 4 + 2] *= sz; + } + } void SetRotateXOnly(float angle){ @@ -224,6 +229,7 @@ public: void SetRotate(float xAngle, float yAngle, float zAngle); void Rotate(float x, float y, float z); void RotateX(float x); + void RotateY(float y); void RotateZ(float z); void Reorthogonalise(void); diff --git a/src/math/math.cpp b/src/math/math.cpp index e11d048c..e8b459ae 100644 --- a/src/math/math.cpp +++ b/src/math/math.cpp @@ -46,6 +46,12 @@ CMatrix::RotateX(float x) Rotate(x, 0.0f, 0.0f); } +void +CMatrix::RotateY(float y) +{ + Rotate(0.0f, y, 0.0f); +} + void CMatrix::RotateZ(float z) { -- cgit v1.2.3