Trait veloren_voxygen::render::pipelines::AtlasData
source · pub trait AtlasData {
type SliceMut<'a>: Iterator
where Self: 'a;
const TEXTURES: usize;
// Required methods
fn blank_with_size(sz: Vec2<u16>) -> Self;
fn as_texture_data(&self) -> [(TextureFormat, &[u8]); Self::TEXTURES];
fn layout() -> Vec<BindGroupLayoutEntry>;
fn slice_mut(&mut self, range: Range<usize>) -> Self::SliceMut<'_>;
// Provided method
fn create_textures(
&self,
renderer: &mut Renderer,
atlas_size: Vec2<u16>,
) -> [Texture; Self::TEXTURES] { ... }
}
Expand description
A trait implemented by texture atlas groups.
Terrain, figures, sprites, etc. all use texture atlases but have different requirements, such as that layers provided by each atlas. This trait abstracts over these cases.
Required Associated Types§
sourcetype SliceMut<'a>: Iterator
where
Self: 'a
type SliceMut<'a>: Iterator where Self: 'a
Abstracts over a slice into the texture data, as returned by
AtlasData::slice_mut
.
Required Associated Constants§
Required Methods§
sourcefn blank_with_size(sz: Vec2<u16>) -> Self
fn blank_with_size(sz: Vec2<u16>) -> Self
Return blank atlas data upon which texels can be applied.
sourcefn as_texture_data(&self) -> [(TextureFormat, &[u8]); Self::TEXTURES]
fn as_texture_data(&self) -> [(TextureFormat, &[u8]); Self::TEXTURES]
Return an array of texture formats and data for each texture layer in the atlas.
Provided Methods§
sourcefn create_textures(
&self,
renderer: &mut Renderer,
atlas_size: Vec2<u16>,
) -> [Texture; Self::TEXTURES]
fn create_textures( &self, renderer: &mut Renderer, atlas_size: Vec2<u16>, ) -> [Texture; Self::TEXTURES]
Create textures on the GPU corresponding to the layers in the atlas.
Object Safety§
This trait is not object safe.