From 9235e74dfbc41895a5f8807e1ab93508268a39ea Mon Sep 17 00:00:00 2001 From: Julian T Date: Wed, 3 Feb 2021 17:54:03 +0100 Subject: Base render of surface normal, and abstract shading and tracing to the trace module --- src/scene/shapes/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/scene/shapes/mod.rs') diff --git a/src/scene/shapes/mod.rs b/src/scene/shapes/mod.rs index 7fbb8db..9b6bdfd 100644 --- a/src/scene/shapes/mod.rs +++ b/src/scene/shapes/mod.rs @@ -2,9 +2,15 @@ mod sphere; pub use sphere::Sphere; -use crate::core::Ray; +use crate::core::{Vector3f, Ray}; use crate::Float; pub trait Shape { fn intersect(&self, ray: &Ray) -> Option; + + /// Calculates the normal at point + /// + /// Point is assumed to be on the circle. + /// The resulting vector is assumed to be normalized. + fn norm_at(&self, point: &Vector3f) -> Vector3f; } -- cgit v1.2.3