From e376241aaea21e2c332dcecd6304d2d7c5d373a6 Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Sat, 20 Feb 2021 23:43:40 -0800 Subject: [PATCH] shadowing is back, need to figure out how I want to handle these direcitonal lights.... --- conf/entity_spawns.toml | 12 +++++++++++- src/light.rs | 2 +- src/render/state.rs | 8 ++++---- src/runtime/system.rs | 4 ++-- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/conf/entity_spawns.toml b/conf/entity_spawns.toml index 3a8dbfe..2b2c437 100644 --- a/conf/entity_spawns.toml +++ b/conf/entity_spawns.toml @@ -42,5 +42,15 @@ mesh = "light.obj" [entities.position] x = 25.0 - y = 25.0 + y = 75.0 + z = 20.0 + +[[entities]] +name = "light.2" +type = "Light" +mesh = "light.obj" + + [entities.position] + x = 50.0 + y = 75.0 z = 20.0 \ No newline at end of file diff --git a/src/light.rs b/src/light.rs index 04d1c0a..415f64d 100644 --- a/src/light.rs +++ b/src/light.rs @@ -33,7 +33,7 @@ impl DirectionalLight { let point3d = Point3::new(pos.x, pos.y, pos.z); let point3d_2 = Point3::new(pos.x, pos.y - 1.0, pos.z); - let mx_view = Matrix4::look_at(point3d, point3d_2, Vector3::unit_y()); + let mx_view = Matrix4::look_at(point3d, point3d_2, Vector3::unit_z()); let projection = PerspectiveFov { fovy: Deg(self.fov).into(), diff --git a/src/render/state.rs b/src/render/state.rs index 6b65311..86815de 100644 --- a/src/render/state.rs +++ b/src/render/state.rs @@ -74,8 +74,8 @@ impl RenderState { const MAX_LIGHTS: usize = 10; const SHADOW_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Depth32Float; const SHADOW_SIZE: wgpu::Extent3d = wgpu::Extent3d { - width: 512, - height: 512, + width: 1024, + height: 1024, depth: Self::MAX_LIGHTS as u32, }; const DEPTH_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Depth32Float; @@ -196,10 +196,10 @@ impl RenderState { b: 0.5, a: 1.0, }, - fov: 45.0, + fov: 90.0, depth: RangeCopy { start: 1.0, - end: 20.0, + end: 200.0, }, target_view: target.clone(), } diff --git a/src/runtime/system.rs b/src/runtime/system.rs index 06a6b0c..202962f 100644 --- a/src/runtime/system.rs +++ b/src/runtime/system.rs @@ -149,8 +149,8 @@ pub fn runtime_spawn( y: position.y, z: position.z, }, - yaw: Rad(-PI), - pitch: Rad(PI / 2.0), + yaw: Rad(PI / 2.0), + pitch: Rad(PI / 2.0 + 25.0), }, CameraController::new(5.0, 1.0), ));