aboutsummaryrefslogtreecommitdiff
path: root/src/world/mod.rs
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-08-05 15:44:40 +0200
committerJulian T <julian@jtle.dk>2021-08-05 15:44:40 +0200
commit3ef8f4d918406eec6bdc29e0ebd883fabfac9b2e (patch)
treeaa4b1aac1e165821c16f222ebfb9212a9740e98b /src/world/mod.rs
parent45119506c0293fdde6cef35f6e6f82d4055b46b6 (diff)
Add picture for c5505ab84820248c6dba35fc06aef9e0ced183derendered
Diffstat (limited to 'src/world/mod.rs')
-rw-r--r--src/world/mod.rs42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/world/mod.rs b/src/world/mod.rs
deleted file mode 100644
index cba6ddc..0000000
--- a/src/world/mod.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-//! Manages world objects, and implements intersection
-pub mod shapes;
-
-mod scene;
-pub mod container;
-mod hittable;
-pub use scene::*;
-pub use hittable::{Intersection, Hittable};
-pub use shapes::Shape;
-
-use std::sync::Arc;
-use crate::material::Material;
-use crate::core::{Bound3f, Ray};
-
-pub struct Object {
- pub shape: Shape,
- pub mat: Arc<dyn Material>,
-}
-
-impl Object {
- pub fn new<T: Into<Shape>>(mat: Arc<dyn Material>, shape: T) -> Self {
- Object {
- mat,
- shape: shape.into(),
- }
- }
-}
-
-impl Hittable for Object {
- fn intersect(&self, ray: &Ray) -> Option<Intersection> {
- if let Some(mut inter) = self.shape.intersect(ray) {
- inter.add_material_if_none(self.mat.as_ref());
- Some(inter)
- } else {
- None
- }
- }
-
- fn bounding_box(&self) -> Bound3f {
- self.shape.bounding_box()
- }
-}