bevy/crates/bevy_sprite/src
IceSentry 5abc32ceda
Add 2d opaque phase with depth buffer (#13069)
This PR is based on top of #12982

# Objective

- Mesh2d currently only has an alpha blended phase. Most sprites don't
need transparency though.
- For some 2d games it can be useful to have a 2d depth buffer

## Solution

- Add an opaque phase to render Mesh2d that don't need transparency
- This phase currently uses the `SortedRenderPhase` to make it easier to
implement based on the already existing transparent phase. A follow up
PR will switch this to `BinnedRenderPhase`.
- Add a 2d depth buffer
- Use that depth buffer in the transparent phase to make sure that
sprites and transparent mesh2d are displayed correctly

## Testing

I added the mesh2d_transforms example that layers many opaque and
transparent mesh2d to make sure they all get displayed correctly. I also
confirmed it works with sprites by modifying that example locally.

---

## Changelog

- Added `AlphaMode2d`
- Added `Opaque2d` render phase
- Camera2d now have a `ViewDepthTexture` component

## Migration Guide

- `ColorMaterial` now contains `AlphaMode2d`. To keep previous
behaviour, use `AlphaMode::BLEND`. If you know your sprite is opaque,
use `AlphaMode::OPAQUE`

## Follow up PRs

- See tracking issue: #13265

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2024-08-07 00:22:09 +00:00
..
mesh2d Add 2d opaque phase with depth buffer (#13069) 2024-08-07 00:22:09 +00:00
render Add 2d opaque phase with depth buffer (#13069) 2024-08-07 00:22:09 +00:00
texture_slice fix asymmetrical 9-slicing (#14148) 2024-08-01 20:03:23 +00:00
bundle.rs new example: sprite animation in response to an event (#12996) 2024-04-23 21:44:03 +00:00
dynamic_texture_atlas_builder.rs Uncouple DynamicTextureAtlasBuilder from assets (#13717) 2024-06-08 12:38:03 +00:00
lib.rs Apply Clippy lints regarding lazy evaluation and closures (#14015) 2024-07-01 15:54:40 +00:00
sprite.rs Slicing support for texture atlas (#12059) 2024-03-05 16:05:39 +00:00
texture_atlas.rs Cosmic text (#10193) 2024-07-04 20:41:08 +00:00
texture_atlas_builder.rs More idiomatic texture atlas builder (#13238) 2024-06-03 12:43:50 +00:00