diff --git a/src/texture_loader.rs b/src/texture_loader.rs index 4b2aee9..7f74f0d 100644 --- a/src/texture_loader.rs +++ b/src/texture_loader.rs @@ -12,6 +12,13 @@ pub enum TextureLoader{ pub enum Texture{ ImageDDS(Vec), } +impl AsRef<[u8]> for Texture{ + fn as_ref(&self)->&[u8]{ + match self{ + Texture::ImageDDS(data)=>data.as_ref(), + } + } +} pub struct Textures{ textures:Vec, @@ -25,6 +32,9 @@ impl Textures{ pub fn get_texture(&self,texture_id:TextureId)->Option<&Texture>{ self.textures.get(texture_id.get() as usize) } + pub fn into_iter(self)->impl Iterator{ + self.textures.into_iter().enumerate().map(|(texture_id,texture)|(TextureId::new(texture_id as u32),texture)) + } } pub trait TextureLoaderTrait{