From 5851b43ca65d979b2d290eb94bd0187f9b9e5736 Mon Sep 17 00:00:00 2001 From: tcmal Date: Sun, 25 Aug 2024 17:44:23 +0100 Subject: chore(render-quad): add textures --- stockton-render/src/draw/draw_passes/level.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'stockton-render/src/draw/draw_passes/level.rs') 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> for Entity +pub struct LevelDrawPassConfig { + pub active_camera: Entity, + pub tex_resolver: R, +} + +impl<'a, M, R> IntoDrawPass> for LevelDrawPassConfig where M: for<'b> MinRenderFeatures<'b> + 'static, + R: TextureResolver + Send + Sync + 'static, { fn init( self, - session: &Session, + _session: &Session, adapter: &Adapter, device_lock: Arc>, queue_negotiator: &mut QueueNegotiator, @@ -356,7 +361,6 @@ where .build() .context("Error building pipeline")?; - let map_lock: Arc> = session.resources.get::>>().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, -- cgit v1.2.3