diff --git a/Cargo.lock b/Cargo.lock index 02c6b4c2..f179dd31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3900,7 +3900,6 @@ dependencies = [ "glam", "id", "strafesnet_common", - "strafesnet_settings", "wgpu", ] diff --git a/engine/graphics/Cargo.toml b/engine/graphics/Cargo.toml index 54a6aa66..95411b5d 100644 --- a/engine/graphics/Cargo.toml +++ b/engine/graphics/Cargo.toml @@ -9,7 +9,6 @@ ddsfile = "0.5.1" glam.workspace = true id = { version = "0.1.0", registry = "strafesnet" } strafesnet_common.workspace = true -strafesnet_settings.workspace = true wgpu = "28.0.0" [lints] diff --git a/engine/graphics/src/graphics.rs b/engine/graphics/src/graphics.rs index 197aa457..cd318d02 100644 --- a/engine/graphics/src/graphics.rs +++ b/engine/graphics/src/graphics.rs @@ -1,7 +1,6 @@ use std::borrow::Cow; use std::collections::{HashSet,HashMap}; use strafesnet_common::map; -use strafesnet_settings::settings; use strafesnet_common::model::{self, ColorId, NormalId, PolygonIter, PositionId, RenderConfigId, TextureCoordinateId, VertexId}; use wgpu::{util::DeviceExt,AstcBlock,AstcChannel}; use crate::model::{self as model_graphics,IndexedGraphicsMeshOwnedRenderConfig,IndexedGraphicsMeshOwnedRenderConfigId,GraphicsMeshOwnedRenderConfig,GraphicsModelColor4,GraphicsModelOwned,GraphicsVertex}; @@ -160,9 +159,6 @@ impl GraphicsState{ pub fn clear(&mut self){ self.models.clear(); } - pub fn load_user_settings(&mut self,user_settings:&settings::UserSettings){ - self.camera.fov=user_settings.calculate_fov(1.0,&self.camera.screen_size).as_vec2(); - } pub fn generate_models(&mut self,device:&wgpu::Device,queue:&wgpu::Queue,map:&map::CompleteMap){ //generate texture view per texture let texture_views:HashMap=map.textures.iter().enumerate().filter_map(|(texture_id,texture_data)|{ @@ -888,11 +884,11 @@ impl GraphicsState{ &mut self, device:&wgpu::Device, config:&wgpu::SurfaceConfiguration, - user_settings:&settings::UserSettings, + fov:glam::Vec2, ){ self.depth_view=Self::create_depth_texture(config,device); self.camera.screen_size=glam::uvec2(config.width,config.height); - self.load_user_settings(user_settings); + self.camera.fov=fov; } pub fn render( &mut self, diff --git a/strafe-client/src/graphics_worker.rs b/strafe-client/src/graphics_worker.rs index e62f833c..04a227ff 100644 --- a/strafe-client/src/graphics_worker.rs +++ b/strafe-client/src/graphics_worker.rs @@ -37,7 +37,8 @@ pub fn new( config.width=size.width.max(1); config.height=size.height.max(1); surface.configure(&device,&config); - graphics.resize(&device,&config,&user_settings); + let fov=user_settings.calculate_fov(1.0,&glam::uvec2(config.width,config.height)).as_vec2(); + graphics.resize(&device,&config,fov); println!("Resize took {:?}",t0.elapsed()); } Instruction::Render(frame_state)=>{ diff --git a/strafe-client/src/window.rs b/strafe-client/src/window.rs index c1d2e95f..a15bd246 100644 --- a/strafe-client/src/window.rs +++ b/strafe-client/src/window.rs @@ -250,10 +250,11 @@ pub fn worker<'a>( let user_settings=directories.settings(); let mut graphics=strafesnet_graphics::graphics::GraphicsState::new(&setup_context.device,&setup_context.queue,&setup_context.config); - graphics.load_user_settings(&user_settings); //WindowContextSetup::into_context let screen_size=glam::uvec2(setup_context.config.width,setup_context.config.height); + let fov=user_settings.calculate_fov(1.0,&screen_size).as_vec2(); + graphics.resize(&setup_context.device,&setup_context.config,fov); let graphics_thread=crate::graphics_worker::new(graphics,setup_context.config,setup_context.surface,setup_context.device,setup_context.queue); let mut window_context=WindowContext{ manual_mouse_lock:false,