From e4394cfc01dbb0e6c977d6aedfce2f54b29c657d Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 00:22:08 +0800 Subject: [PATCH 01/16] Add doc comment for bevy_sprite --- crates/bevy_sprite/src/bundle.rs | 2 +- .../src/dynamic_texture_atlas_builder.rs | 34 ++++++------------- crates/bevy_sprite/src/texture_atlas.rs | 25 +++++++++----- 3 files changed, 29 insertions(+), 32 deletions(-) diff --git a/crates/bevy_sprite/src/bundle.rs b/crates/bevy_sprite/src/bundle.rs index d97e1857ded21..92a22ed76bd7f 100644 --- a/crates/bevy_sprite/src/bundle.rs +++ b/crates/bevy_sprite/src/bundle.rs @@ -38,7 +38,7 @@ impl Default for SpriteBundle { /// to as a `TextureAtlas`) #[derive(Bundle, Clone, Default)] pub struct SpriteSheetBundle { - /// The specific sprite from the texture atlas to be drawn + /// The specific sprite from the texture atlas to be drawn, default to first sprite. pub sprite: TextureAtlasSprite, /// A handle to the texture atlas that holds the sprite images pub texture_atlas: Handle, diff --git a/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs b/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs index 1155e0c5e23ce..278dfc4f80eb6 100644 --- a/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs +++ b/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs @@ -4,12 +4,21 @@ use bevy_math::{IVec2, Rect, Vec2}; use bevy_render::texture::{Image, TextureFormatPixelInfo}; use guillotiere::{size2, Allocation, AtlasAllocator}; +/// Helper utility to update [`TextureAtlas`] on the fly. +/// It is used in cases when texture is created highly dynamic, +/// e.g: font glyph texture, only render for letters to be rendered. pub struct DynamicTextureAtlasBuilder { pub atlas_allocator: AtlasAllocator, pub padding: i32, } impl DynamicTextureAtlasBuilder { + /// Create a new [`DynamicTextureAtlasBuilder`] + /// + /// # Arguments + /// + /// * `size` - total size for the atlas + /// * `padding` - padding between textures in the atlas pub fn new(size: Vec2, padding: i32) -> Self { Self { atlas_allocator: AtlasAllocator::new(to_size2(size)), @@ -17,6 +26,8 @@ impl DynamicTextureAtlasBuilder { } } + /// Add a new texture to [`TextureAtlas`]. + /// It is user's responsibility to pass in the correct [`TextureAtlas`] pub fn add_texture( &mut self, texture_atlas: &mut TextureAtlas, @@ -38,29 +49,6 @@ impl DynamicTextureAtlasBuilder { } } - // fn resize( - // &mut self, - // texture_atlas: &mut TextureAtlas, - // textures: &mut Assets, - // size: Vec2, - // ) { - // let new_size2 = to_size2(new_size); - // self.atlas_texture = Texture::new_fill(new_size, &[0,0,0,0]); - // let change_list = self.atlas_allocator.resize_and_rearrange(new_size2); - - // for change in change_list.changes { - // if let Some(changed_texture_handle) = self.allocation_textures.remove(&change.old.id) - // { let changed_texture = textures.get(&changed_texture_handle).unwrap(); - // self.place_texture(change.new, changed_texture_handle, changed_texture); - // } - // } - - // for failure in change_list.failures { - // let failed_texture = self.allocation_textures.remove(&failure.id).unwrap(); - // queued_textures.push(failed_texture); - // } - // } - fn place_texture( &mut self, atlas_texture: &mut Image, diff --git a/crates/bevy_sprite/src/texture_atlas.rs b/crates/bevy_sprite/src/texture_atlas.rs index ae9891914fe3d..fd61ed49ae1cc 100644 --- a/crates/bevy_sprite/src/texture_atlas.rs +++ b/crates/bevy_sprite/src/texture_atlas.rs @@ -19,17 +19,22 @@ pub struct TextureAtlas { pub size: Vec2, /// The specific areas of the atlas where each texture can be found pub textures: Vec, - pub texture_handles: Option, usize>>, + /// Mapping from texture handle to index + pub(crate) texture_handles: Option, usize>>, } #[derive(Component, Debug, Clone, Reflect)] pub struct TextureAtlasSprite { + /// The tint color used to draw the sprite, default is [`Color::WRITE`] pub color: Color, + /// Texture index in [`TextureAtlas`] pub index: usize, + /// Whether flip the sprite in x axis pub flip_x: bool, + /// Whether flip the sprite in y axis pub flip_y: bool, /// An optional custom size for the sprite that will be used when rendering, instead of the size - /// of the sprite's image in the atlas + /// of the sprite's image in the atlas. The sprite will be scaled. pub custom_size: Option, pub anchor: Anchor, } @@ -48,6 +53,8 @@ impl Default for TextureAtlasSprite { } impl TextureAtlasSprite { + /// Create a new [`TextureAtlasSprite`] with a sprite index, + /// it should be valid in corresponding [`TextureAtlas`] pub fn new(index: usize) -> TextureAtlasSprite { Self { index, @@ -57,7 +64,7 @@ impl TextureAtlasSprite { } impl TextureAtlas { - /// Create a new `TextureAtlas` that has a texture, but does not have + /// Create a new [`TextureAtlas`] that has a texture, but does not have /// any individual sprites specified pub fn new_empty(texture: Handle, dimensions: Vec2) -> Self { Self { @@ -68,10 +75,10 @@ impl TextureAtlas { } } - /// Generate a `TextureAtlas` by splitting a texture into a grid where each + /// Generate a [`TextureAtlas`] by splitting a texture into a grid where each /// `tile_size` by `tile_size` grid-cell is one of the textures in the /// atlas. Grid cells are separated by some `padding`, and the grid starts - /// at `offset` pixels from the top left corner. Resulting `TextureAtlas` is + /// at `offset` pixels from the top left corner. Resulting [`TextureAtlas`] is /// indexed left to right, top to bottom. pub fn from_grid( texture: Handle, @@ -116,8 +123,8 @@ impl TextureAtlas { } } - /// Add a sprite to the list of textures in the `TextureAtlas` - /// returns an index to the texture which can be used with `TextureAtlasSprite` + /// Add a sprite to the list of textures in the [`TextureAtlas`] + /// returns an index to the texture which can be used with [`TextureAtlasSprite`] /// /// # Arguments /// @@ -128,15 +135,17 @@ impl TextureAtlas { self.textures.len() - 1 } - /// How many textures are in the `TextureAtlas` + /// How many textures are in this [`TextureAtlas`] pub fn len(&self) -> usize { self.textures.len() } + /// Returns `true` if there are no textures in this [`TextureAtlas`] pub fn is_empty(&self) -> bool { self.textures.is_empty() } + /// Returns the index if texture in this [`TextureAtlas`] pub fn get_texture_index(&self, texture: &Handle) -> Option { self.texture_handles .as_ref() From 65eba2740af1c53454d851db8198d3dd98179236 Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 00:33:25 +0800 Subject: [PATCH 02/16] remove pub from internal fields for DynamicTextureAtlasBuilder --- crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs b/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs index 278dfc4f80eb6..8f6ab4ff38fa0 100644 --- a/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs +++ b/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs @@ -8,8 +8,8 @@ use guillotiere::{size2, Allocation, AtlasAllocator}; /// It is used in cases when texture is created highly dynamic, /// e.g: font glyph texture, only render for letters to be rendered. pub struct DynamicTextureAtlasBuilder { - pub atlas_allocator: AtlasAllocator, - pub padding: i32, + atlas_allocator: AtlasAllocator, + padding: i32, } impl DynamicTextureAtlasBuilder { From 675f8b0734fadad8f222c2c3ca925804dd7be768 Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 00:38:00 +0800 Subject: [PATCH 03/16] add doc for anchor, typo this -> the --- crates/bevy_sprite/src/texture_atlas.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/bevy_sprite/src/texture_atlas.rs b/crates/bevy_sprite/src/texture_atlas.rs index fd61ed49ae1cc..d01066d91edfb 100644 --- a/crates/bevy_sprite/src/texture_atlas.rs +++ b/crates/bevy_sprite/src/texture_atlas.rs @@ -36,6 +36,7 @@ pub struct TextureAtlasSprite { /// An optional custom size for the sprite that will be used when rendering, instead of the size /// of the sprite's image in the atlas. The sprite will be scaled. pub custom_size: Option, + /// [`Anchor`] point of the sprite in the world pub anchor: Anchor, } @@ -135,17 +136,17 @@ impl TextureAtlas { self.textures.len() - 1 } - /// How many textures are in this [`TextureAtlas`] + /// How many textures are in the [`TextureAtlas`] pub fn len(&self) -> usize { self.textures.len() } - /// Returns `true` if there are no textures in this [`TextureAtlas`] + /// Returns `true` if there are no textures in the [`TextureAtlas`] pub fn is_empty(&self) -> bool { self.textures.is_empty() } - /// Returns the index if texture in this [`TextureAtlas`] + /// Returns the index if texture in the [`TextureAtlas`] pub fn get_texture_index(&self, texture: &Handle) -> Option { self.texture_handles .as_ref() From 212b59504440b7d7f2f0985d6cb33234689a153b Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 00:58:37 +0800 Subject: [PATCH 04/16] Update crates/bevy_sprite/src/bundle.rs Co-authored-by: Alice Cecile --- crates/bevy_sprite/src/bundle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_sprite/src/bundle.rs b/crates/bevy_sprite/src/bundle.rs index 92a22ed76bd7f..e07a0e4192cd7 100644 --- a/crates/bevy_sprite/src/bundle.rs +++ b/crates/bevy_sprite/src/bundle.rs @@ -38,7 +38,7 @@ impl Default for SpriteBundle { /// to as a `TextureAtlas`) #[derive(Bundle, Clone, Default)] pub struct SpriteSheetBundle { - /// The specific sprite from the texture atlas to be drawn, default to first sprite. + /// The specific sprite from the texture atlas to be drawn, defaulting to the first sprite in the texture atlas. pub sprite: TextureAtlasSprite, /// A handle to the texture atlas that holds the sprite images pub texture_atlas: Handle, From bb0671120ad3bfd779d287bc7bb7937289c92e2d Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 00:59:04 +0800 Subject: [PATCH 05/16] Update crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs Co-authored-by: Alice Cecile --- crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs b/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs index 8f6ab4ff38fa0..874025fb35bb7 100644 --- a/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs +++ b/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs @@ -5,7 +5,8 @@ use bevy_render::texture::{Image, TextureFormatPixelInfo}; use guillotiere::{size2, Allocation, AtlasAllocator}; /// Helper utility to update [`TextureAtlas`] on the fly. -/// It is used in cases when texture is created highly dynamic, +/// +/// Helpful in cases when texture is created highly dynamic, /// e.g: font glyph texture, only render for letters to be rendered. pub struct DynamicTextureAtlasBuilder { atlas_allocator: AtlasAllocator, From 4df31f723345d62cdffe20c44f8f56d372c403ac Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 01:09:14 +0800 Subject: [PATCH 06/16] typo --- crates/bevy_sprite/src/texture_atlas.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_sprite/src/texture_atlas.rs b/crates/bevy_sprite/src/texture_atlas.rs index d01066d91edfb..656943eb0f4db 100644 --- a/crates/bevy_sprite/src/texture_atlas.rs +++ b/crates/bevy_sprite/src/texture_atlas.rs @@ -25,7 +25,7 @@ pub struct TextureAtlas { #[derive(Component, Debug, Clone, Reflect)] pub struct TextureAtlasSprite { - /// The tint color used to draw the sprite, default is [`Color::WRITE`] + /// The tint color used to draw the sprite, defaulting to [`Color::WHITE`] pub color: Color, /// Texture index in [`TextureAtlas`] pub index: usize, From fddd469cb0e3181a82d0d8de0f3c8e28200813e2 Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 08:10:53 +0800 Subject: [PATCH 07/16] Update crates/bevy_sprite/src/texture_atlas.rs Co-authored-by: ickshonpe --- crates/bevy_sprite/src/texture_atlas.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_sprite/src/texture_atlas.rs b/crates/bevy_sprite/src/texture_atlas.rs index 656943eb0f4db..bdecefb2af814 100644 --- a/crates/bevy_sprite/src/texture_atlas.rs +++ b/crates/bevy_sprite/src/texture_atlas.rs @@ -136,7 +136,7 @@ impl TextureAtlas { self.textures.len() - 1 } - /// How many textures are in the [`TextureAtlas`] + /// The number of textures in the [`TextureAtlas`] pub fn len(&self) -> usize { self.textures.len() } From 168bc78ba0bc9dd908c193e177ce84346d9f3b8b Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 08:11:01 +0800 Subject: [PATCH 08/16] Update crates/bevy_sprite/src/bundle.rs Co-authored-by: ickshonpe --- crates/bevy_sprite/src/bundle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_sprite/src/bundle.rs b/crates/bevy_sprite/src/bundle.rs index e07a0e4192cd7..092e5a302bb8b 100644 --- a/crates/bevy_sprite/src/bundle.rs +++ b/crates/bevy_sprite/src/bundle.rs @@ -38,7 +38,7 @@ impl Default for SpriteBundle { /// to as a `TextureAtlas`) #[derive(Bundle, Clone, Default)] pub struct SpriteSheetBundle { - /// The specific sprite from the texture atlas to be drawn, defaulting to the first sprite in the texture atlas. + /// The specific sprite from the texture atlas to be drawn, defaulting to the sprite at index 0. pub sprite: TextureAtlasSprite, /// A handle to the texture atlas that holds the sprite images pub texture_atlas: Handle, From 23fa6e77c60c07ca3e5abaecbeb44fe9fcc76777 Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 08:15:31 +0800 Subject: [PATCH 09/16] clarify what padding really is --- crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs b/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs index 874025fb35bb7..fe40492425a58 100644 --- a/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs +++ b/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs @@ -19,7 +19,7 @@ impl DynamicTextureAtlasBuilder { /// # Arguments /// /// * `size` - total size for the atlas - /// * `padding` - padding between textures in the atlas + /// * `padding` - gap added between textures in the atlas, both in x axis and y axis pub fn new(size: Vec2, padding: i32) -> Self { Self { atlas_allocator: AtlasAllocator::new(to_size2(size)), From 88a590c949a41580d75b5b15c97710cfe31d43ee Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 16:12:04 +0800 Subject: [PATCH 10/16] Update crates/bevy_sprite/src/texture_atlas.rs Co-authored-by: ickshonpe --- crates/bevy_sprite/src/texture_atlas.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_sprite/src/texture_atlas.rs b/crates/bevy_sprite/src/texture_atlas.rs index bdecefb2af814..c3918bd141be2 100644 --- a/crates/bevy_sprite/src/texture_atlas.rs +++ b/crates/bevy_sprite/src/texture_atlas.rs @@ -29,7 +29,7 @@ pub struct TextureAtlasSprite { pub color: Color, /// Texture index in [`TextureAtlas`] pub index: usize, - /// Whether flip the sprite in x axis + /// Whether to flip the sprite in the X axis pub flip_x: bool, /// Whether flip the sprite in y axis pub flip_y: bool, From eb087335224cde1e096135f137b7a2a9bd3f3f98 Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 16:12:18 +0800 Subject: [PATCH 11/16] Update crates/bevy_sprite/src/texture_atlas.rs Co-authored-by: ickshonpe --- crates/bevy_sprite/src/texture_atlas.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_sprite/src/texture_atlas.rs b/crates/bevy_sprite/src/texture_atlas.rs index c3918bd141be2..35bdc342c46fd 100644 --- a/crates/bevy_sprite/src/texture_atlas.rs +++ b/crates/bevy_sprite/src/texture_atlas.rs @@ -31,7 +31,7 @@ pub struct TextureAtlasSprite { pub index: usize, /// Whether to flip the sprite in the X axis pub flip_x: bool, - /// Whether flip the sprite in y axis + /// Whether to flip the sprite in the Y axis pub flip_y: bool, /// An optional custom size for the sprite that will be used when rendering, instead of the size /// of the sprite's image in the atlas. The sprite will be scaled. From 7577d5bdb05d41569c6651a1ff4fb775ddcefce2 Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 16:25:16 +0800 Subject: [PATCH 12/16] Apply suggestions from code review Co-authored-by: ickshonpe --- crates/bevy_sprite/src/texture_atlas.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_sprite/src/texture_atlas.rs b/crates/bevy_sprite/src/texture_atlas.rs index 35bdc342c46fd..7e613b8023540 100644 --- a/crates/bevy_sprite/src/texture_atlas.rs +++ b/crates/bevy_sprite/src/texture_atlas.rs @@ -55,7 +55,7 @@ impl Default for TextureAtlasSprite { impl TextureAtlasSprite { /// Create a new [`TextureAtlasSprite`] with a sprite index, - /// it should be valid in corresponding [`TextureAtlas`] + /// it should be valid in the corresponding [`TextureAtlas`] pub fn new(index: usize) -> TextureAtlasSprite { Self { index, @@ -79,7 +79,7 @@ impl TextureAtlas { /// Generate a [`TextureAtlas`] by splitting a texture into a grid where each /// `tile_size` by `tile_size` grid-cell is one of the textures in the /// atlas. Grid cells are separated by some `padding`, and the grid starts - /// at `offset` pixels from the top left corner. Resulting [`TextureAtlas`] is + /// at `offset` pixels from the top left corner. The resulting [`TextureAtlas`] is /// indexed left to right, top to bottom. pub fn from_grid( texture: Handle, From f1ecb4761a7060400bd552f67bcc66a6f0338f49 Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 16:45:56 +0800 Subject: [PATCH 13/16] update based on comment --- crates/bevy_sprite/src/texture_atlas.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_sprite/src/texture_atlas.rs b/crates/bevy_sprite/src/texture_atlas.rs index 7e613b8023540..07148e7dc17fc 100644 --- a/crates/bevy_sprite/src/texture_atlas.rs +++ b/crates/bevy_sprite/src/texture_atlas.rs @@ -146,7 +146,7 @@ impl TextureAtlas { self.textures.is_empty() } - /// Returns the index if texture in the [`TextureAtlas`] + /// Returns the index of the texture corresponding to the given image handle in the [`TextureAtlas`] pub fn get_texture_index(&self, texture: &Handle) -> Option { self.texture_handles .as_ref() From 9cc355f5ed639ed6a128b58629502101421692d9 Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 16:54:34 +0800 Subject: [PATCH 14/16] update doc --- crates/bevy_sprite/src/texture_atlas.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/bevy_sprite/src/texture_atlas.rs b/crates/bevy_sprite/src/texture_atlas.rs index 07148e7dc17fc..7c09e02072406 100644 --- a/crates/bevy_sprite/src/texture_atlas.rs +++ b/crates/bevy_sprite/src/texture_atlas.rs @@ -33,8 +33,7 @@ pub struct TextureAtlasSprite { pub flip_x: bool, /// Whether to flip the sprite in the Y axis pub flip_y: bool, - /// An optional custom size for the sprite that will be used when rendering, instead of the size - /// of the sprite's image in the atlas. The sprite will be scaled. + /// An optional custom size for the sprite that will be resized to when rendering pub custom_size: Option, /// [`Anchor`] point of the sprite in the world pub anchor: Anchor, From d4519135f7ff743a2c6fcb053610f5a4b0110954 Mon Sep 17 00:00:00 2001 From: shuo Date: Thu, 2 Mar 2023 21:08:17 +0800 Subject: [PATCH 15/16] revert comment for custom_size to the original version. --- crates/bevy_sprite/src/texture_atlas.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/bevy_sprite/src/texture_atlas.rs b/crates/bevy_sprite/src/texture_atlas.rs index 7c09e02072406..d0234c132d9be 100644 --- a/crates/bevy_sprite/src/texture_atlas.rs +++ b/crates/bevy_sprite/src/texture_atlas.rs @@ -33,7 +33,8 @@ pub struct TextureAtlasSprite { pub flip_x: bool, /// Whether to flip the sprite in the Y axis pub flip_y: bool, - /// An optional custom size for the sprite that will be resized to when rendering + /// An optional custom size for the sprite that will be used when rendering, instead of the size + /// of the sprite's image in the atlas pub custom_size: Option, /// [`Anchor`] point of the sprite in the world pub anchor: Anchor, From 5f64298fe52c800e89a0846680751a8eee025221 Mon Sep 17 00:00:00 2001 From: shuo Date: Sat, 4 Mar 2023 00:11:13 +0800 Subject: [PATCH 16/16] Apply suggestions from code review Co-authored-by: Thierry Berger --- crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs b/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs index fe40492425a58..18dd13a0ed8ff 100644 --- a/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs +++ b/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs @@ -6,8 +6,8 @@ use guillotiere::{size2, Allocation, AtlasAllocator}; /// Helper utility to update [`TextureAtlas`] on the fly. /// -/// Helpful in cases when texture is created highly dynamic, -/// e.g: font glyph texture, only render for letters to be rendered. +/// Helpful in cases when texture is created procedurally, +/// e.g: in a font glyph [`TextureAtlas`], only add the [`Image`] texture for letters to be rendered. pub struct DynamicTextureAtlasBuilder { atlas_allocator: AtlasAllocator, padding: i32,