feat(camera): add orthographic projection support #948

Merged
SakulFlee merged 2 commits from feat/renderer-orthographic into main 2026-10-26 23:18:23 +00:00
Collaborator

Summary

Phase 6: orthographic camera support.

  • New CameraProjection::{Perspective, Orthographic} and ProjectionMode.
  • Camera uniforms keep the existing layout; the projection slot now holds either projection. Deferred world reconstruction, tiled light culling, frustum culling and CSM use the generic matrix, so they work with both modes.
  • CameraDescriptor stores projection_mode and ortho_height; aspect and fovy remain for perspective. ECS/camera descriptor fields are exposed to the debug editor.
  • glTF orthographic cameras are imported (xmag/ymag → aspect/height, znear/zfar → clip planes). Perspective yfov is now consistently stored in degrees.
  • sys_ortho_pan and sys_ortho_zoom provide view-plane panning, Q/E zoom and the existing look controls. The orthographic example uses them instead of the perspective controller.
  • New Examples/orthographic scene.
  • Tests cover orthographic projection matrices, frustum culling and glTF orthographic import.

Perspective remains the default.

Verification

  • cargo fmt --all -- --check
  • cargo clippy for camera/ECS/app/facade/debug UI and all four examples with --all-targets -D warnings
  • cargo clippy -p orbital_importer_gltf --lib -- -D warnings
  • cargo test -p orbital_camera -p orbital_ecs_bridge -p orbital_importer_gltf -p orbital_debug_ui
  • cargo check for template_minimal, template_all_in_one, and template_orthographic
  • Examples were not launched in this environment (no display/GPU)

Refs #781, #583, #580.

## Summary Phase 6: orthographic camera support. - New `CameraProjection::{Perspective, Orthographic}` and `ProjectionMode`. - Camera uniforms keep the existing layout; the projection slot now holds either projection. Deferred world reconstruction, tiled light culling, frustum culling and CSM use the generic matrix, so they work with both modes. - `CameraDescriptor` stores `projection_mode` and `ortho_height`; `aspect` and `fovy` remain for perspective. ECS/camera descriptor fields are exposed to the debug editor. - glTF orthographic cameras are imported (`xmag`/`ymag` → aspect/height, `znear`/`zfar` → clip planes). Perspective `yfov` is now consistently stored in degrees. - `sys_ortho_pan` and `sys_ortho_zoom` provide view-plane panning, Q/E zoom and the existing look controls. The orthographic example uses them instead of the perspective controller. - New `Examples/orthographic` scene. - Tests cover orthographic projection matrices, frustum culling and glTF orthographic import. Perspective remains the default. ## Verification - `cargo fmt --all -- --check` - `cargo clippy` for camera/ECS/app/facade/debug UI and all four examples with `--all-targets -D warnings` - `cargo clippy -p orbital_importer_gltf --lib -- -D warnings` - `cargo test -p orbital_camera -p orbital_ecs_bridge -p orbital_importer_gltf -p orbital_debug_ui` - `cargo check` for `template_minimal`, `template_all_in_one`, and `template_orthographic` - Examples were not launched in this environment (no display/GPU) Refs #781, #583, #580.
feat(camera): add orthographic projection support
Some checks failed
Lint / lint (pull_request) Successful in 1m14s
PR / test (pull_request) Has been cancelled
Templates / templates (pull_request) Has been cancelled
fa1a94ac7e
Introduce CameraProjection::{Perspective, Orthographic} and a ProjectionMode selector on camera descriptors. The camera uniform keeps the same layout: the projection slot now holds either a perspective or orthographic matrix, so deferred world reconstruction, tiled light culling, frustum culling and CSM keep working without a second uniform path.

Add orthographic descriptor fields to the ECS camera component and expose projection_mode to the debug editor. Import glTF orthographic cameras using xmag/ymag for height and aspect, and store perspective fovy consistently in degrees.

Add projection/frustum unit tests, importer coverage and an Examples/orthographic scene.
feat(camera): add orthographic controller variants
All checks were successful
Lint / lint (pull_request) Successful in 55s
Templates / templates (pull_request) Successful in 5m42s
PR / test (pull_request) Successful in 7m39s
656ed2029d
Add sys_ortho_pan and sys_ortho_zoom for orthographic scenes. Panning moves in the view plane, Q/E zoom by changing ortho_height, and mouse/gamepad look is preserved. The orthographic example registers both systems instead of the perspective controller.

Smart test results

Result: PASS

Scope: full workspace

Reason: workspace-level change: Cargo.lock

Elapsed: 6m 38s

Workflow run

Overall: 455 tests, 445 passed, 0 failed, 10 skipped

Nextest: 444 tests, 444 passed, 0 failed, 0 skipped
Doctests: 11 tests, 1 passed, 0 failed, 10 skipped

Outcome charts are split between nextest and doctests. The timing chart covers nextest only.

