diff options
author | Julian T <julian@jtle.dk> | 2021-03-06 16:15:26 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2021-03-06 16:15:26 +0100 |
commit | 3f78cacdd93036dbd51bae77d5d8e5430a0bc75f (patch) | |
tree | 13d5e08607f44f30664ee9ced3fb139faeb5a67d /src/world/scene.rs | |
parent | da1c3949a449f3fafe579c62ff6b14ffd993a197 (diff) |
Several changes to bounding boxes
For instance removed support for shapes without a bounding box, such as
planes
Diffstat (limited to 'src/world/scene.rs')
-rw-r--r-- | src/world/scene.rs | 14 |
1 files changed, 10 insertions, 4 deletions
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<Intersection> { 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(), } } } |