From 423d99013219f8642c5bc9530d7f2693dfff714e Mon Sep 17 00:00:00 2001 From: telastrus <10052313+telastrus@users.noreply.github.com> Date: Mon, 5 Aug 2019 12:47:07 -0400 Subject: [PATCH] reverted some unnecessary changes corrected typo ran cargo fmt --- voxygen/src/hud/settings_window.rs | 17 +++++++---------- voxygen/src/scene/camera.rs | 4 ++-- voxygen/src/scene/mod.rs | 4 ++-- voxygen/src/session.rs | 4 +++- voxygen/src/settings.rs | 4 ++-- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/voxygen/src/hud/settings_window.rs b/voxygen/src/hud/settings_window.rs index eb550c0c2a..00613311c2 100644 --- a/voxygen/src/hud/settings_window.rs +++ b/voxygen/src/hud/settings_window.rs @@ -980,7 +980,7 @@ impl<'a> Widget for SettingsWindow<'a> { .font_id(self.fonts.opensans) .color(TEXT_COLOR) .set(state.ids.max_fps_value, ui); - + // FOV Text::new("Field of View (deg)") .down_from(state.ids.max_fps_slider, 10.0) @@ -1006,15 +1006,12 @@ impl<'a> Widget for SettingsWindow<'a> { events.push(Event::AdjustFOV(new_val)); } - Text::new(&format!( - "{}", - self.global_state.settings.graphics.fov - )) - .right_from(state.ids.fov_slider, 8.0) - .font_size(14) - .font_id(self.fonts.opensans) - .color(TEXT_COLOR) - .set(state.ids.fov_value, ui); + Text::new(&format!("{}", self.global_state.settings.graphics.fov)) + .right_from(state.ids.fov_slider, 8.0) + .font_size(14) + .font_id(self.fonts.opensans) + .color(TEXT_COLOR) + .set(state.ids.fov_value, ui); } // 5) Sound Tab ----------------------------------- diff --git a/voxygen/src/scene/camera.rs b/voxygen/src/scene/camera.rs index c6d96072a3..3021652bef 100644 --- a/voxygen/src/scene/camera.rs +++ b/voxygen/src/scene/camera.rs @@ -38,7 +38,7 @@ impl Camera { ori: Vec3::zero(), tgt_dist: 10.0, dist: 10.0, - fov: 1.3, + fov: 1.1, aspect, mode, @@ -180,7 +180,7 @@ impl Camera { /// Set the FOV in degrees pub fn set_fov_deg(&mut self, fov: u16) { - //Magic value comes from p/180; no use recalculating. + //Magic value comes from pi/180; no use recalculating. self.set_fov((fov as f32) * 0.01745329) } diff --git a/voxygen/src/scene/mod.rs b/voxygen/src/scene/mod.rs index ddbb4f3343..fd5cffde92 100644 --- a/voxygen/src/scene/mod.rs +++ b/voxygen/src/scene/mod.rs @@ -80,8 +80,8 @@ impl Scene { } /// Get a reference to the scene's camera. - pub fn camera(&mut self) -> &mut Camera { - &mut self.camera + pub fn camera(&self) -> &Camera { + &self.camera } /// Get a mutable reference to the scene's camera. diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index 50b77657f2..f593086784 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -28,7 +28,9 @@ impl SessionState { pub fn new(global_state: &mut GlobalState, client: Rc>) -> Self { // Create a scene for this session. The scene handles visible elements of the game world. let mut scene = Scene::new(global_state.window.renderer_mut()); - scene.camera_mut().set_fov_deg(global_state.settings.graphics.fov); + scene + .camera_mut() + .set_fov_deg(global_state.settings.graphics.fov); Self { scene, client, diff --git a/voxygen/src/settings.rs b/voxygen/src/settings.rs index 886d7bb95a..8495bde99a 100644 --- a/voxygen/src/settings.rs +++ b/voxygen/src/settings.rs @@ -135,7 +135,7 @@ impl Default for Log { pub struct GraphicsSettings { pub view_distance: u32, pub max_fps: u32, - pub fov: u16 + pub fov: u16, } impl Default for GraphicsSettings { @@ -143,7 +143,7 @@ impl Default for GraphicsSettings { Self { view_distance: 5, max_fps: 60, - fov: 75 + fov: 75, } } }