diff --git a/.Jules/palette.md b/.Jules/palette.md index 5025a48..bbaacae 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -7,6 +7,11 @@ ## 2024-10-25 - Window Title as Status Bar **Learning:** In C++ windowed applications without an overlay UI (like ImGui), the window title is the only persistent feedback mechanism. Moving state indicators (Denoiser ON/OFF, FOV) to the title provides immediate visibility without cluttering the console. **Action:** When working on native apps, check if the window title can be utilized for status feedback if no GUI is present. + ## 2024-05-21 - Immediate Feedback in Native Apps **Learning:** In native applications (GLFW), state changes triggered by input callbacks often lack immediate visual feedback if the UI update is tied to a main loop timer. **Action:** Always call UI update functions directly from input callbacks for state toggles, rather than waiting for the next scheduled refresh. + +## 2024-10-27 - Safety Net Pattern +**Learning:** in 3D navigation environments, users can easily become disoriented or drift too far. A "Safety Net" action (Reset to Default) is a critical accessibility feature that restores confidence and control. +**Action:** Always implement a quick "Reset View" action (e.g., 'R' key) in 3D applications to help users recover from disorientation. diff --git a/src/Camera.cpp b/src/Camera.cpp index 8534f3e..c29da22 100644 --- a/src/Camera.cpp +++ b/src/Camera.cpp @@ -12,6 +12,20 @@ Camera::Camera(float fov, float aspectRatio, float nearPlane, float farPlane) yaw = -90.0f; pitch = -10.0f; // Look down 10 degrees + // Capture initial state + initialPosition = position; + initialYaw = yaw; + initialPitch = pitch; + initialFov = fov; + + updateCameraVectors(); +} + +void Camera::reset() { + position = initialPosition; + yaw = initialYaw; + pitch = initialPitch; + fov = initialFov; updateCameraVectors(); } diff --git a/src/Camera.h b/src/Camera.h index f747d90..152db8e 100644 --- a/src/Camera.h +++ b/src/Camera.h @@ -35,9 +35,17 @@ class Camera { float mouseSensitivity = 0.1f; float fov; + void reset(); + private: void updateCameraVectors(); + // Initial state + glm::vec3 initialPosition; + float initialYaw; + float initialPitch; + float initialFov; + // Camera position and orientation glm::vec3 position; glm::vec3 front; diff --git a/src/main.cpp b/src/main.cpp index 3503741..5f783de 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -188,9 +188,6 @@ class RacingEngine { AsyncLogger logger; // UX State Tracking - float currentFPS = 0.0f; - float frameTimeMs = 0.0f; - void updateWindowTitle() { glm::vec3 pos = camera.getPosition(); char title[512]; @@ -225,6 +222,7 @@ class RacingEngine { std::cout << "GLFW window created successfully!\n"; std::cout << "Camera controls: WASD - move, QE - up/down, Mouse - look, Shift - faster\n"; std::cout << " TAB - toggle cursor lock, Scroll - zoom (FOV)\n"; + std::cout << " R - Reset Camera\n"; std::cout << "Press D to toggle AI Denoiser (Tensor Cores)\n"; } @@ -299,6 +297,14 @@ class RacingEngine { if (key == GLFW_KEY_D && action == GLFW_RELEASE) { engine->denoiserKeyPressed = false; } + + // R key to reset camera + if (key == GLFW_KEY_R && action == GLFW_PRESS) { + engine->camera.reset(); + engine->accumulationFrames = 0; // Reset accumulation immediately + engine->logger.log("\n[CAMERA] Reset to default view\n"); + engine->updateWindowTitle(); + } } void initVulkan() {