From 1fef25a740644a2119e88448c6603d44042efa14 Mon Sep 17 00:00:00 2001 From: Leonardo Zide Date: Thu, 15 Aug 2019 17:41:32 -0700 Subject: [PATCH] Added distance parameter to SetAngles. --- common/camera.cpp | 4 ++-- common/camera.h | 2 +- common/view.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/camera.cpp b/common/camera.cpp index a4159618..1480aa77 100644 --- a/common/camera.cpp +++ b/common/camera.cpp @@ -1027,7 +1027,7 @@ void lcCamera::SetViewpoint(const lcVector3& Position) UpdatePosition(1); } -void lcCamera::SetAngles(float Latitude, float Longitude) +void lcCamera::SetAngles(float Latitude, float Longitude, float Distance) { mPosition = lcVector3(0, -1, 0); mTargetPosition = lcVector3(0, 0, 0); @@ -1038,7 +1038,7 @@ void lcCamera::SetAngles(float Latitude, float Longitude) lcVector3 SideVector = lcMul(lcVector3(-1, 0, 0), LongitudeMatrix); lcMatrix33 LatitudeMatrix = lcMatrix33FromAxisAngle(SideVector, LC_DTOR * Latitude); - mPosition = lcMul(mPosition, LatitudeMatrix); + mPosition = lcMul(mPosition, LatitudeMatrix) * Distance; mUpVector = lcMul(mUpVector, LatitudeMatrix); ChangeKey(mPositionKeys, mPosition, 1, false); diff --git a/common/camera.h b/common/camera.h index c5969573..fc1a988f 100644 --- a/common/camera.h +++ b/common/camera.h @@ -287,7 +287,7 @@ public: void SetViewpoint(lcViewpoint Viewpoint); void SetViewpoint(const lcVector3& Position); void GetAngles(float& Latitude, float& Longitude, float& Distance) const; - void SetAngles(float Latitude, float Longitude); + void SetAngles(float Latitude, float Longitude, float Distance); char m_strName[81]; diff --git a/common/view.cpp b/common/view.cpp index caba14f0..ff9c1c58 100644 --- a/common/view.cpp +++ b/common/view.cpp @@ -367,7 +367,7 @@ void View::SetCameraAngles(float Latitude, float Longitude) mCamera->CopySettings(OldCamera); } - mCamera->SetAngles(Latitude, Longitude); + mCamera->SetAngles(Latitude, Longitude, 1.0f); ZoomExtents(); Redraw(); }