diff options
| author | Micha White <botahamec@outlook.com> | 2022-11-20 12:27:31 -0500 |
|---|---|---|
| committer | Micha White <botahamec@outlook.com> | 2022-11-20 12:27:31 -0500 |
| commit | 7caca37aed5904470dee15823b4a5506f9027c54 (patch) | |
| tree | 46d2186440e0a7fc0a3871f14530b919af498723 | |
| parent | 398722313716885bf6d2835f86576d2ae6615572 (diff) | |
Don't load unnecessary textures
| -rw-r--r-- | alligator_resources/src/texture.rs | 9 |
1 files changed, 7 insertions, 2 deletions
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()?; } |
