aboutsummaryrefslogtreecommitdiff
path: root/src/scene/shapes
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-02-08 14:32:11 +0100
committerJulian T <julian@jtle.dk>2021-02-08 14:32:11 +0100
commitdbe5f54957ddc13549a6ce822da95170aa09a0c6 (patch)
tree7cc45f25dd75cb7893fd0af49ae5353e38c5e392 /src/scene/shapes
parent6df0417568ef6f315138d9c3fd707ac3241a6a30 (diff)
Rename to pathtrace, started for of depth of field, choose closest intersect
Diffstat (limited to 'src/scene/shapes')
-rw-r--r--src/scene/shapes/sphere.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/scene/shapes/sphere.rs b/src/scene/shapes/sphere.rs
index 3f07b9e..eaa6625 100644
--- a/src/scene/shapes/sphere.rs
+++ b/src/scene/shapes/sphere.rs
@@ -44,6 +44,7 @@ impl Hittable for Sphere {
Some(Intersection {
n: self.norm_at(&w),
p: w,
+ t: distance,
})
}
@@ -63,7 +64,7 @@ mod tests {
direction: Vector3f::new_xyz(0.0, 1.0, 1.5).norm(),
};
- let dist = sph.intersect(&ray);
- assert!((dist.unwrap() - 3.28).abs() < 0.01);
+ let dist = sph.intersect(&ray).unwrap();
+ assert!((dist.t - 3.28).abs() < 0.01);
}
}