pub struct DynamicTextureAtlasBuilder { /* private fields */ }
Expand description
Helper utility to update TextureAtlasLayout
on the fly.
Helpful in cases when texture is created procedurally,
e.g: in a font glyph TextureAtlasLayout
, only add the Image
texture for letters to be rendered.
Implementations§
Source§impl DynamicTextureAtlasBuilder
impl DynamicTextureAtlasBuilder
Sourcepub fn new(size: UVec2, padding: u32) -> Self
pub fn new(size: UVec2, padding: u32) -> Self
Create a new DynamicTextureAtlasBuilder
§Arguments
size
- total size for the atlaspadding
- gap added between textures in the atlas, both in x axis and y axis
Sourcepub fn add_texture(
&mut self,
atlas_layout: &mut TextureAtlasLayout,
texture: &Image,
atlas_texture: &mut Image,
) -> Result<usize, DynamicTextureAtlasBuilderError>
pub fn add_texture( &mut self, atlas_layout: &mut TextureAtlasLayout, texture: &Image, atlas_texture: &mut Image, ) -> Result<usize, DynamicTextureAtlasBuilderError>
Add a new texture to atlas_layout
.
It is the user’s responsibility to pass in the correct TextureAtlasLayout
.
Also, the asset that atlas_texture_handle
points to must have a usage matching
RenderAssetUsages::MAIN_WORLD
.
§Arguments
atlas_layout
- The atlas layout to add the texture to.texture
- The source texture to add to the atlas.atlas_texture
- The destination atlas texture to copy the source texture to.
Auto Trait Implementations§
impl Freeze for DynamicTextureAtlasBuilder
impl RefUnwindSafe for DynamicTextureAtlasBuilder
impl Send for DynamicTextureAtlasBuilder
impl Sync for DynamicTextureAtlasBuilder
impl Unpin for DynamicTextureAtlasBuilder
impl UnwindSafe for DynamicTextureAtlasBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more