bevy/crates/bevy_sprite/src
Opstic 9a3225d3a8
Add Aabb calculation for Sprite, TextureAtlasSprite and Mesh2d (#7885)
# Objective

- Add `Aabb` calculation for `Sprite`, `TextureAtlasSprite` and
`Mesh2d`.
- Enable frustum culling for 2D entities since frustum culling requires
a `Aabb` component in the entity to function.
- Improve 2D performance massively when there are many sprites out of
view. (ex: `many_sprites`)

## Solution

- Derived from @Weasy666's #3944 pull request, which had no activity
since multiple months.
- Adapted the code to the latest version of Bevy.
- Added support for sprites with non-center `Anchor`s to avoid culling
prematurely when part of the sprite is still in view or not culling when
sprite is already out of view.

### Note
- Gives 15.8x performance boosts in some scenarios. (5 fps vs 79 fps
with 409600 sprites in `many_sprites`)

---------

Co-authored-by: ira <JustTheCoolDude@gmail.com>
2023-04-24 14:26:08 +00:00
..
mesh2d Compute vertex_count for indexed meshes on GpuMesh (#8460) 2023-04-22 17:28:58 +00:00
render Fixed several missing links in docs. (#8117) 2023-04-23 17:28:36 +00:00
bundle.rs Doc bevy sprite (#7858) 2023-03-03 18:14:40 +00:00
collide_aabb.rs Update docs to reflect that the shallowest and not the deepest penetr… (#8473) 2023-04-23 19:41:21 +00:00
dynamic_texture_atlas_builder.rs Doc bevy sprite (#7858) 2023-03-03 18:14:40 +00:00
lib.rs Add Aabb calculation for Sprite, TextureAtlasSprite and Mesh2d (#7885) 2023-04-24 14:26:08 +00:00
sprite.rs Add ReflectComponent registration for Sprite (#8207) 2023-03-27 21:18:10 +00:00
texture_atlas.rs Add Reflection Macros to TextureAtlasSprite (#8428) 2023-04-17 20:24:17 +00:00
texture_atlas_builder.rs Move sprite::Rect into bevy_math (#5686) 2022-09-02 12:35:23 +00:00