Improved camera attributes and focus

Former-commit-id: 223f85c884c063c5cbb7d6c9f9f5c4a8c62a7ffd
This commit is contained in:
Joshua Barretto 2019-04-16 19:01:56 +01:00
parent 2ea1de2659
commit db527e64df
2 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ impl Camera {
Self { Self {
focus: Vec3::unit_z() * 10.0, focus: Vec3::unit_z() * 10.0,
ori: Vec3::zero(), ori: Vec3::zero(),
dist: 150.0, dist: 10.0,
fov: 1.3, fov: 1.3,
aspect, aspect,
} }

View File

@ -97,7 +97,7 @@ impl Scene {
}, },
// Zoom the camera when a zoom event occurs // Zoom the camera when a zoom event occurs
Event::Zoom(delta) => { Event::Zoom(delta) => {
self.camera.zoom_by(-delta); self.camera.zoom_by(delta * 0.3);
true true
}, },
// All other events are unhandled // All other events are unhandled
@ -118,7 +118,7 @@ impl Scene {
.unwrap_or(Vec3::zero()); .unwrap_or(Vec3::zero());
// Alter camera position to match player // Alter camera position to match player
self.camera.set_focus_pos(player_pos); self.camera.set_focus_pos(player_pos + Vec3::unit_z() * 1.5);
// Compute camera matrices // Compute camera matrices
let (view_mat, proj_mat, cam_pos) = self.camera.compute_dependents(); let (view_mat, proj_mat, cam_pos) = self.camera.compute_dependents();