bevy/crates/bevy_sprite/src
Jerome Humbert d38d8a148a
Uncouple DynamicTextureAtlasBuilder from assets (#13717)
# Objective

Remove some unnecessary coupling between `DynamicTextureAtlasBuilder`
and `bevy_asset`.

## Solution

Remove the dependency of `DynamicTextureAtlasBuilder::add_texture` to
`bevy_asset`, by directly passing the `Image` of the atlas to mutate,
instead of passing separate `Assets<Image>` and `Handle<Image>` for the
function to do the lookup by itself. The lookup can be done from the
caller, and this allows using the builder in contexts where the `Image`
is not stored inside `Assets`.

Clean-up a bit the font atlas files by introducing a `PlacedGlyph` type
storing the `GlyphId` and its `SubpixelOffset`, which were otherwise
always both passed as function parameters and the pair used as key in
hash maps.

## Testing

There's no change in behavior.

---

## Changelog

- Added a `PlacedGlyph` type aggregating a `GlyphId` and a
`SubpixelOffset`. That type is now used as parameter in a few text atlas
APIs, instead of passing individual values.

## Migration Guide

- Replace the `glyph_id` and `subpixel_offset` of a few text atlas APIs
by a single `place_glyph: PlacedGlyph` parameter trivially combining the
two.
2024-06-08 12:38:03 +00:00
..
mesh2d Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
render Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
texture_slice Normalization anchor for sprite slice in dimensions of this slice (#12769) 2024-04-16 01:36:47 +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 add tonemapping LUT bindings for sprite and mesh2d pipelines (#13262) 2024-05-28 12:09:26 +00:00
sprite.rs Slicing support for texture atlas (#12059) 2024-03-05 16:05:39 +00:00
texture_atlas_builder.rs More idiomatic texture atlas builder (#13238) 2024-06-03 12:43:50 +00:00
texture_atlas.rs new example: sprite animation in response to an event (#12996) 2024-04-23 21:44:03 +00:00