X-Git-Url: https://gitweb.ps.run/subsurface_scattering/blobdiff_plain/e0d16bd9729430be4e1b46fda97db1759f7acf33..524432970b5aaee6e6dbc6162111dbe1e9fd0749:/src/main.cpp diff --git a/src/main.cpp b/src/main.cpp index f3f19e3..b95cc97 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -64,7 +64,7 @@ private: struct freecam { glm::vec3 pos = glm::vec3(0, 0, -1); - glm::vec2 rot; + glm::vec2 rot = glm::vec2(0, 0); void update(sf::Window &window) { int mouseDeltaX = sf::Mouse::getPosition(window).x - window.getSize().x / 2; @@ -108,7 +108,7 @@ struct freecam { } private: - glm::vec3 forward; + glm::vec3 forward = glm::vec3(0, 0, 1); glm::vec3 up = glm::vec3(0, 1, 0); const float angleFactor = 200; @@ -117,7 +117,7 @@ private: struct arccam { - glm::vec2 rot; + glm::vec2 rot = glm::vec2(0, 0); float radius = 1; void update(sf::Window &window) { @@ -312,19 +312,6 @@ int main() { case keys::Escape: running = false; break; - case keys::F: - options.freecam = !options.freecam; - break; - case keys::R: - if (options.freecam) { - freeCam.pos = glm::vec3(0, 0, -1); - freeCam.rot = glm::vec2(0); - } - else { - arcCam.rot = glm::vec2(0); - arcCam.radius = 1; - } - break; } } else if (event.type == sf::Event::EventType::MouseWheelScrolled) { if (! options.freecam) { @@ -402,13 +389,21 @@ int main() { ImGui::Begin("Options"); ImGui::Checkbox("Wireframe", &options.wireframe); - ImGui::Checkbox("Free Cam (F)", &options.freecam); + ImGui::Checkbox("Free Cam", &options.freecam); if (options.freecam) { ImGui::LabelText("Position", "%f %f %f", freeCam.pos.x, freeCam.pos.y, freeCam.pos.z); ImGui::LabelText("Rotation", "%f %f", freeCam.rot.x, freeCam.rot.y); + if (ImGui::Button("Reset")) { + freeCam.pos = glm::vec3(0, 0, -1); + freeCam.rot = glm::vec2(0); + } } else { ImGui::LabelText("Rotation", "%f %f", arcCam.rot.x, arcCam.rot.y); ImGui::InputFloat("Radius", &arcCam.radius); + if (ImGui::Button("Reset")) { + arcCam.rot = glm::vec2(0); + arcCam.radius = 1; + } } ImGui::End(); @@ -418,4 +413,4 @@ int main() { } return 0; -} \ No newline at end of file +}