diff --git a/src/camera.rs b/src/camera.rs index c654d66..290de7f 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -1,6 +1,5 @@ -use std::f32::consts::PI; -use crate::{ray::Ray, vec3::Vec3}; +use crate::{ray::Ray, util::deg_to_rad, vec3::Vec3}; #[derive(Debug)] pub struct Camera { @@ -27,11 +26,6 @@ pub struct Camera { defocus_disk_v: Vec3, } -// FIXME (low priority): kinda out of place in this file. -fn deg_to_rad(deg: f32) -> f32 { - deg * PI / 180. -} - impl Camera { pub fn new() -> Self { Self { diff --git a/src/main.rs b/src/main.rs index ae1b3b7..94bd04a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ #![feature(core_float_math)] +mod util; mod camera; mod objects; mod ray; diff --git a/src/util.rs b/src/util.rs new file mode 100644 index 0000000..692e3f0 --- /dev/null +++ b/src/util.rs @@ -0,0 +1,6 @@ +use std::f32::consts::PI; + +pub(crate) fn deg_to_rad(deg: f32) -> f32 { + deg * PI / 180. +} +