X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=support%2Fcamera.rs;h=77ad0933c26e85fdd85171a7d02b2bc4759067b3;hb=85f1c7755a86b480276bb3bdd6a47a427f12286d;hp=10ad1f0086d17e396a3f5a6075443f80be39e2ed;hpb=b1f47d18bd76c1d1475f992f021e714289f4b79a;p=mandelwow.git diff --git a/support/camera.rs b/support/camera.rs index 10ad1f0..77ad093 100644 --- a/support/camera.rs +++ b/support/camera.rs @@ -31,7 +31,7 @@ impl CameraState { CameraState { aspect_ratio: 1024.0 / 768.0, pos: Vec3(0.0, 0.0, 0.0), - dir: Vec3(0.0, 0.0, 1.0), + dir: Vec3(0.0, 0.0, -1.0), .. Default::default() } } @@ -40,6 +40,10 @@ impl CameraState { self.pos = pos; } + pub fn get_pos(&self) -> Vec3 { + self.pos + } + pub fn set_dir(&mut self, dir: Vec3) { self.dir = dir; } @@ -60,7 +64,6 @@ impl CameraState { ] } - pub fn get_view(&self) -> [[f32; 4]; 4] { let f = norm(&self.dir); @@ -128,11 +131,11 @@ impl CameraState { self.pos.2 -= f.2 * 0.01; } if self.turning_left { - let a: f32 = -0.05; + let a: f32 = 0.05; self.dir = Vec3(f.0 * a.cos() + f.2 * a.sin(), f.1, - f.0 * a.sin() + f.2 * a.cos()); } if self.turning_right { - let a: f32 = 0.05; + let a: f32 = -0.05; self.dir = Vec3(f.0 * a.cos() + f.2 * a.sin(), f.1, - f.0 * a.sin() + f.2 * a.cos()); } if self.turning_up {