From 3f78cacdd93036dbd51bae77d5d8e5430a0bc75f Mon Sep 17 00:00:00 2001 From: Julian T Date: Sat, 6 Mar 2021 16:15:26 +0100 Subject: Several changes to bounding boxes For instance removed support for shapes without a bounding box, such as planes --- src/world/scene.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/world/scene.rs') diff --git a/src/world/scene.rs b/src/world/scene.rs index 03578be..6d15fc1 100644 --- a/src/world/scene.rs +++ b/src/world/scene.rs @@ -1,9 +1,11 @@ -use crate::core::Ray; +use crate::core::{Bound3f, Ray}; -use super::{Object, HittableList, Hittable, Intersection}; +use super::{Object, container, Hittable, Intersection}; + +type Container = container::HittableList; pub struct Scene { - content: HittableList, + content: Container, } impl Scene { @@ -26,12 +28,16 @@ impl Hittable for Scene { fn intersect(&self, ray: &Ray) -> Option { self.content.intersect(ray) } + + fn bounding_box(&self) -> Bound3f { + self.content.bounding_box() + } } impl Default for Scene { fn default() -> Self { Self { - content: HittableList::new(), + content: Container::new(), } } } -- cgit v1.2.3