1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/// A unique identifier for a texture managed by the texture atlas. #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct TextureHandle(u32); impl TextureHandle { pub(super) fn new(index: u32) -> Self { TextureHandle(index) } /// Return the raw index which can be passed to the shader for selecting a /// texture. pub(crate) fn texture_index(&self) -> u32 { let TextureHandle(index) = self; *index } } impl Default for TextureHandle { /// Return a texture handle which will always refer to a all-white texture fn default() -> Self { TextureHandle(0) } }