From 655400cf37838aa18f3bf98308f65a552a57b618 Mon Sep 17 00:00:00 2001 From: Turtle1331 Date: Wed, 16 Mar 2022 21:49:09 -0700 Subject: [PATCH] Use the standard library's LN_2 constant --- src/camera.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index db03887..39189a0 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -1,8 +1,7 @@ use glam::{Mat4, Quat, Vec2, Vec3}; use std::time::Instant; use winit::event::{ElementState, VirtualKeyCode}; - -const LN2: f32 = 0.6931472; // TODO figure out how to use lazy_static! or something +use std::f32::consts::LN_2; pub trait Camera { fn get_eye(&self) -> [f32; 4]; @@ -58,8 +57,8 @@ impl Flycam { velocity: Vec3::new(0.0, 0.0, 0.0), position: Vec3::new(0.0, 0.5, 1.0), turn_sensitivity, - thrust_mag: thrust_speed / damper_half_life * LN2, - damping_coeff: LN2 / damper_half_life, + thrust_mag: thrust_speed / damper_half_life * LN_2, + damping_coeff: LN_2 / damper_half_life, aspect: 1.0, // TODO compute from size fovy: std::f32::consts::FRAC_PI_2, znear: 0.01,