projects
/
mandelwow.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ignore generated files.
[mandelwow.git]
/
support
/
camera.rs
diff --git
a/support/camera.rs
b/support/camera.rs
index 10ad1f0086d17e396a3f5a6075443f80be39e2ed..77ad0933c26e85fdd85171a7d02b2bc4759067b3 100644
(file)
--- 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),
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()
}
}
.. Default::default()
}
}
@@
-40,6
+40,10
@@
impl CameraState {
self.pos = pos;
}
self.pos = pos;
}
+ pub fn get_pos(&self) -> Vec3 {
+ self.pos
+ }
+
pub fn set_dir(&mut self, dir: Vec3) {
self.dir = dir;
}
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);
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 {
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 {
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 {
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 {