bevy/crates/bevy_sprite/src
Bude 3851679173
Allow TextureAtlasBuilder in AssetLoader (#11548)
# Objective

Allow TextureAtlasBuilder in AssetLoader.
Fixes #2987

## Solution

- TextureAtlasBuilder no longer hold just AssetIds that are used to
retrieve the actual image data in `finish`, but &Image instead.
- TextureAtlasBuilder now required AssetId only optionally (and it is
only used to retrieve the index from the AssetId in TextureAtlasLayout),

## Issues

- The issue mentioned here
https://github.com/bevyengine/bevy/pull/11474#issuecomment-1904676937
now also extends to the actual atlas texture. In short: Calling
add_texture multiple times for the same texture will lead to duplicate
image data in the atlas texture and additional indices.
If you provide an AssetId we can probably do something to de-duplicate
the entries while keeping insertion order (suggestions welcome on how
exactly). But if you don't then we are out of luck (unless we can and
want to hash the image, which I do not think we want).

---

## Changelog

### Changed
- TextureAtlasBuilder `add_texture` can be called without providing an
AssetId
- TextureAtlasBuilder `finish` no longer takes Assets<Image> and no
longer returns a Handle<Image>

## Migration Guide

- For `add_texture` you need to wrap your AssetId in Some
- `finish` now returns the atlas texture image directly instead of a
handle. Provide the atlas texture to `add` on Assets<Texture> to get a
Handle<Image>
2024-01-27 16:16:44 +00:00
..
mesh2d Update to wgpu 0.19 and raw-window-handle 0.6 (#11280) 2024-01-26 18:14:21 +00:00
render Fix bug where Sprite::rect was ignored (#11480) 2024-01-26 20:48:41 +00:00
texture_slice Sprite slicing and tiling (#10588) 2024-01-15 15:40:06 +00:00
bundle.rs Texture Atlas rework (#5103) 2024-01-16 13:59:08 +00:00
collide_aabb.rs refactor collide code (Adopted) (#11106) 2024-01-01 16:57:27 +00:00
dynamic_texture_atlas_builder.rs Texture Atlas rework (#5103) 2024-01-16 13:59:08 +00:00
lib.rs Texture Atlas rework (#5103) 2024-01-16 13:59:08 +00:00
sprite.rs Fix bug where Sprite::rect was ignored (#11480) 2024-01-26 20:48:41 +00:00
texture_atlas_builder.rs Allow TextureAtlasBuilder in AssetLoader (#11548) 2024-01-27 16:16:44 +00:00
texture_atlas.rs Texture Atlas rework (#5103) 2024-01-16 13:59:08 +00:00