diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-15 01:29:24 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-15 01:29:24 +0000 |
commit | 685b33980cc7a346574b24732464f0cbe3115a1f (patch) | |
tree | 048db87ad645f54285f0880d20b8acf81f65fea9 /ui | |
parent | Send position and rotation matrix to GPU separately (diff) | |
download | ilt-685b33980cc7a346574b24732464f0cbe3115a1f.tar.bz2 ilt-685b33980cc7a346574b24732464f0cbe3115a1f.tar.xz ilt-685b33980cc7a346574b24732464f0cbe3115a1f.zip |
Switch to millimeters for spatial units
Mostly a case of changing far too many magic numbers, something else to
fix I guess. I probably missed something. Also there's some hackery when
loading 3D models, which are still assumed to be in metres.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gameMainWindow.cpp | 2 | ||||
-rw-r--r-- | ui/manualCameraController.cpp | 4 | ||||
-rw-r--r-- | ui/manualCameraController.h | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/ui/gameMainWindow.cpp b/ui/gameMainWindow.cpp index 15f1e07..7cf143a 100644 --- a/ui/gameMainWindow.cpp +++ b/ui/gameMainWindow.cpp @@ -31,7 +31,7 @@ public: GameMainWindow::GameMainWindow(size_t w, size_t h) : Window {w, h, "I Like Trains", SDL_WINDOW_OPENGL}, SceneRenderer {Window::size, 0} { - uiComponents.create<ManualCameraController>(Position2D {-1150, -1150}); + uiComponents.create<ManualCameraController>(Position2D {-1150000, -1150000}); auto gms = uiComponents.create<GameMainSelector>(&camera, ScreenAbsCoord {w, h}); uiComponents.create<GameMainToolbar>(gms.get()); } diff --git a/ui/manualCameraController.cpp b/ui/manualCameraController.cpp index 05c1fc5..f6993a8 100644 --- a/ui/manualCameraController.cpp +++ b/ui/manualCameraController.cpp @@ -59,12 +59,12 @@ ManualCameraController::handleInput(const SDL_Event & e, const Position &) pitch = std::clamp(pitch - 0.01F * static_cast<float>(e.motion.yrel), 0.1F, half_pi); } else { - focus += rotate_flat(-direction) * Position2D {-e.motion.xrel, e.motion.yrel}; + focus += rotate_flat(-direction) * (Position2D {-e.motion.xrel, e.motion.yrel} * dist / 2.0F); } } return true; case SDL_MOUSEWHEEL: - dist = std::clamp(dist - static_cast<float>(e.wheel.y) * 4.F, 5.F, 200.F); + dist = std::clamp(dist - static_cast<float>(e.wheel.y) * 400.F, 5.F, 200000.F); break; } return false; diff --git a/ui/manualCameraController.h b/ui/manualCameraController.h index 46655bc..1efaee1 100644 --- a/ui/manualCameraController.h +++ b/ui/manualCameraController.h @@ -22,5 +22,5 @@ private: bool ctrl {false}, mrb {false}; Position2D focus; float direction {quarter_pi}; - float dist {40}, pitch {quarter_pi}; + float dist {4000}, pitch {quarter_pi}; }; |