diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-03-05 19:40:27 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-03-05 19:40:27 +0000 |
commit | c1dd444fded1b1c24e4df723e5a48d104ec2d03c (patch) | |
tree | 8b48db6180bf09a107b5cf256e080c4f33917e7b | |
parent | Template rotations and add one for 2D rotation matrix (diff) | |
download | ilt-c1dd444fded1b1c24e4df723e5a48d104ec2d03c.tar.bz2 ilt-c1dd444fded1b1c24e4df723e5a48d104ec2d03c.tar.xz ilt-c1dd444fded1b1c24e4df723e5a48d104ec2d03c.zip |
Fixing manual camera scrolling, now just a matrix multiplication
-rw-r--r-- | gfx/manualCameraController.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/gfx/manualCameraController.cpp b/gfx/manualCameraController.cpp index e29ea36..21eefc8 100644 --- a/gfx/manualCameraController.cpp +++ b/gfx/manualCameraController.cpp @@ -47,9 +47,7 @@ ManualCameraController::handleInput(SDL_Event & e) pitch = std::clamp(pitch - 0.01F * e.motion.yrel, 0.1F, half_pi); } else { - const auto sc {sincosf(direction)}; - focus.x += sc.x * e.motion.yrel + sc.x * e.motion.xrel; - focus.y += sc.x * -e.motion.xrel + sc.x * e.motion.yrel; + focus += rotate_flat(-direction) * glm::vec2 {e.motion.xrel, e.motion.yrel}; } } return true; |