bevy/examples/2d
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
..
2d_gizmos.rs Multiple Configurations for Gizmos (#10342) 2024-01-18 15:52:50 +00:00
2d_shapes.rs Fix missed explicit conversions in examples (#11261) 2024-01-09 00:44:24 +00:00
2d_viewport_to_world.rs Add example for Camera::viewport_to_world (#7179) 2023-09-11 18:52:11 +00:00
bloom_2d.rs Fix missed explicit conversions in examples (#11261) 2024-01-09 00:44:24 +00:00
custom_gltf_vertex_attribute.rs Reorder impl to be the same as the trait (#11076) 2023-12-24 17:43:55 +00:00
mesh2d.rs Fix missed explicit conversions in examples (#11261) 2024-01-09 00:44:24 +00:00
mesh2d_manual.rs Unload render assets from RAM (#10520) 2024-01-03 03:31:04 +00:00
mesh2d_vertex_color_texture.rs Fix missed explicit conversions in examples (#11261) 2024-01-09 00:44:24 +00:00
move_sprite.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
pixel_grid_snap.rs Fix missed explicit conversions in examples (#11261) 2024-01-09 00:44:24 +00:00
rotation.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
sprite.rs Update color and naming for consistency (#10367) 2023-11-04 02:09:23 +00:00
sprite_flipping.rs Update color and naming for consistency (#10367) 2023-11-04 02:09:23 +00:00
sprite_sheet.rs Texture Atlas rework (#5103) 2024-01-16 13:59:08 +00:00
sprite_slice.rs Sprite slicing and tiling (#10588) 2024-01-15 15:40:06 +00:00
sprite_tile.rs Sprite slicing and tiling (#10588) 2024-01-15 15:40:06 +00:00
text2d.rs Rename TextAlignment to JustifyText. (#10854) 2023-12-05 03:00:41 +00:00
texture_atlas.rs Allow TextureAtlasBuilder in AssetLoader (#11548) 2024-01-27 16:16:44 +00:00
transparency_2d.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00