diff options
| author | Micha White <botahamec@outlook.com> | 2023-02-05 12:28:08 -0500 |
|---|---|---|
| committer | Micha White <botahamec@outlook.com> | 2023-02-05 12:28:08 -0500 |
| commit | 699fe35086d38b5e70cd476232bb79554cd39511 (patch) | |
| tree | d4efc136573cf5db8f47211ce55c1eb4e635bcc7 /alligator_render | |
| parent | a3196cda9f2e1e8f44f6315a2ef33d26f6dc36f9 (diff) | |
Loading a texture into the atlas changes it
Diffstat (limited to 'alligator_render')
| -rw-r--r-- | alligator_render/examples/bunnymark.rs | 5 | ||||
| -rw-r--r-- | alligator_render/src/texture.rs | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/alligator_render/examples/bunnymark.rs b/alligator_render/examples/bunnymark.rs index fea69ca..55feb86 100644 --- a/alligator_render/examples/bunnymark.rs +++ b/alligator_render/examples/bunnymark.rs @@ -89,7 +89,7 @@ impl State { for _ in 0..=(fps as u64 * 50) { let texture_x = renderer.textures_mut().texture_x(self.texture_id).unwrap(); - let texture_y = renderer.textures_mut().texture_x(self.texture_id).unwrap(); + let texture_y = renderer.textures_mut().texture_y(self.texture_id).unwrap(); let texture_height = renderer .textures_mut() .texture_height(self.texture_id) @@ -147,10 +147,11 @@ fn main() { let bunny = include_bytes!("res/bunny.ff"); let texture_manager = Arc::new(TextureManager::new(&texture_config)); - let renderer = Renderer::new(&render_config, texture_manager.clone()).unwrap(); + let mut renderer = Renderer::new(&render_config, texture_manager.clone()).unwrap(); let texture_id = texture_manager .load_from_memory(bunny, ImageFormat::Farbfeld) .unwrap(); + renderer.textures_mut().load_texture(texture_id).unwrap(); let state = Box::leak(Box::new(State::new(texture_id))); renderer.run(|r| state.update(r)); diff --git a/alligator_render/src/texture.rs b/alligator_render/src/texture.rs index 0afa0af..76e77a8 100644 --- a/alligator_render/src/texture.rs +++ b/alligator_render/src/texture.rs @@ -168,8 +168,8 @@ impl TextureAtlas { } /// Load a new subtexture from memory - // TODO support RGBA16 pub fn load_texture(&mut self, id: TextureId) -> Result<TextureId, TextureError> { + self.changed = true; let img = self.textures.load_texture(id)?; self.packer.pack_own(id, img).map_err(PackError)?; Ok(id) |
