Struct riddle_renderer_wgpu::wgpu_ext::WGPUSpriteAtlasBuilder [−][src]
Construct a set of WGPUSprite
s from a set of riddle_image::Image
s 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]
Device: WGPUDevice,
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]
self,
img: Image,
sprite: &'a mut Option<WGPUSprite<Device>>
) -> Self
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]
self,
mag_filter: FilterMode,
min_filter: FilterMode
) -> Self
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]
Device: WGPUDevice,
Auto Trait Implementations
impl<'a, Device> !RefUnwindSafe for WGPUSpriteAtlasBuilder<'a, Device>
impl<'a, Device> Send for WGPUSpriteAtlasBuilder<'a, Device> where
Device: Send + Sync,
Device: Send + Sync,
impl<'a, Device> Sync for WGPUSpriteAtlasBuilder<'a, Device> where
Device: Send + Sync,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,