pub async fn reload_textures(&self) {
        // Separate block to release lock on state before await.
        let textures = {
            let state = self.state();

            let textures = state
                .textures
                .iter()
                .map(|e| e.value.clone())
                .collect::<Vec<Texture>>();

            for resource in textures.iter().cloned() {
                let path = resource.state().path().to_path_buf();
                let compression = if let ResourceState::Ok(ref data) = *resource.state() {
                    match data.pixel_kind() {
                        TexturePixelKind::DXT1RGB => CompressionOptions::Speed,
                        TexturePixelKind::DXT1RGBA => CompressionOptions::Speed,
                        TexturePixelKind::DXT3RGBA => CompressionOptions::NoCompression, // TODO
                        TexturePixelKind::DXT5RGBA => CompressionOptions::Quality,
                        _ => CompressionOptions::NoCompression,
                    }
                } else {
                    CompressionOptions::NoCompression
                };
                *resource.state() = ResourceState::new_pending(path.clone());

                #[cfg(target_arch = "wasm32")]
                crate::core::wasm_bindgen_futures::spawn_local(async move {
                    reload_texture(resource, path, compression).await;
                });

                #[cfg(not(target_arch = "wasm32"))]
                state.thread_pool.spawn_ok(async move {
                    reload_texture(resource, path, compression).await;
                });
            }

            textures
        };

        crate::core::futures::future::join_all(textures).await;
    }
/// Reloads every loaded texture. This method is asynchronous, internally it uses thread pool
/// to run reload on separate thread per texture.
Reloads every loaded texture. This method is asynchronous, internally it uses thread pool
to run reload on separate thread per texture.
Reloads every loaded texture . This method is asynchronous internally it uses thread pool to run reload on separate thread per texture .
pub async fn reload_textures(&self) {
        // Separate block to release lock on state before await.
        let textures = {
            let state = self.state();
            let textures = state
                .textures
                .iter()
                .map(|e| e.value.clone())
                .collect::<Vec<Texture>>();
            for resource in textures.iter().cloned() {
                let path = resource.state().path().to_path_buf();
                let compression = if let ResourceState::Ok(ref data) = *resource.state() {
                    match data.pixel_kind() {
                        TexturePixelKind::DXT1RGB => CompressionOptions::Speed,
                        TexturePixelKind::DXT1RGBA => CompressionOptions::Speed,
                        TexturePixelKind::DXT3RGBA => CompressionOptions::NoCompression, // TODO
                        TexturePixelKind::DXT5RGBA => CompressionOptions::Quality,
                        _ => CompressionOptions::NoCompression,
                    }
                } else {
                    CompressionOptions::NoCompression
                };
                *resource.state() = ResourceState::new_pending(path.clone());
                #[cfg(target_arch = "wasm32")]
                crate::core::wasm_bindgen_futures::spawn_local(async move {
                    reload_texture(resource, path, compression).await;
                });
                #[cfg(not(target_arch = "wasm32"))]
                state.thread_pool.spawn_ok(async move {
                    reload_texture(resource, path, compression).await;
                });
            }
            textures
        };
        crate::core::futures::future::join_all(textures).await;
    }
pub async fn reload_textures ( & self ) { // Separate block to release lock on state before await. let textures = { let state = self . state ( ) ; let textures = state . textures . iter ( ) . map ( | e | e . value . clone ( ) ) . collect :: < Vec < Texture > > ( ) ; for resource in textures . iter ( ) . cloned ( ) { let path = resource . state ( ) . path ( ) . to_path_buf ( ) ; let compression = if let ResourceState :: Ok ( ref data ) = * resource . state ( ) { match data . pixel_kind ( ) { TexturePixelKind :: DXT1RGB => CompressionOptions :: Speed , TexturePixelKind :: DXT1RGBA => CompressionOptions :: Speed , TexturePixelKind :: DXT3RGBA => CompressionOptions :: NoCompression , // TODO TexturePixelKind :: DXT5RGBA => CompressionOptions :: Quality , _ => CompressionOptions :: NoCompression , } } else { CompressionOptions :: NoCompression } ; * resource . state ( ) = ResourceState :: new_pending ( path . clone ( ) ) ; # [ cfg ( target_arch " " ) ] crate :: core :: wasm_bindgen_futures :: spawn_local ( async move { reload_texture ( resource , path , compression ) . await ; } ) ; # [ cfg ( not ( target_arch " " ) ) ] state . thread_pool . spawn_ok ( async move { reload_texture ( resource , path , compression ) . await ; } ) ; } textures } ; crate :: core :: futures :: future :: join_all ( textures ) . await ; }
Reloads every loaded texture.
Reloads every loaded texture .
&self