Struct riddle_renderer_wgpu::wgpu_ext::WGPUSpriteAtlasBuilder[][src]

pub struct WGPUSpriteAtlasBuilder<'a, Device: WGPUDevice> { /* fields omitted */ }

Construct a set of WGPUSprites from a set of riddle_image::Images which share a texture atlas.

Example

let renderer = Renderer::new_from_window(&window)?;

let img1 = Image::new(100, 100);
let img2 = Image::new(50, 50);

let mut sprite1 = None;
let mut sprite2 = None;

SpriteAtlasBuilder::new()
    .with_image(img1, &mut sprite1)
    .with_image(img2, &mut sprite2)
    .build(&renderer)?;

assert!(sprite1.is_some());
assert!(sprite2.is_some());

Implementations

impl<'a, Device> WGPUSpriteAtlasBuilder<'a, Device> where
    Device: WGPUDevice
[src]

pub fn new() -> Self[src]

A new empty atlas builder

pub fn with_image(
    self,
    img: Image,
    sprite: &'a mut Option<WGPUSprite<Device>>
) -> Self
[src]

Add an image to be packed in to the atlas, along with a reference to the Option<Sprite> which will store the sprite when the atlas is built.

pub fn with_filter_modes(
    self,
    mag_filter: FilterMode,
    min_filter: FilterMode
) -> Self
[src]

Specify the min and mag filters used when rendering the created sprites.

pub fn build(self, renderer: &WGPURenderer<Device>) -> Result<(), RendererError>[src]

Construct the atlas texture from the given set of images, and update the Option<Sprite> references.

Trait Implementations

impl<'a, Device> Default for WGPUSpriteAtlasBuilder<'a, Device> where
    Device: WGPUDevice
[src]

Auto Trait Implementations

impl<'a, Device> !RefUnwindSafe for WGPUSpriteAtlasBuilder<'a, Device>

impl<'a, Device> Send for WGPUSpriteAtlasBuilder<'a, Device> where
    Device: Send + Sync

impl<'a, Device> Sync for WGPUSpriteAtlasBuilder<'a, Device> where
    Device: Send + Sync

impl<'a, Device> Unpin for WGPUSpriteAtlasBuilder<'a, Device>

impl<'a, Device> !UnwindSafe for WGPUSpriteAtlasBuilder<'a, Device>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.