diff options
author | Julian T <julian@jtle.dk> | 2021-02-03 17:54:03 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2021-02-03 17:54:03 +0100 |
commit | 9235e74dfbc41895a5f8807e1ab93508268a39ea (patch) | |
tree | b8e85390b9e131736016dd2589d5e6ea14013552 /src/scene/shapes/sphere.rs | |
parent | 977b0e4152433b2a68e2b97fe5fe2c0ff6fb20d8 (diff) |
Base render of surface normal, and abstract shading and tracing to the
trace module
Diffstat (limited to 'src/scene/shapes/sphere.rs')
-rw-r--r-- | src/scene/shapes/sphere.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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)] |