]> git.localhorst.tv Git - blobs.git/blobdiff - src/app/states.cpp
spherical planets
[blobs.git] / src / app / states.cpp
index 49ee8e23ac1793b88709cb6862fcb42d2d08a01c..92879b4683bc724a5cbd23e35d1bc973cdbb9d0c 100644 (file)
@@ -24,6 +24,8 @@ MasterState::MasterState(Assets &assets, world::Simulation &sim) noexcept
 , cam_orient(PI * 0.375, PI * 0.25, 0.0)
 , cam_dragging(false)
 , cp(assets)
+, rp(sim)
+, tp(sim)
 , remain(0)
 , thirds(0)
 , paused(false) {
@@ -107,7 +109,7 @@ void MasterState::OnMouseMotion(const SDL_MouseMotionEvent &e) {
        constexpr double pitch_scale = PI * 0.001;
        constexpr double yaw_scale = PI * 0.002;
        if (cam_dragging) {
-               cam_orient.x = glm::clamp(cam_orient.x + double(e.yrel) * pitch_scale, 0.0, PI * 0.5);
+               cam_orient.x = glm::clamp(cam_orient.x + double(e.yrel) * pitch_scale, 0.0, PI * 0.499);
                cam_orient.y = std::fmod(cam_orient.y + double(e.xrel) * yaw_scale, PI * 2.0);
        }
 }
@@ -192,7 +194,9 @@ void MasterState::OnRender(graphics::Viewport &viewport) {
        }
 
        viewport.ClearDepth();
-       cp.Draw(assets, viewport);
+       cp.Draw(viewport);
+       rp.Draw(viewport);
+       tp.Draw(viewport);
 }
 
 }