diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-12-11 14:22:57 +0000 |
---|---|---|
committer | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2022-12-12 09:17:38 +0000 |
commit | 379b07fa1fb953cc175028fcb95dfbb64c392451 (patch) | |
tree | a299bb5118612a308f2404638e24d3b4184a78d7 /gfx/followCameraController.cpp | |
parent | Fix case of GetViewProjection (diff) | |
download | ilt-379b07fa1fb953cc175028fcb95dfbb64c392451.tar.bz2 ilt-379b07fa1fb953cc175028fcb95dfbb64c392451.tar.xz ilt-379b07fa1fb953cc175028fcb95dfbb64c392451.zip |
Make Camera members private with accessors and helpful setters
Diffstat (limited to 'gfx/followCameraController.cpp')
-rw-r--r-- | gfx/followCameraController.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/gfx/followCameraController.cpp b/gfx/followCameraController.cpp index 42d1666..d15ecda 100644 --- a/gfx/followCameraController.cpp +++ b/gfx/followCameraController.cpp @@ -20,20 +20,16 @@ FollowCameraController::updateCamera(Camera * camera) const switch (mode) { case Mode::Pan: - camera->forward = glm::normalize(pos - camera->pos); - camera->up = up; + camera->lookAt(pos); break; case Mode::Ride: - camera->pos = pos + (up * 4.8F); - camera->forward = !-sincosf(rot.y); - camera->up = up; + camera->setView(pos + (up * 4.8F), !-sincosf(rot.y)); break; case Mode::ISO: - camera->pos = pos + ((up + north + east) * 40.F); - camera->forward = glm::normalize(down + south + west); - camera->up = glm::normalize(up - north - east); + camera->setView(pos + ((up + north + east) * 40.F), glm::normalize(down + south + west), + glm::normalize(up - north - east)); break; } } |