Skip to content

Commit 9a4423f

Browse files
committed
[clippy] needless_range_loop.
1 parent 8196357 commit 9a4423f

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

src/accelerators/bvh.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ impl BVHAccel {
138138
return unwrapped.ok().unwrap();
139139
}
140140
let mut primitive_info = vec![BVHPrimitiveInfo::default(); num_prims];
141-
for i in 0..num_prims {
141+
for (i, item) in primitive_info.iter_mut().enumerate().take(num_prims) {
142142
let world_bound = bvh.primitives[i].world_bound();
143-
primitive_info[i] = BVHPrimitiveInfo::new(i, world_bound);
143+
*item = BVHPrimitiveInfo::new(i, world_bound);
144144
}
145145
// TODO: if (splitMethod == SplitMethod::HLBVH)
146146
let arena: Arena<BVHBuildNode> = Arena::with_capacity(1024 * 1024);
@@ -217,15 +217,15 @@ impl BVHAccel {
217217
*total_nodes += 1_usize;
218218
// compute bounds of all primitives in BVH node
219219
let mut bounds: Bounds3f = Bounds3f::default();
220-
for i in start..end {
221-
bounds = bnd3_union_bnd3(&bounds, &primitive_info[i].bounds);
220+
for item in primitive_info.iter().take(end).skip(start) {
221+
bounds = bnd3_union_bnd3(&bounds, &item.bounds);
222222
}
223223
let n_primitives: usize = end - start;
224224
if n_primitives == 1 {
225225
// create leaf _BVHBuildNode_
226226
let first_prim_offset: usize = ordered_prims.len();
227-
for i in start..end {
228-
let prim_num: usize = primitive_info[i].primitive_number;
227+
for item in primitive_info.iter().take(end).skip(start) {
228+
let prim_num: usize = item.primitive_number;
229229
ordered_prims.push(bvh.primitives[prim_num].clone());
230230
}
231231
node.init_leaf(first_prim_offset, n_primitives, &bounds);

src/core/integrator.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -474,14 +474,8 @@ pub fn estimate_direct(
474474
// compute effect of visibility for light source sample
475475
if handle_media {
476476
li *= visibility.tr(scene, sampler);
477-
// TODO: VLOG(2) << " after Tr, Li: " << Li;
478-
} else {
479-
if !visibility.unoccluded(scene) {
480-
// TODO: println!(" shadow ray blocked");
481-
li = Spectrum::new(0.0 as Float);
482-
} else {
483-
// TODO: println!(" shadow ray unoccluded");
484-
}
477+
} else if !visibility.unoccluded(scene) {
478+
li = Spectrum::new(0.0 as Float);
485479
}
486480
// add light's contribution to reflected radiance
487481
if !li.is_black() {

0 commit comments

Comments
 (0)