Use the standard library's LN_2 constant

This commit is contained in:
Turtle1331 2022-03-16 21:49:09 -07:00
parent a056c6f934
commit 655400cf37
1 changed files with 3 additions and 4 deletions

View File

@ -1,8 +1,7 @@
use glam::{Mat4, Quat, Vec2, Vec3}; use glam::{Mat4, Quat, Vec2, Vec3};
use std::time::Instant; use std::time::Instant;
use winit::event::{ElementState, VirtualKeyCode}; use winit::event::{ElementState, VirtualKeyCode};
use std::f32::consts::LN_2;
const LN2: f32 = 0.6931472; // TODO figure out how to use lazy_static! or something
pub trait Camera { pub trait Camera {
fn get_eye(&self) -> [f32; 4]; fn get_eye(&self) -> [f32; 4];
@ -58,8 +57,8 @@ impl Flycam {
velocity: Vec3::new(0.0, 0.0, 0.0), velocity: Vec3::new(0.0, 0.0, 0.0),
position: Vec3::new(0.0, 0.5, 1.0), position: Vec3::new(0.0, 0.5, 1.0),
turn_sensitivity, turn_sensitivity,
thrust_mag: thrust_speed / damper_half_life * LN2, thrust_mag: thrust_speed / damper_half_life * LN_2,
damping_coeff: LN2 / damper_half_life, damping_coeff: LN_2 / damper_half_life,
aspect: 1.0, // TODO compute from size aspect: 1.0, // TODO compute from size
fovy: std::f32::consts::FRAC_PI_2, fovy: std::f32::consts::FRAC_PI_2,
znear: 0.01, znear: 0.01,