pub fn build(self, renderer: &WGPURenderer<Device>) -> Result<()> {
        let WGPUSpriteAtlasBuilder {
            images,
            mag_filter,
            min_filter,
            total_width,
            max_height,
        } = self;

        let mut atlas = image::Image::new(total_width, max_height);
        let mut sprite_bounds = vec![];
        let mut x = 0;

        for (img, sprite) in images {
            sprite_bounds.push((
                Rect {
                    location: Vector2 { x: x, y: 0 },
                    dimensions: img.dimensions(),
                },
                sprite,
            ));
            atlas.blit(&img, Vector2 { x, y: 0 }.convert());
            x += img.width();
        }

        let texture = renderer.wgpu_device().with_device_info(|info| {
            Ok(WGPUTexture::from_image(
                info.device,
                info.queue,
                atlas,
                mag_filter,
                min_filter,
                TextureType::Plain,
            )?)
        })?;

        for (bounds, sprite) in sprite_bounds {
            *sprite = Some(WGPUSprite::from_texture_with_bounds(
                renderer,
                &texture,
                bounds.convert(),
            )?);
        }

        Ok(())
    }
/// Construct the atlas texture from the given set of images, and update the
/// `Option<Sprite>` references.
Construct the atlas texture from the given set of images, and update the
`Option` references.
Construct the atlas texture from the given set of images and update the ` Option ` references .
pub fn build(self, renderer: &WGPURenderer<Device>) -> Result<()> {
        let WGPUSpriteAtlasBuilder {
            images,
            mag_filter,
            min_filter,
            total_width,
            max_height,
        } = self;
        let mut atlas = image::Image::new(total_width, max_height);
        let mut sprite_bounds = vec![];
        let mut x = 0;
        for (img, sprite) in images {
            sprite_bounds.push((
                Rect {
                    location: Vector2 { x: x, y: 0 },
                    dimensions: img.dimensions(),
                },
                sprite,
            ));
            atlas.blit(&img, Vector2 { x, y: 0 }.convert());
            x += img.width();
        }
        let texture = renderer.wgpu_device().with_device_info(|info| {
            Ok(WGPUTexture::from_image(
                info.device,
                info.queue,
                atlas,
                mag_filter,
                min_filter,
                TextureType::Plain,
            )?)
        })?;
        for (bounds, sprite) in sprite_bounds {
            *sprite = Some(WGPUSprite::from_texture_with_bounds(
                renderer,
                &texture,
                bounds.convert(),
            )?);
        }
        Ok(())
    }
pub fn build ( self , renderer : & WGPURenderer < Device > ) -> Result < ( ) > { let WGPUSpriteAtlasBuilder { images , mag_filter , min_filter , total_width , max_height , } = self ; let mut atlas = image :: Image :: new ( total_width , max_height ) ; let mut sprite_bounds = vec ! [ ] ; let mut x = 0 ; for ( img , sprite ) in images { sprite_bounds . push ( ( Rect { location : Vector2 { x : x , y : 0 } , dimensions : img . dimensions ( ) , } , sprite , ) ) ; atlas . blit ( & img , Vector2 { x , y : 0 } . convert ( ) ) ; x += img . width ( ) ; } let texture = renderer . wgpu_device ( ) . with_device_info ( | info | { Ok ( WGPUTexture :: from_image ( info . device , info . queue , atlas , mag_filter , min_filter , TextureType :: Plain , ) ? ) } ) ? ; for ( bounds , sprite ) in sprite_bounds { * sprite = Some ( WGPUSprite :: from_texture_with_bounds ( renderer , & texture , bounds . convert ( ) , ) ? ) ; } Ok ( ( ) ) }
Construct the atlas texture from the given set of images, and update the
`Option<Sprite>` references.
Construct the atlas texture from the given set of images and update the ` Option<Sprite > ` references .
self
renderer
&WGPURenderer<Device>
self
renderer
&WGPURenderer<Device>