Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
14 changes: 14 additions & 0 deletions src/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
8 changes: 8 additions & 0 deletions src/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 9 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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";
}

Expand Down Expand Up @@ -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() {
Expand Down