aboutsummaryrefslogtreecommitdiff
path: root/src/world/shapes/mod.rs
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-08-06 12:39:51 +0200
committerJulian T <julian@jtle.dk>2021-08-06 12:39:51 +0200
commit8e3bc57bf03457c33088e62c9d30da0565730257 (patch)
tree6aba7020638f6060ff0bd033ef72ea557b6a2203 /src/world/shapes/mod.rs
parent978580ff9464f7470c46f3084ee26021b71933c8 (diff)
Add box shape and replicate RTTNW boxHEADmaster
Diffstat (limited to 'src/world/shapes/mod.rs')
-rw-r--r--src/world/shapes/mod.rs26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/world/shapes/mod.rs b/src/world/shapes/mod.rs
index 6e4b2ce..d15840c 100644
--- a/src/world/shapes/mod.rs
+++ b/src/world/shapes/mod.rs
@@ -1,32 +1,10 @@
mod sphere;
mod rectangle;
+mod r#box;
pub use sphere::Sphere;
pub use rectangle::{Rect, Plane};
+pub use r#box::BoxShp;
use crate::world::{Hittable, Intersection};
use crate::core::{Bound3f, Ray};
-
-pub enum Shape {
- Sphere(Sphere),
-}
-
-impl Hittable for Shape {
- fn intersect(&self, ray: &Ray) -> Option<Intersection> {
- match self {
- Self::Sphere(sph) => sph.intersect(ray)
- }
- }
-
- fn bounding_box(&self) -> Bound3f {
- match self {
- Self::Sphere(sph) => sph.bounding_box()
- }
- }
-}
-
-impl From<Sphere> for Shape {
- fn from(s: Sphere) -> Self {
- Self::Sphere(s)
- }
-}