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/sphere.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/scene/shapes/sphere.rs') diff --git a/src/scene/shapes/sphere.rs b/src/scene/shapes/sphere.rs index e30c1ec..da7f321 100644 --- a/src/scene/shapes/sphere.rs +++ b/src/scene/shapes/sphere.rs @@ -35,6 +35,12 @@ impl Shape for Sphere { } } + + fn norm_at(&self, point: &Vector3f) -> Vector3f { + let mut v = *point - self.center; + v /= self.radius; + v + } } #[cfg(test)] -- cgit v1.2.3