aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlamp2024-01-21 17:14:08 +0000
committerlamp2024-01-21 17:14:08 +0000
commit919734955118c111c8180899c11a9a5f295ebe6d (patch)
treedf267af7cfaedad9f9ccdcfd42a31ea90974f86c /src
parent45fafbcd4b41a5388ece377c4e051b5846407288 (diff)
tidy some todosmain
Diffstat (limited to 'src')
-rw-r--r--src/hittable/aabb.rs4
-rw-r--r--src/hittable/bvh_node.rs4
-rw-r--r--src/material/metal.rs2
3 files changed, 3 insertions, 7 deletions
diff --git a/src/hittable/aabb.rs b/src/hittable/aabb.rs
index 5c5c9fa..92b8fa1 100644
--- a/src/hittable/aabb.rs
+++ b/src/hittable/aabb.rs
@@ -16,9 +16,7 @@ impl AABB {
let mut t0 = (self.minimum.get(a).unwrap() - ray.origin.get(a).unwrap()) * inv_d;
let mut t1 = (self.maximum.get(a).unwrap() - ray.origin.get(a).unwrap()) * inv_d;
if inv_d < 0.0 {
- // TODO: destructuring assignments are unstable :(
- //(t0, t1) = (t1, t0);
- std::mem::swap(&mut t0, &mut t1);
+ (t0, t1) = (t1, t0);
}
t_min = if t0 > t_min { t0 } else { t_min };
t_max = if t1 < t_max { t1 } else { t_max };
diff --git a/src/hittable/bvh_node.rs b/src/hittable/bvh_node.rs
index 405ab5b..64fa3a1 100644
--- a/src/hittable/bvh_node.rs
+++ b/src/hittable/bvh_node.rs
@@ -102,13 +102,11 @@ impl BVHNode {
.bounding_box(0.0, 0.0)
.expect("No bounding box in bvh_node constructor!");
- // TODO: total_cmp is unstable :(
box_a
.minimum
.get(axis as usize)
.unwrap()
- .partial_cmp(box_b.minimum.get(axis as usize).unwrap())
- .unwrap()
+ .total_cmp(box_b.minimum.get(axis as usize).unwrap())
}
}
diff --git a/src/material/metal.rs b/src/material/metal.rs
index 638e5e4..880f23d 100644
--- a/src/material/metal.rs
+++ b/src/material/metal.rs
@@ -5,7 +5,7 @@ use crate::{hittable::HitRecord, vec3::Vec3};
pub struct Metal {
pub albedo: Color,
- pub fuzz: f64, // TODO: This should have value 0.0 - 1.0; this is not enforced
+ pub fuzz: f64, // This should have value 0.0 - 1.0; this is not enforced
}
impl Material for Metal {