1 changed files with 40 additions and 0 deletions
@ -0,0 +1,40 @@
|
||||
# 2026-01-30 Camera Zoom and UI Cleanup |
||||
|
||||
## Changes Made |
||||
|
||||
### Camera System Improvements |
||||
- Extracted hardcoded camera control values to #define constants (CAMERA_ORBIT_ANGLE_SPEED, CAMERA_ZOOM_DELTA, CAMERA_MIN_DISTANCE, etc.) |
||||
- Implemented dynamic camera zoom with percentage-based speed (7% of current distance per keypress) |
||||
- Added delta clamping (ZOOM_MIN_DELTA 0.05, ZOOM_MAX_DELTA 5.0f) to prevent too-slow or too-fast zooming |
||||
- Fixed camera culling by accounting for raylib's near cull plane (0.05) in minimum distance calculation |
||||
- Camera minimum distance now uses max(average_children_distance, body_radius * 100) when children exist |
||||
- Camera minimum distance uses body_radius * 100 when no children exist (prevents clipping for bodies like Sun) |
||||
|
||||
### Camera Targeting Simplification |
||||
- Removed `selected_craft_index` from RenderState struct - camera now only tracks bodies |
||||
- Moved spacecraft selection tracking to UIState struct (`selected_craft_index` field) |
||||
- Camera now always focuses on bodies (directly selected or parent of selected spacecraft) |
||||
- Eliminated ~30 lines of duplicate/special-case code from renderer module |
||||
- All renderer functions now use single body-focused code path |
||||
|
||||
### Bug Fixes |
||||
- Fixed camera distance when switching from Sun (large radius) to Earth (small radius) - camera no longer clips inside Earth |
||||
- Fixed spacecraft panel showing for 1 frame then disappearing - `ui_state.selected_craft_index` now persists across frames instead of being reset |
||||
|
||||
## Commits |
||||
1. Extract camera control constants to #define macros |
||||
2. Implement dynamic camera zoom with percentage-based speed and distance clamping |
||||
3. Fix camera culling by accounting for near cull plane in minimum distance calculation |
||||
4. Simplify camera targeting by removing spacecraft selection from renderer |
||||
5. Fix camera distance to account for body size when switching targets |
||||
6. Fix spacecraft panel showing for 1 frame then disappearing |
||||
|
||||
## Results |
||||
- **Net line count:** -56 lines (44 insertions, 100 deletions) |
||||
- **Files modified:** 5 (src/renderer.cpp, src/renderer.h, src/ui_renderer.cpp, src/ui_renderer.h, src/main.cpp) |
||||
- **Build status:** Successful, no errors |
||||
- **Test status:** Camera zoom and minimum distance verified, spacecraft panel persistence confirmed |
||||
|
||||
## Next Steps |
||||
- Consider extracting remaining hardcoded rendering constants (grid parameters, spacecraft rendering, maneuver markers, orbit rendering, child indicators) |
||||
- Consider using parent's SOI radius instead of radius for more physically meaningful minimum distances |
||||
Loading…
Reference in new issue