bevy/examples/camera
Aevyrie bed9ddf3ce
Refactor and simplify custom projections (#17063)
# Objective

- Fixes https://github.com/bevyengine/bevy/issues/16556
- Closes https://github.com/bevyengine/bevy/issues/11807

## Solution

- Simplify custom projections by using a single source of truth -
`Projection`, removing all existing generic systems and types.
- Existing perspective and orthographic structs are no longer components
- I could dissolve these to simplify further, but keeping them around
was the fast way to implement this.
- Instead of generics, introduce a third variant, with a trait object.
- Do an object safety dance with an intermediate trait to allow cloning
boxed camera projections. This is a normal rust polymorphism papercut.
You can do this with a crate but a manual impl is short and sweet.

## Testing

- Added a custom projection example

---

## Showcase

- Custom projections and projection handling has been simplified.
- Projection systems are no longer generic, with the potential for many
different projection components on the same camera.
- Instead `Projection` is now the single source of truth for camera
projections, and is the only projection component.
- Custom projections are still supported, and can be constructed with
`Projection::custom()`.

## Migration Guide

- `PerspectiveProjection` and `OrthographicProjection` are no longer
components. Use `Projection` instead.
- Custom projections should no longer be inserted as a component.
Instead, simply set the custom projection as a value of `Projection`
with `Projection::custom()`.
2025-01-01 20:44:24 +00:00
..
2d_screen_shake.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
2d_top_down_camera.rs simplify example, replace get_single to Single Query (#16187) 2024-11-01 18:25:42 +00:00
camera_orbit.rs Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
custom_projection.rs Refactor and simplify custom projections (#17063) 2025-01-01 20:44:24 +00:00
first_person_view_model.rs simplify example, replace get_single to Single Query (#16187) 2024-11-01 18:25:42 +00:00
projection_zoom.rs Refactor and simplify custom projections (#17063) 2025-01-01 20:44:24 +00:00