From 7caca37aed5904470dee15823b4a5506f9027c54 Mon Sep 17 00:00:00 2001 From: Micha White Date: Sun, 20 Nov 2022 12:27:31 -0500 Subject: Don't load unnecessary textures --- alligator_resources/src/texture.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'alligator_resources/src') diff --git a/alligator_resources/src/texture.rs b/alligator_resources/src/texture.rs index 4b55f95..9e29d08 100644 --- a/alligator_resources/src/texture.rs +++ b/alligator_resources/src/texture.rs @@ -392,7 +392,9 @@ impl TextureManager { let mut texture = Texture::from_path(path, priority); let size = texture.allocated_size(); - if priority == Priority::Urgent || self.can_load(size, texture.priority()) { + if priority != Priority::Unnecessary + && (priority == Priority::Urgent || self.can_load(size, texture.priority())) + { match texture.load_texture() { Ok(_) => { self.textures.insert(id, texture); @@ -415,7 +417,10 @@ impl TextureManager { let size = texture.allocated_size(); let priority = texture.priority(); - if !texture.is_loaded() && (priority == Priority::Urgent || self.can_load(size, priority)) { + if priority != Priority::Unnecessary + && !texture.is_loaded() + && (priority == Priority::Urgent || self.can_load(size, priority)) + { let texture = self.textures.get_mut(&id).expect("invalid texture id"); texture.load_texture()?; } -- cgit v1.2.3