bevy/crates/bevy_sprite/src
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
..
mesh2d Refactor batch_and_prepare_binned_render_phase in preparation for bin retention. (#16922) 2024-12-30 20:11:31 +00:00
render Fix sprite performance regression since retained render world (#17078) 2025-01-01 18:40:11 +00:00
texture_slice Fix sprite performance regression since retained render world (#17078) 2025-01-01 18:40:11 +00:00
bundle.rs Improved UiImage and Sprite scaling and slicing APIs (#16088) 2024-11-04 15:14:03 +00:00
dynamic_texture_atlas_builder.rs Remove unnecessary cast in DynamicTextureAtlasBuilder (#16937) 2024-12-24 17:14:06 +00:00
lib.rs Fix Text2d performance regression (#16991) 2024-12-29 23:14:33 +00:00
picking_backend.rs Refactor and simplify custom projections (#17063) 2025-01-01 20:44:24 +00:00
sprite.rs Remove the type parameter from check_visibility, and only invoke it once. (#16812) 2024-12-17 04:43:45 +00:00
texture_atlas_builder.rs Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
texture_atlas.rs Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00