summaryrefslogtreecommitdiff
path: root/alligator_resources/src
diff options
context:
space:
mode:
authorMicha White <botahamec@outlook.com>2022-11-19 14:37:35 -0500
committerMicha White <botahamec@outlook.com>2022-11-19 14:37:35 -0500
commit01fe7d3c892c5d8580ed05f1f6ee9362e1f02855 (patch)
tree5e3aa9eb2c3704b7f70766e87f40c5132aa75cfc /alligator_resources/src
parent0501bc6d9ec6524ab7c3d9433d2025ab5da41ea7 (diff)
Quick fix to already loaded textures
Diffstat (limited to 'alligator_resources/src')
-rw-r--r--alligator_resources/src/texture.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/alligator_resources/src/texture.rs b/alligator_resources/src/texture.rs
index 81c2105..2255b3f 100644
--- a/alligator_resources/src/texture.rs
+++ b/alligator_resources/src/texture.rs
@@ -192,6 +192,13 @@ impl Texture {
TextureBuffer::Disk(file) => file.allocated_size(),
}
}
+
+ const fn is_loaded(&self) -> bool {
+ match &self.buffer {
+ TextureBuffer::Memory(_) => true,
+ TextureBuffer::Disk(file) => file.is_loaded(),
+ }
+ }
}
pub struct TextureRef<'a> {
@@ -375,7 +382,7 @@ impl TextureManager {
let size = texture.allocated_size();
let priority = texture.priority();
- if priority == Priority::Urgent || self.can_load(size, priority) {
+ if !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()?;
}