From a7c74fc47e53dbfbf50b7e14d4a237e3a8c95df6 Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Sun, 14 Feb 2021 13:55:10 -0800 Subject: [PATCH] going to update wgpu --- resources/light.obj | 54 +++++++++++++++++++++------------------------ src/camera.rs | 28 ++++------------------- 2 files changed, 29 insertions(+), 53 deletions(-) diff --git a/resources/light.obj b/resources/light.obj index 1ad05f4..4a6d46e 100644 --- a/resources/light.obj +++ b/resources/light.obj @@ -35,6 +35,14 @@ v -0.739722 0.303859 -0.303860 v -0.739722 0.238740 -0.357301 v -0.739722 0.164447 -0.397012 v -0.739722 0.083834 -0.421465 +v -0.377020 -0.377020 0.377020 +v -0.377020 0.377020 0.377020 +v -0.377020 -0.377020 -0.377020 +v -0.377020 0.377020 -0.377020 +v 0.377020 -0.377020 0.377020 +v 0.377020 0.377020 0.377020 +v 0.377020 -0.377020 -0.377020 +v 0.377020 0.377020 -0.377020 vn 0.4455 -0.0878 -0.8910 vn 0.4455 -0.2599 -0.8567 vn 0.4455 -0.4220 -0.7896 @@ -68,6 +76,11 @@ vn 0.4455 0.4220 -0.7896 vn 0.4455 0.2599 -0.8567 vn 0.4455 0.0878 -0.8910 vn -1.0000 -0.0000 -0.0000 +vn -0.0000 0.0000 -1.0000 +vn 1.0000 -0.0000 0.0000 +vn -0.0000 0.0000 1.0000 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 0.0000 usemtl None s off f 1//1 24//1 2//1 @@ -103,6 +116,12 @@ f 31//30 24//30 32//30 f 32//31 24//31 33//31 f 33//32 24//32 1//32 f 8//33 16//33 25//33 +f 35//33 36//33 34//33 +f 37//34 40//34 36//34 +f 41//35 38//35 40//35 +f 39//36 34//36 38//36 +f 40//37 34//37 36//37 +f 37//38 39//38 41//38 f 33//33 1//33 2//33 f 2//33 3//33 4//33 f 4//33 5//33 6//33 @@ -132,32 +151,9 @@ f 27//33 29//33 33//33 f 33//33 4//33 8//33 f 8//33 12//33 16//33 f 33//33 8//33 25//33 -o Cube_Cube.001 -v -0.377020 -0.377020 0.377020 -v -0.377020 0.377020 0.377020 -v -0.377020 -0.377020 -0.377020 -v -0.377020 0.377020 -0.377020 -v 0.377020 -0.377020 0.377020 -v 0.377020 0.377020 0.377020 -v 0.377020 -0.377020 -0.377020 -v 0.377020 0.377020 -0.377020 -vn -1.0000 0.0000 0.0000 -vn 0.0000 0.0000 -1.0000 -vn 1.0000 0.0000 0.0000 -vn 0.0000 0.0000 1.0000 -vn 0.0000 -1.0000 0.0000 -vn 0.0000 1.0000 0.0000 -usemtl None -s off -f 35//34 36//34 34//34 -f 37//35 40//35 36//35 -f 41//36 38//36 40//36 -f 39//37 34//37 38//37 -f 40//38 34//38 36//38 -f 37//39 39//39 41//39 -f 35//34 37//34 36//34 -f 37//35 41//35 40//35 -f 41//36 39//36 38//36 -f 39//37 35//37 34//37 -f 40//38 38//38 34//38 -f 37//39 35//39 39//39 +f 35//33 37//33 36//33 +f 37//34 41//34 40//34 +f 41//35 39//35 38//35 +f 39//36 35//36 34//36 +f 40//37 38//37 34//37 +f 37//38 35//38 39//38 diff --git a/src/camera.rs b/src/camera.rs index 194c3e6..493c777 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -134,17 +134,6 @@ impl CameraController { self.rotate_vertical = mouse_dy as f32; } - // pub fn process_scroll(&mut self, delta: &MouseScrollDelta) { - // self.scroll = -match delta { - // // I'm assuming a line is about 100 pixels - // MouseScrollDelta::LineDelta(_, scroll) => scroll * 100.0, - // MouseScrollDelta::PixelDelta(LogicalPosition { - // y: scroll, - // .. - // }) => *scroll as f32, - // }; - // } - pub fn update_camera(&mut self, camera: &mut Camera, dt: f32) { // Move forward/backward and left/right let (yaw_sin, yaw_cos) = camera.yaw.0.sin_cos(); @@ -168,15 +157,6 @@ impl CameraController { camera.position += view_vector * (self.amount_forward - self.amount_backward) * self.speed * dt; camera.position += left_vector * (self.amount_left - self.amount_right) * self.speed * dt; - // I'm not a huge fan of this - // // Move in/out (aka. "zoom") - // // Note: this isn't an actual zoom. The camera's position - // // changes when zooming. I've added this to make it easier - // // to get closer to an object you want to focus on. - // let (pitch_sin, pitch_cos) = camera.pitch.0.sin_cos(); - // let scrollward = Vector3::new(pitch_cos * yaw_cos, pitch_sin, pitch_cos * yaw_sin).normalize(); - // camera.position += scrollward * self.scroll * self.speed * self.sensitivity * dt; - // self.scroll = 0.0; // Move up/down. Since we don't use roll, we can just // modify the y coordinate directly. @@ -193,10 +173,10 @@ impl CameraController { self.rotate_vertical = 0.0; // Keep the camera's angle from going too high/low. - if camera.pitch < -Rad(0.0) { - camera.pitch = -Rad(0.0); - } else if camera.pitch > Rad(PI) { - camera.pitch = Rad(PI); + if camera.pitch < -Rad(0.001) { + camera.pitch = -Rad(0.001); + } else if camera.pitch > Rad(PI - 0.001) { + camera.pitch = Rad(PI - 0.001); } } }