Crate Nextest Passed Failed Skipped Doctests Time
orbital 1 1 0 0 - 0.68s
orbital_2d 29 29 0 0 0/1 0.21s
orbital_app 10 10 0 0 0/1 0.10s
orbital_camera 8 8 0 0 - 0.06s
orbital_core 2 2 0 0 - 0.02s
orbital_debug_render 0 0 0 0 0/1 0.00s
orbital_debug_ui 45 45 0 0 0/1 0.39s
orbital_ecs 114 114 0 0 0/2 0.90s
orbital_ecs_bridge 39 39 0 0 - 0.33s
orbital_file_manager 5 5 0 0 - 0.05s
orbital_iced 25 25 0 0 - 0.20s
orbital_importer_gltf 14 14 0 0 - 0.21s
orbital_input 11 11 0 0 - 0.10s
orbital_light 6 6 0 0 - 0.05s
orbital_macros 0 0 0 0 0/1 0.00s
orbital_material_shader 2 2 0 0 - 0.01s
orbital_math 4 4 0 0 - 0.03s
orbital_procgeo 2 2 0 0 - 0.02s
orbital_render_graph 6 6 0 0 - 0.05s
orbital_renderer 8 8 0 0 - 0.06s
orbital_resources 23 23 0 0 - 0.31s
orbital_shader_core 0 0 0 0 1/1 0.00s
orbital_shader_pbr 4 4 0 0 - 0.03s
orbital_shader_preprocessor 12 12 0 0 - 0.10s
orbital_shadow 3 3 0 0 - 0.03s
orbital_text 14 14 0 0 0/1 0.51s
orbital_texture 11 11 0 0 - 0.12s
orbital_touch_ui 1 1 0 0 0/1 0.01s
orbital_ui 32 32 0 0 0/1 0.30s
orbital_world_environment 13 13 0 0 - 0.10s
pie showData
    title Nextest outcomes
    "Passed" : 444
pie showData
    title Doctest outcomes
    "Passed" : 1
    "Skipped" : 10
xychart-beta
    title "Slowest crates (nextest seconds)"
    x-axis ["orbital_ecs", "orbital", "orbital_text", "orbital_debug_ui", "orbital_ecs_bridge", "orbital_resources", "orbital_ui", "orbital_2d"]
    y-axis "Seconds" 0 --> 1
    bar [0.90, 0.68, 0.51, 0.39, 0.33, 0.31, 0.30, 0.21]
<!-- orbital-ci-test-results --> ## Smart test results **Result:** PASS **Scope:** full workspace **Reason:** workspace-level change: Cargo.lock **Elapsed:** 6m 38s [Workflow run](https://forgejo.sakul-flee.de/SakulFlee/Orbital/actions/runs/699) **Overall:** 455 tests, 445 passed, 0 failed, 10 skipped **Nextest:** 444 tests, 444 passed, 0 failed, 0 skipped **Doctests:** 11 tests, 1 passed, 0 failed, 10 skipped _Outcome charts are split between nextest and doctests. The timing chart covers nextest only._ | Crate | Nextest | Passed | Failed | Skipped | Doctests | Time | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | orbital | 1 | 1 | 0 | 0 | - | 0.68s | | orbital_2d | 29 | 29 | 0 | 0 | 0/1 | 0.21s | | orbital_app | 10 | 10 | 0 | 0 | 0/1 | 0.10s | | orbital_camera | 8 | 8 | 0 | 0 | - | 0.06s | | orbital_core | 2 | 2 | 0 | 0 | - | 0.02s | | orbital_debug_render | 0 | 0 | 0 | 0 | 0/1 | 0.00s | | orbital_debug_ui | 45 | 45 | 0 | 0 | 0/1 | 0.39s | | orbital_ecs | 114 | 114 | 0 | 0 | 0/2 | 0.90s | | orbital_ecs_bridge | 39 | 39 | 0 | 0 | - | 0.33s | | orbital_file_manager | 5 | 5 | 0 | 0 | - | 0.05s | | orbital_iced | 25 | 25 | 0 | 0 | - | 0.20s | | orbital_importer_gltf | 14 | 14 | 0 | 0 | - | 0.21s | | orbital_input | 11 | 11 | 0 | 0 | - | 0.10s | | orbital_light | 6 | 6 | 0 | 0 | - | 0.05s | | orbital_macros | 0 | 0 | 0 | 0 | 0/1 | 0.00s | | orbital_material_shader | 2 | 2 | 0 | 0 | - | 0.01s | | orbital_math | 4 | 4 | 0 | 0 | - | 0.03s | | orbital_procgeo | 2 | 2 | 0 | 0 | - | 0.02s | | orbital_render_graph | 6 | 6 | 0 | 0 | - | 0.05s | | orbital_renderer | 8 | 8 | 0 | 0 | - | 0.06s | | orbital_resources | 23 | 23 | 0 | 0 | - | 0.31s | | orbital_shader_core | 0 | 0 | 0 | 0 | 1/1 | 0.00s | | orbital_shader_pbr | 4 | 4 | 0 | 0 | - | 0.03s | | orbital_shader_preprocessor | 12 | 12 | 0 | 0 | - | 0.10s | | orbital_shadow | 3 | 3 | 0 | 0 | - | 0.03s | | orbital_text | 14 | 14 | 0 | 0 | 0/1 | 0.51s | | orbital_texture | 11 | 11 | 0 | 0 | - | 0.12s | | orbital_touch_ui | 1 | 1 | 0 | 0 | 0/1 | 0.01s | | orbital_ui | 32 | 32 | 0 | 0 | 0/1 | 0.30s | | orbital_world_environment | 13 | 13 | 0 | 0 | - | 0.10s | ```mermaid pie showData title Nextest outcomes "Passed" : 444 ``` ```mermaid pie showData title Doctest outcomes "Passed" : 1 "Skipped" : 10 ``` ```mermaid xychart-beta title "Slowest crates (nextest seconds)" x-axis ["orbital_ecs", "orbital", "orbital_text", "orbital_debug_ui", "orbital_ecs_bridge", "orbital_resources", "orbital_ui", "orbital_2d"] y-axis "Seconds" 0 --> 1 bar [0.90, 0.68, 0.51, 0.39, 0.33, 0.31, 0.30, 0.21] ```
SakulFlee deleted branch feat/renderer-orthographic 2026-10-26 23:18:24 +00:00
Sign in to join this conversation.
No description provided.