From a5ba53896881ec479f9819ab0349437de4c3f4ed Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 23 Jun 2019 13:11:41 +0200 Subject: some Radar and Hud cleanup; fix in Physical --- src/math/Rect.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/math') diff --git a/src/math/Rect.h b/src/math/Rect.h index d0824987..fd1bd05e 100644 --- a/src/math/Rect.h +++ b/src/math/Rect.h @@ -26,4 +26,20 @@ public: if(v.y < top) top = v.y; if(v.y > bottom) bottom = v.y; } + + void Translate(float x, float y){ + left += x; + right += x; + bottom += y; + top += y; + } + void Grow(float r){ + left -= r; + right += r; + top -= r; + bottom += r; + } + + float GetWidth(void) { return right - left; } + float GetHeight(void) { return bottom - top; } }; -- cgit v1.2.3 From 1e09bf9c30094b4387431be4842876181a1425fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Mon, 24 Jun 2019 17:57:54 +0300 Subject: CPed, CVehicle, mostly entering/exiting car MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: eray orçunus --- src/math/Matrix.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/math') diff --git a/src/math/Matrix.h b/src/math/Matrix.h index a93de636..74e3d70d 100644 --- a/src/math/Matrix.h +++ b/src/math/Matrix.h @@ -145,6 +145,30 @@ public: m_matrix.pos.y = 0.0f; m_matrix.pos.z = 0.0f; } + void SetRotate(float xAngle, float yAngle, float zAngle) { + float cX = cos(xAngle); + float sX = sin(xAngle); + float cY = cos(yAngle); + float sY = sin(yAngle); + float cZ = cos(zAngle); + float sZ = sin(zAngle); + + m_matrix.right.x = cZ * cY - (sZ * sX) * sY; + m_matrix.right.y = (cZ * sX) * sY + sZ * cY; + m_matrix.right.z = -cX * sY; + + m_matrix.up.x = -sZ * cX; + m_matrix.up.y = cZ * cX; + m_matrix.up.z = sX; + + m_matrix.at.x = (sZ * sX) * cY + cZ * sY; + m_matrix.at.y = sZ * sY - (cZ * sX) * cY; + m_matrix.at.z = cX * cY; + + m_matrix.pos.x = 0.0f; + m_matrix.pos.y = 0.0f; + m_matrix.pos.z = 0.0f; + } void Reorthogonalise(void){ CVector &r = *GetRight(); CVector &f = *GetForward(); -- cgit v1.2.3