From 3b3d9f9362dc477cf412a717068e1384bd2cb01a Mon Sep 17 00:00:00 2001 From: Pascal <engelerp@phys.ethz.ch> Date: Wed, 26 Jul 2023 13:55:12 +0200 Subject: [PATCH] Added MoveTo --- gui/include/camera_arcball.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gui/include/camera_arcball.hpp b/gui/include/camera_arcball.hpp index f4c51f0..38e5790 100644 --- a/gui/include/camera_arcball.hpp +++ b/gui/include/camera_arcball.hpp @@ -125,6 +125,13 @@ public: UpdateViewMatrix(); } + void MoveTo(glm::vec2 pos_new) { + glm::vec3 translation{ pos_new.x - m_lookAt.x, pos_new.y - m_lookAt.y, 0.f }; + m_eye += translation; + m_lookAt += translation; + UpdateViewMatrix(); + } + private: glm::mat4 m_viewMatrix; glm::vec3 m_eye; -- GitLab