bevy/crates/bevy_sprite/src
Bude b2e2f8d9e3
TextureAtlasBuilder now respects insertion order (#11474)
# Objective

TextureAtlases are commonly used to drive animations described as a
consecutive range of indices. The current TextureAtlasBuilder uses the
AssetId of the image to determine the index of the texture in the
TextureAtlas. The AssetId of an Image Asset can change between runs.
The TextureAtlas exposes
[`get_texture_index`](https://docs.rs/bevy/latest/bevy/sprite/struct.TextureAtlas.html#method.get_texture_index)
to get the index from a given AssetId, but this needlessly complicates
the process of creating a simple TextureAtlas animation.
Fixes #2459

## Solution

- Use the (ordered) image_ids of the 'texture to place' vector to
retrieve the packed locations and compose the textures of the
TextureAtlas.
2024-01-22 15:44:56 +00:00
..
mesh2d Revert rendering-related associated type name changes (#11027) 2024-01-22 15:01:55 +00:00
render Revert rendering-related associated type name changes (#11027) 2024-01-22 15:01:55 +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 Sprite slicing and tiling (#10588) 2024-01-15 15:40:06 +00:00
texture_atlas_builder.rs TextureAtlasBuilder now respects insertion order (#11474) 2024-01-22 15:44:56 +00:00
texture_atlas.rs Texture Atlas rework (#5103) 2024-01-16 13:59:08 +00:00