fx: util file created
This commit is contained in:
@@ -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)]
|
#[derive(Debug)]
|
||||||
pub struct Camera {
|
pub struct Camera {
|
||||||
@@ -27,11 +26,6 @@ pub struct Camera {
|
|||||||
defocus_disk_v: Vec3,
|
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 {
|
impl Camera {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![feature(core_float_math)]
|
#![feature(core_float_math)]
|
||||||
|
|
||||||
|
mod util;
|
||||||
mod camera;
|
mod camera;
|
||||||
mod objects;
|
mod objects;
|
||||||
mod ray;
|
mod ray;
|
||||||
|
|||||||
6
src/util.rs
Normal file
6
src/util.rs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
use std::f32::consts::PI;
|
||||||
|
|
||||||
|
pub(crate) fn deg_to_rad(deg: f32) -> f32 {
|
||||||
|
deg * PI / 180.
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user