From 3c1822640f09d23c55a5e9a8fe4d131eb539d2f4 Mon Sep 17 00:00:00 2001 From: Micha White Date: Wed, 12 Oct 2022 12:06:37 -0400 Subject: Move out instance logic --- src/texture.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/texture.rs') diff --git a/src/texture.rs b/src/texture.rs index a3e2c10..e0ceb7d 100644 --- a/src/texture.rs +++ b/src/texture.rs @@ -64,14 +64,14 @@ impl From for TextureError { // TODO make this Debug // TODO make these resizable // TODO this could probably be moved into WgpuTextures -pub struct TextureAtlases<'a> { +pub struct TextureAtlas<'a> { packer: TexturePacker<'a, image::RgbaImage, TextureId>, image: RgbaImage, width: u32, height: u32, } -impl<'a> Default for TextureAtlases<'a> { +impl<'a> Default for TextureAtlas<'a> { fn default() -> Self { Self::new(1024, 1024) } @@ -86,7 +86,7 @@ macro_rules! texture_info { }; } -impl<'a> TextureAtlases<'a> { +impl<'a> TextureAtlas<'a> { /// Creates a new texture atlas, with the given size // TODO why is this u32? pub fn new(width: u32, height: u32) -> Self { @@ -166,7 +166,7 @@ impl<'a> TextureAtlases<'a> { } pub struct WgpuTextures { - atlases: TextureAtlases<'static>, + atlases: TextureAtlas<'static>, diffuse_texture: wgpu::Texture, diffuse_bind_group: wgpu::BindGroup, changed: bool, @@ -187,7 +187,7 @@ macro_rules! get_info { impl WgpuTextures { // TODO this is still too large pub fn new(device: &wgpu::Device, width: u32, height: u32) -> (Self, wgpu::BindGroupLayout) { - let atlases = TextureAtlases::new(width, height); + let atlases = TextureAtlas::new(width, height); let atlas_size = atlases.extent_3d(); let diffuse_texture = device.create_texture(&wgpu::TextureDescriptor { -- cgit v1.2.3