From 73ed4d94cf3dae47f89fe2575ae27f304407ed86 Mon Sep 17 00:00:00 2001 From: Micha White Date: Thu, 6 Oct 2022 19:55:50 -0400 Subject: clear_textures --- src/texture.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/texture.rs b/src/texture.rs index 37f3a98..456f230 100644 --- a/src/texture.rs +++ b/src/texture.rs @@ -92,7 +92,6 @@ impl<'a> TextureAtlases<'a> { packer: MultiTexturePacker::new_skyline(TexturePackerConfig { max_width: width, max_height: height, - //trim: false, ..Default::default() }), width, @@ -179,6 +178,14 @@ impl<'a> TextureAtlases<'a> { Ok(()) } + fn clear(&mut self) { + self.packer = MultiTexturePacker::new_skyline(TexturePackerConfig { + max_width: self.width, + max_height: self.height, + ..Default::default() + }); + } + fn images(&mut self) -> ExportResult<&[RgbaImage]> { self.fill_images()?; Ok(&self.images) @@ -320,4 +327,8 @@ impl WgpuTextures { atlas_size, ); } + + pub fn clear_textures(&mut self) { + self.atlases.clear(); + } } -- cgit v1.2.3