From b1ad84be00b9a88af0a9e087f5d5b724a8b3077d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 1 Jan 2024 19:58:06 +0000 Subject: Remove more use of legacy types from camera controller --- ui/manualCameraController.cpp | 5 +++-- ui/manualCameraController.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ui/manualCameraController.cpp b/ui/manualCameraController.cpp index ef26e81..a55b9cc 100644 --- a/ui/manualCameraController.cpp +++ b/ui/manualCameraController.cpp @@ -59,7 +59,8 @@ ManualCameraController::handleInput(const SDL_Event & e, const Position &) pitch = std::clamp(pitch - 0.01F * static_cast(e.motion.yrel), 0.1F, half_pi); } else { - focus += rotate_flat(-direction) * (Position2D {-e.motion.xrel, e.motion.yrel} * dist / 2.0F); + focus += rotate_flat(-direction) + * (RelativePosition2D {-e.motion.xrel, e.motion.yrel} * dist / 2.0F); } } return true; @@ -79,5 +80,5 @@ void ManualCameraController::updateCamera(Camera * camera) const { const auto forward = glm::normalize(sincosf(direction) || -sin(pitch)); - camera->setView((focus || 0.F) - forward * 3.F * std::pow(dist, 1.3F), forward); + camera->setView((focus || 0) - GlobalPosition3D(forward * 3.F * std::pow(dist, 1.3F)), forward); } diff --git a/ui/manualCameraController.h b/ui/manualCameraController.h index 1efaee1..2f955e7 100644 --- a/ui/manualCameraController.h +++ b/ui/manualCameraController.h @@ -11,7 +11,7 @@ class Camera; class ManualCameraController : public CameraController, public UIComponent { public: - explicit ManualCameraController(Position2D f) : UIComponent {{}}, focus {f} { } + explicit ManualCameraController(GlobalPosition2D f) : UIComponent {{}}, focus {f} { } bool handleInput(const SDL_Event & e, const Position &) override; void render(const UIShader &, const Position & parentPos) const override; @@ -20,7 +20,7 @@ public: private: bool ctrl {false}, mrb {false}; - Position2D focus; + GlobalPosition2D focus; float direction {quarter_pi}; float dist {4000}, pitch {quarter_pi}; }; -- cgit v1.2.3