Skip to content

Commit 6f4183c

Browse files
committed
Detail transition to quaternions
1 parent c48b5b5 commit 6f4183c

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

TODO.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,26 @@ Get input handling working and validate the camera math before touching the shad
7070

7171
Once CPU-side camera is working:
7272

73-
- [ ] Add camera fields to `ShaderConstants` (cam_pos, cam_dir, cam_fov, etc.)
74-
- [ ] Modify shader to construct `Camera` from `ShaderConstants` instead of hardcoded values
73+
- [x] Add camera fields to `ShaderConstants` (cam_pos, cam_dir, cam_fov, etc.)
74+
- [x] Modify shader to construct `Camera` from `ShaderConstants` instead of hardcoded values
7575
- [ ] Remove or bypass per-scene camera construction
7676

77+
### Phase 3: Fix gimbal lock crash
78+
79+
Camera crashes when looking straight up or down due to `vup` being parallel to view direction.
80+
81+
**Stage 1: Add `vup` to data path**
82+
- [ ] Add `vup: [f32; 3]` to `ShaderConstants`
83+
- [ ] Pass `vup` through to `CameraParams` and `Camera::new()`
84+
- [ ] Host computes `vup` dynamically (switch reference vector when pitch > 45°)
85+
- [ ] Validate fix: full vertical range without crash
86+
87+
**Stage 2: Switch host to quaternions**
88+
- [ ] Replace `cam_yaw`/`cam_pitch` with `glam::Quat` orientation
89+
- [ ] Rewrite `update_camera()` to apply incremental quaternion rotations
90+
- [ ] Extract `cam_dir` and `vup` from quaternion for shader
91+
- [ ] Tune input feel (yaw in world space vs local space)
92+
7793
### Future enhancements (not for first pass)
7894

7995
- Sample accumulation when stationary

0 commit comments

Comments
 (0)