From 49c6adb0db70ffc30eaac33b66eacf7574b34e26 Mon Sep 17 00:00:00 2001 From: Julian T Date: Wed, 10 Feb 2021 23:06:48 +0100 Subject: Fixed most clippy warnings --- src/scene/scene.rs | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 src/scene/scene.rs (limited to 'src/scene/scene.rs') diff --git a/src/scene/scene.rs b/src/scene/scene.rs deleted file mode 100644 index 83a43c7..0000000 --- a/src/scene/scene.rs +++ /dev/null @@ -1,47 +0,0 @@ -use crate::core::{Ray, Intersection}; -use crate::material::Material; - -use super::Object; - -pub struct Scene { - objs: Vec, -} - -pub struct SceneIntersect<'a> { - pub mat: &'a dyn Material, - pub i: Intersection, -} - -impl Scene { - pub fn new() -> Self { - Self { - objs: Vec::new(), - } - } - - pub fn add_object(&mut self, obj: Object) { - self.objs.push(obj); - } - - pub fn add_objects(&mut self, objs: Vec) { - for obj in objs { - self.add_object(obj); - } - } - - pub fn intersect(&self, ray: &Ray) -> Option { - let mut min: Option = None; - - for obj in self.objs.iter() { - if let Some(i) = obj.shape.intersect(&ray) { - match min { - Some(ref si) if si.i.t < i.t => (), - _ => min = Some(SceneIntersect {i, mat: obj.mat.as_ref() }), - } - } - } - - min - } -} - -- cgit v1.2.3