aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2024-05-20 01:17:13 +0200
committereug-vs <eugene@eug-vs.xyz>2024-05-20 01:17:13 +0200
commit1b6093a38a6ccf6d067740ee39476b6184fa8236 (patch)
tree1dc3df364fd3ba0225881cbacd1a4521f78e39ad
parent8e2e7bd7057925bb950d571dc0ac3e876ce32d54 (diff)
downloadpistol-1b6093a38a6ccf6d067740ee39476b6184fa8236.tar.gz
feat: adjust camera speed for better FPS
And other controls
-rw-r--r--src/camera.rs4
-rw-r--r--src/main.rs16
-rw-r--r--src/sdf.rs4
3 files changed, 12 insertions, 12 deletions
diff --git a/src/camera.rs b/src/camera.rs
index 7682553..7768b2b 100644
--- a/src/camera.rs
+++ b/src/camera.rs
@@ -35,8 +35,8 @@ impl Camera {
up: Vector::unit_z(),
distance,
screen: Screen { width, height },
- speed: 0.5,
- turn_rate: 60.0,
+ speed: 0.15,
+ turn_rate: 90.0,
}
}
pub fn get_screen_iterator(self) -> ScreenIterator {
diff --git a/src/main.rs b/src/main.rs
index 5675fac..6b485d7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -86,25 +86,25 @@ fn main() {
} else if char == 106 {
// j to move backward
renderer.camera.position -= renderer.camera.direction * renderer.camera.speed;
- } else if char == 72 {
- // H to move left
+ } else if char == 104 {
+ // h to move left
renderer.camera.position +=
Matrix3::from_axis_angle(renderer.camera.up, Rad::turn_div_4())
* renderer.camera.direction
* renderer.camera.speed;
- } else if char == 76 {
- // L to move right
+ } else if char == 108 {
+ // l to move right
renderer.camera.position -=
Matrix3::from_axis_angle(renderer.camera.up, Rad::turn_div_4())
* renderer.camera.direction
* renderer.camera.speed;
- } else if char == 104 {
- // h to rotate left
+ } else if char == 72 {
+ // H to rotate left
let rotation = Matrix3::from_angle_z(Rad::full_turn() / renderer.camera.turn_rate);
renderer.camera.direction = rotation * renderer.camera.direction;
renderer.camera.up = rotation * renderer.camera.up;
- } else if char == 108 {
- // l to rotate right
+ } else if char == 76 {
+ // L to rotate right
let rotation = Matrix3::from_angle_z(-Rad::full_turn() / renderer.camera.turn_rate);
renderer.camera.direction = rotation * renderer.camera.direction;
renderer.camera.up = rotation * renderer.camera.up;
diff --git a/src/sdf.rs b/src/sdf.rs
index 3204305..f3b9ac1 100644
--- a/src/sdf.rs
+++ b/src/sdf.rs
@@ -14,8 +14,8 @@ pub struct Sphere {
}
impl Object for Sphere {
- fn sdf(&self, point: Vector, time: f32) -> f32 {
- (point - self.center).magnitude() - self.radius + (time % 5.0) / 50.0
+ fn sdf(&self, point: Vector, _time: f32) -> f32 {
+ (point - self.center).magnitude() - self.radius
}
}