diff options
| author | Patrick Schönberger | 2021-01-20 12:36:20 +0100 |
|---|---|---|
| committer | Patrick Schönberger | 2021-01-20 12:36:20 +0100 |
| commit | 8107e994b24112c5bce75a8ae57d0680e5f9161a (patch) | |
| tree | ed4f859ca84cb3c519e138fa8d0509cb30095149 /src/main.cpp | |
| parent | e0d16bd9729430be4e1b46fda97db1759f7acf33 (diff) | |
| download | subsurface_scattering-8107e994b24112c5bce75a8ae57d0680e5f9161a.tar.gz subsurface_scattering-8107e994b24112c5bce75a8ae57d0680e5f9161a.zip | |
Default Values
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/main.cpp b/src/main.cpp index f3f19e3..1440f04 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) {
@@ -406,9 +393,17 @@ int main() { 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();
|
