From da1c3949a449f3fafe579c62ff6b14ffd993a197 Mon Sep 17 00:00:00 2001 From: Julian T Date: Sun, 21 Feb 2021 18:01:56 +0100 Subject: Add 3d bounding box and merged SceneIntersection and Intersection --- src/core/hittable.rs | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 src/core/hittable.rs (limited to 'src/core/hittable.rs') diff --git a/src/core/hittable.rs b/src/core/hittable.rs deleted file mode 100644 index e495d5b..0000000 --- a/src/core/hittable.rs +++ /dev/null @@ -1,25 +0,0 @@ -use crate::core::{Vector3f, Ray}; -use crate::Float; - -/// Returns the context of a intersection -pub struct Intersection { - /// Normal vector at intersection - pub n: Vector3f, - pub p: Vector3f, - pub t: Float, -} - -impl Intersection { - pub fn norm_against_ray(&self, r: &Ray) -> Vector3f { - if self.n.dot(&r.direction) < 0.0 { - self.n - } else { - -self.n - } - } -} - -/// Defines a common trait for objects in the scene -pub trait Hittable { - fn intersect(&self, ray: &Ray) -> Option; -} -- cgit v1.2.3