aboutsummaryrefslogtreecommitdiff
path: root/src/trace/mod.rs
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-08-05 15:44:40 +0200
committerJulian T <julian@jtle.dk>2021-08-05 15:44:40 +0200
commit3ef8f4d918406eec6bdc29e0ebd883fabfac9b2e (patch)
treeaa4b1aac1e165821c16f222ebfb9212a9740e98b /src/trace/mod.rs
parent45119506c0293fdde6cef35f6e6f82d4055b46b6 (diff)
Add picture for c5505ab84820248c6dba35fc06aef9e0ced183derendered
Diffstat (limited to 'src/trace/mod.rs')
-rw-r--r--src/trace/mod.rs41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/trace/mod.rs b/src/trace/mod.rs
deleted file mode 100644
index d45fb23..0000000
--- a/src/trace/mod.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-use crate::world::{Hittable, Scene};
-use crate::core::{Spectrum, Ray, Vector3f};
-use crate::sample::Sampler;
-
-mod pathtrace;
-pub use pathtrace::PathTracer;
-
-/// Simple surface normal tracer
-///
-/// This ray tracer bases color values on the hit surface normals
-pub struct NormTracer<'a> {
- scn: &'a Scene,
-}
-
-/// Alias for chosen trace implementation.
-///
-/// This is swiched at compile time to save alot of time.
-pub type DefaultTracer<'a> = PathTracer<'a>;
-
-pub trait Tracer {
- fn trace(&self, sampler: &mut dyn Sampler, ray: &Ray) -> Spectrum;
-}
-
-impl NormTracer<'_> {
- pub fn new(scn: &Scene) -> NormTracer {
- NormTracer {scn}
- }
-}
-
-impl Tracer for NormTracer<'_> {
- fn trace(&self, _: &mut dyn Sampler, ray: &Ray) -> Spectrum {
- // Trace ray, we dont care about material
- if let Some(i) = self.scn.intersect(ray) {
- let norm = i.n * 0.5 + Vector3f::new(0.5);
-
- return Spectrum::new_rgb(norm.x, norm.y, norm.z);
- }
-
- Spectrum::new_rgb(0.0, 0.0, 0.0)
- }
-}