fn add_texture(&mut self, texture: TextureImage) -> Result<TextureHandle> {
        use anyhow::Context;

        let free_slot_index = self
            .textures
            .iter()
            .enumerate()
            .find(|(_i, entry)| entry.is_none())
            .with_context(|| "unable to find a free texture slot!")?
            .0;

        self.textures[free_slot_index] = Some(Binding {
            texture,
            sampler_handle: SamplerHandle::default(),
        });

        self.version = self.version.increment();

        Ok(TextureHandle::new(free_slot_index as u32))
    }
/// Add a texture to the atlas and return a texture handle.
///
/// Texture handles can be used when drawing to get the texture_index which
/// the shader uses to select this texture from the global array.
Add a texture to the atlas and return a texture handle.
Texture handles can be used when drawing to get the texture_index which
the shader uses to select this texture from the global array.
Add a texture to the atlas and return a texture handle . Texture handles can be used when drawing to get the texture_index which the shader uses to select this texture from the global array .
fn add_texture(&mut self, texture: TextureImage) -> Result<TextureHandle> {
        use anyhow::Context;
        let free_slot_index = self
            .textures
            .iter()
            .enumerate()
            .find(|(_i, entry)| entry.is_none())
            .with_context(|| "unable to find a free texture slot!")?
            .0;
        self.textures[free_slot_index] = Some(Binding {
            texture,
            sampler_handle: SamplerHandle::default(),
        });
        self.version = self.version.increment();
        Ok(TextureHandle::new(free_slot_index as u32))
    }
fn add_texture ( & mut self , texture : TextureImage ) -> Result < TextureHandle > { use anyhow :: Context ; let free_slot_index = self . textures . iter ( ) . enumerate ( ) . find ( | ( _i , entry ) | entry . is_none ( ) ) . with_context ( | | " " ) ? . 0 ; self . textures [ free_slot_index ] = Some ( Binding { texture , sampler_handle : SamplerHandle :: default ( ) , } ) ; self . version = self . version . increment ( ) ; Ok ( TextureHandle :: new ( free_slot_index as u32 ) ) }
Add a texture to the atlas and return a texture handle.
Add a texture to the atlas and return a texture handle .
&mut self
texture
TextureImage