aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-02-03 17:54:03 +0100
committerJulian T <julian@jtle.dk>2021-02-03 17:54:03 +0100
commit9235e74dfbc41895a5f8807e1ab93508268a39ea (patch)
treeb8e85390b9e131736016dd2589d5e6ea14013552 /src/core
parent977b0e4152433b2a68e2b97fe5fe2c0ff6fb20d8 (diff)
Base render of surface normal, and abstract shading and tracing to the
trace module
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ray.rs7
1 files changed, 7 insertions, 0 deletions
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
+ }
+}
+