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/core/ray.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/core/ray.rs') diff --git a/src/core/ray.rs b/src/core/ray.rs index 2368315..f5517ce 100644 --- a/src/core/ray.rs +++ b/src/core/ray.rs @@ -1,8 +1,15 @@ //! The ray class used when probing the 3d scene use crate::core::Vector3f; +use crate::Float; pub struct Ray { pub origin: Vector3f, pub direction: Vector3f, } +impl Ray { + pub fn at(&self, t: Float) -> Vector3f { + self.origin + self.direction * t + } +} + -- cgit v1.2.3