@@ -138,9 +138,9 @@ impl BVHAccel {
138
138
return unwrapped. ok ( ) . unwrap ( ) ;
139
139
}
140
140
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) {
142
142
let world_bound = bvh. primitives [ i] . world_bound ( ) ;
143
- primitive_info [ i ] = BVHPrimitiveInfo :: new ( i, world_bound) ;
143
+ * item = BVHPrimitiveInfo :: new ( i, world_bound) ;
144
144
}
145
145
// TODO: if (splitMethod == SplitMethod::HLBVH)
146
146
let arena: Arena < BVHBuildNode > = Arena :: with_capacity ( 1024 * 1024 ) ;
@@ -217,15 +217,15 @@ impl BVHAccel {
217
217
* total_nodes += 1_usize ;
218
218
// compute bounds of all primitives in BVH node
219
219
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 ) ;
222
222
}
223
223
let n_primitives: usize = end - start;
224
224
if n_primitives == 1 {
225
225
// create leaf _BVHBuildNode_
226
226
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 ;
229
229
ordered_prims. push ( bvh. primitives [ prim_num] . clone ( ) ) ;
230
230
}
231
231
node. init_leaf ( first_prim_offset, n_primitives, & bounds) ;
0 commit comments