diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:23 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:23 +0100 |
commit | 5851b43ca65d979b2d290eb94bd0187f9b9e5736 (patch) | |
tree | 8da72b834b03b0f8d8bbe8679530278044693cf8 /stockton-render | |
parent | a098066875fd554f7d1a6538b55d6b39a3e055e9 (diff) |
chore(render-quad): add textures
Diffstat (limited to 'stockton-render')
-rw-r--r-- | stockton-render/src/draw/draw_passes/level.rs | 18 | ||||
-rw-r--r-- | stockton-render/src/draw/draw_passes/mod.rs | 2 | ||||
-rw-r--r-- | stockton-render/src/draw/mod.rs | 2 |
3 files changed, 13 insertions, 9 deletions
diff --git a/stockton-render/src/draw/draw_passes/level.rs b/stockton-render/src/draw/draw_passes/level.rs index 9872b8c..682c775 100644 --- a/stockton-render/src/draw/draw_passes/level.rs +++ b/stockton-render/src/draw/draw_passes/level.rs @@ -17,7 +17,7 @@ use crate::{ }, queue_negotiator::QueueNegotiator, target::SwapchainProperties, - texture::{resolver::FsResolver, TexLoadQueue, TextureLoadConfig, TextureRepo}, + texture::{resolver::TextureResolver, TexLoadQueue, TextureLoadConfig, TextureRepo}, }, error::{EnvironmentError, LevelError, LockPoisoned}, types::*, @@ -52,7 +52,6 @@ use std::{ convert::TryInto, iter::{empty, once}, marker::PhantomData, - path::Path, sync::{Arc, RwLock}, }; @@ -264,13 +263,19 @@ where } } -impl<'a, M> IntoDrawPass<LevelDrawPass<'a, M>> for Entity +pub struct LevelDrawPassConfig<R> { + pub active_camera: Entity, + pub tex_resolver: R, +} + +impl<'a, M, R> IntoDrawPass<LevelDrawPass<'a, M>> for LevelDrawPassConfig<R> where M: for<'b> MinRenderFeatures<'b> + 'static, + R: TextureResolver + Send + Sync + 'static, { fn init( self, - session: &Session, + _session: &Session, adapter: &Adapter, device_lock: Arc<RwLock<DeviceT>>, queue_negotiator: &mut QueueNegotiator, @@ -356,7 +361,6 @@ where .build() .context("Error building pipeline")?; - let map_lock: Arc<RwLock<M>> = session.resources.get::<Arc<RwLock<M>>>().unwrap().clone(); let repo = TextureRepo::new( device_lock.clone(), queue_negotiator @@ -369,7 +373,7 @@ where .context("Error finding texture queue")?, adapter, TextureLoadConfig { - resolver: FsResolver::new(Path::new("textures"), map_lock), + resolver: self.tex_resolver, filter: Filter::Linear, wrap_mode: WrapMode::Tile, }, @@ -434,7 +438,7 @@ where pipeline, repo, draw_buffers, - active_camera: self, + active_camera: self.active_camera, _d: PhantomData, framebuffers, depth_buffers, diff --git a/stockton-render/src/draw/draw_passes/mod.rs b/stockton-render/src/draw/draw_passes/mod.rs index b18d50e..8d1d59b 100644 --- a/stockton-render/src/draw/draw_passes/mod.rs +++ b/stockton-render/src/draw/draw_passes/mod.rs @@ -13,7 +13,7 @@ mod ui; pub mod util; pub use cons::ConsDrawPass; -pub use level::LevelDrawPass; +pub use level::{LevelDrawPass, LevelDrawPassConfig}; pub use ui::UiDrawPass; /// One of several 'passes' that draw on each frame. diff --git a/stockton-render/src/draw/mod.rs b/stockton-render/src/draw/mod.rs index b570b12..4ba38cd 100644 --- a/stockton-render/src/draw/mod.rs +++ b/stockton-render/src/draw/mod.rs @@ -8,7 +8,7 @@ pub mod camera; mod context; pub mod draw_passes; mod queue_negotiator; -mod texture; +pub mod texture; mod ui; mod utils; |