pub struct Atlas { /* private fields */ }
Implementations
sourceimpl Atlas
impl Atlas
sourcepub fn new(queue: Arc<Queue>, format: VkFormat, max_alloc_size: u32) -> Arc<Self>
pub fn new(queue: Arc<Queue>, format: VkFormat, max_alloc_size: u32) -> Arc<Self>
Panics
- Panics if provided
queue
doesn’t support graphics. - Panics if provided
format
doesn’t support:- Being used in a sampled image
- Being used in a storage image
- Being used as a blit destiation
- Being used as transfer source or destination.
- Panics if provided
max_alloc_size
is greater than supportedmax_image_dimension2_d
sourcepub fn image_views(
&self
) -> Option<(Instant, Arc<HashMap<AtlasImageID, Arc<BstImageView>>>)>
pub fn image_views(
&self
) -> Option<(Instant, Arc<HashMap<AtlasImageID, Arc<BstImageView>>>)>
Obtain the current image views for the Atlas images. These should be used direclty when drawing and dropped afterwards. They should proably shouldn’t be stored. Keeping these views alive will result in the Atlas consuming more resources or even preventing it from updating at all in a bad case.
sourcepub fn empty_image(&self) -> Arc<BstImageView>
pub fn empty_image(&self) -> Arc<BstImageView>
General purpose empty image that can be used in descritors where an image is required, but where it won’t be used.
sourcepub fn linear_sampler(&self) -> Arc<Sampler>
pub fn linear_sampler(&self) -> Arc<Sampler>
An unnormalized, linear filter, clamp to transparent black border vulkano::Sampler
primary used for sampling atlas images. May be useful outside of Basalt.
sourcepub fn nearest_sampler(&self) -> Arc<Sampler>
pub fn nearest_sampler(&self) -> Arc<Sampler>
An unnormalized, nearest filter, clamp to transparent black border vulkano::Sampler
primary used for sampling atlas images. May be useful outside of Basalt.
sourcepub fn cache_coords(&self, cache_id: SubImageCacheID) -> Option<AtlasCoords>
pub fn cache_coords(&self, cache_id: SubImageCacheID) -> Option<AtlasCoords>
Obtain coords given a cache id. If doing this in bulk there will be a considerable
performance improvement when using batch_cache_coords()
.
sourcepub fn batch_cache_coords(
&self,
cache_ids: Vec<SubImageCacheID>
) -> Vec<Option<AtlasCoords>>
pub fn batch_cache_coords(
&self,
cache_ids: Vec<SubImageCacheID>
) -> Vec<Option<AtlasCoords>>
Obtain coords for a set of cache ids. This method will be a considerable
improvment for obtaining coords over cache_coords
where this is done in bulk.
sourcepub fn load_image(
&self,
cache_id: SubImageCacheID,
cache_ctrl: AtlasCacheCtrl,
image: Image
) -> Result<AtlasCoords, String>
pub fn load_image(
&self,
cache_id: SubImageCacheID,
cache_ctrl: AtlasCacheCtrl,
image: Image
) -> Result<AtlasCoords, String>
Load an image from the provided Image
.
sourcepub fn load_image_from_bytes(
&self,
cache_id: SubImageCacheID,
cache_ctrl: AtlasCacheCtrl,
bytes: Vec<u8>
) -> Result<AtlasCoords, String>
pub fn load_image_from_bytes(
&self,
cache_id: SubImageCacheID,
cache_ctrl: AtlasCacheCtrl,
bytes: Vec<u8>
) -> Result<AtlasCoords, String>
Load an image from bytes. This uses the image
crate.
For raw data use Image::new()
and load_image
.
sourcepub fn load_image_from_path<P: AsRef<Path>>(
&self,
cache_ctrl: AtlasCacheCtrl,
path: P
) -> Result<AtlasCoords, String>
pub fn load_image_from_path<P: AsRef<Path>>(
&self,
cache_ctrl: AtlasCacheCtrl,
path: P
) -> Result<AtlasCoords, String>
Load an image from a path. This reads the file and passes it to Image::load_image_from_bytes()
.
sourcepub fn load_image_from_url<U: AsRef<str>>(
self: &Arc<Self>,
cache_ctrl: AtlasCacheCtrl,
url: U
) -> Result<AtlasCoords, String>
pub fn load_image_from_url<U: AsRef<str>>(
self: &Arc<Self>,
cache_ctrl: AtlasCacheCtrl,
url: U
) -> Result<AtlasCoords, String>
Load an image from a url. This uses curl
to fetch the data from the url and pass it to load_image_from_bytes()
.