Trait draw2d::graphics::texture_atlas::TextureAtlas [−][src]
pub trait TextureAtlas { fn version(&self) -> AtlasVersion; fn build_descriptor_image_info(&self) -> Vec<DescriptorImageInfo>; fn add_sampler(&mut self, sampler: Sampler) -> Result<SamplerHandle>; fn add_texture(&mut self, texture: TextureImage) -> Result<TextureHandle>; unsafe fn take_texture(
&mut self,
texture_handle: TextureHandle
) -> Result<TextureImage>; fn bind_sampler_to_texture(
&mut self,
sampler_handle: SamplerHandle,
texture_handle: TextureHandle
) -> Result<()>; }
Expand description
A type which owns a collection of texture objects that can be bound once
per frame and individually accessed in calls to vkDraw
.
Required methods
fn version(&self) -> AtlasVersion
fn version(&self) -> AtlasVersion
The atlas’s current version.
fn build_descriptor_image_info(&self) -> Vec<DescriptorImageInfo>
fn build_descriptor_image_info(&self) -> Vec<DescriptorImageInfo>
Build the array of descriptor image info objects which can be used to write all of this atlas’s textures into a descriptor set.
fn add_sampler(&mut self, sampler: Sampler) -> Result<SamplerHandle>
fn add_sampler(&mut self, sampler: Sampler) -> Result<SamplerHandle>
Add a named sampler to the atlas. Samplers can be persistently bound to individual textures.
fn add_texture(&mut self, texture: TextureImage) -> Result<TextureHandle>
fn add_texture(&mut self, texture: TextureImage) -> Result<TextureHandle>
Add a texture to the atlas. The atlas owns the texture and will destroy it when the atlas is dropped.
unsafe fn take_texture(
&mut self,
texture_handle: TextureHandle
) -> Result<TextureImage>
unsafe fn take_texture(
&mut self,
texture_handle: TextureHandle
) -> Result<TextureImage>
Take ownership of a texture owned by this atlas.
Unsafe Because
- the caller must make sure that the texture atlas is not in use when this method is called
fn bind_sampler_to_texture(
&mut self,
sampler_handle: SamplerHandle,
texture_handle: TextureHandle
) -> Result<()>
fn bind_sampler_to_texture(
&mut self,
sampler_handle: SamplerHandle,
texture_handle: TextureHandle
) -> Result<()>
Bind a sampler to a texture. Binding are persistent - they do not change until this method is called again.