diff --git a/crates/components/src/map_view.rs b/crates/components/src/map_view.rs index dbafdb7d..f10bbbdb 100644 --- a/crates/components/src/map_view.rs +++ b/crates/components/src/map_view.rs @@ -83,7 +83,7 @@ impl MapView { |x, y, passage| passages[(x, y)] = passage, ); - let atlas = update_state.graphics.atlas_cache.load_atlas( + let atlas = update_state.graphics.atlas_loader.load_atlas( &update_state.graphics, update_state.filesystem, tileset, diff --git a/crates/components/src/tilepicker.rs b/crates/components/src/tilepicker.rs index d090ec94..1ec999ac 100644 --- a/crates/components/src/tilepicker.rs +++ b/crates/components/src/tilepicker.rs @@ -111,7 +111,7 @@ impl Tilepicker { let tilesets = update_state.data.tilesets(); let tileset = &tilesets[map.tileset_id]; - let atlas = update_state.graphics.atlas_cache.load_atlas( + let atlas = update_state.graphics.atlas_loader.load_atlas( &update_state.graphics, update_state.filesystem, tileset, diff --git a/crates/graphics/src/atlas_cache.rs b/crates/graphics/src/atlas_loader.rs similarity index 97% rename from crates/graphics/src/atlas_cache.rs rename to crates/graphics/src/atlas_loader.rs index eb7302fa..5e54d0bc 100644 --- a/crates/graphics/src/atlas_cache.rs +++ b/crates/graphics/src/atlas_loader.rs @@ -17,11 +17,11 @@ use crate::{tiles::Atlas, GraphicsState}; #[derive(Default)] -pub struct Cache { +pub struct Loader { atlases: dashmap::DashMap, } -impl Cache { +impl Loader { pub fn load_atlas( &self, graphics_state: &GraphicsState, diff --git a/crates/graphics/src/lib.rs b/crates/graphics/src/lib.rs index be408013..013f659a 100644 --- a/crates/graphics/src/lib.rs +++ b/crates/graphics/src/lib.rs @@ -29,21 +29,19 @@ pub mod event; pub mod map; pub mod plane; -pub mod atlas_cache; +pub mod atlas_loader; pub mod texture_loader; -use std::sync::Arc; - pub use event::Event; pub use map::Map; pub use plane::Plane; -pub use texture_loader::{Texture, TextureLoader}; +pub use texture_loader::Texture; pub struct GraphicsState { - pub texture_loader: Arc, - pub atlas_cache: atlas_cache::Cache, + pub texture_loader: texture_loader::Loader, + pub atlas_loader: atlas_loader::Loader, pub render_state: egui_wgpu::RenderState, pub nearest_sampler: wgpu::Sampler, @@ -81,8 +79,8 @@ impl GraphicsState { ), }; - let texture_loader = Arc::new(TextureLoader::new(render_state.clone())); - let atlas_cache = atlas_cache::Cache::default(); + let texture_loader = texture_loader::Loader::new(render_state.clone()); + let atlas_cache = atlas_loader::Loader::default(); let nearest_sampler = render_state .device @@ -97,7 +95,7 @@ impl GraphicsState { Self { texture_loader, - atlas_cache, + atlas_loader: atlas_cache, render_state, nearest_sampler, diff --git a/crates/graphics/src/map.rs b/crates/graphics/src/map.rs index f8b44fb1..08e865b4 100644 --- a/crates/graphics/src/map.rs +++ b/crates/graphics/src/map.rs @@ -120,7 +120,7 @@ impl Map { passages: &luminol_data::Table2, ) -> anyhow::Result { let atlas = graphics_state - .atlas_cache + .atlas_loader .load_atlas(graphics_state, filesystem, tileset)?; let viewport = Arc::new(Viewport::new( diff --git a/crates/graphics/src/texture_loader.rs b/crates/graphics/src/texture_loader.rs index 4a286640..2f657616 100644 --- a/crates/graphics/src/texture_loader.rs +++ b/crates/graphics/src/texture_loader.rs @@ -28,7 +28,7 @@ use std::sync::Arc; use wgpu::util::DeviceExt; -pub struct TextureLoader { +pub struct Loader { loaded_textures: DashMap>, render_state: egui_wgpu::RenderState, @@ -98,7 +98,7 @@ impl Texture { } } -impl TextureLoader { +impl Loader { pub fn new(render_state: egui_wgpu::RenderState) -> Self { Self { loaded_textures: DashMap::with_capacity(64), diff --git a/crates/ui/src/windows/appearance.rs b/crates/ui/src/windows/appearance.rs index 5765298a..bffa54c2 100644 --- a/crates/ui/src/windows/appearance.rs +++ b/crates/ui/src/windows/appearance.rs @@ -98,7 +98,7 @@ impl luminol_core::Window for Window { .clicked() { update_state.graphics.texture_loader.clear(); - update_state.graphics.atlas_cache.clear(); + update_state.graphics.atlas_loader.clear(); update_state.bytes_loader.forget_all(); } });