Skip to content

Commit ed55562

Browse files
committed
Copy bvh_node changes from nextWeek to restLife
1 parent b436d14 commit ed55562

File tree

1 file changed

+3
-8
lines changed
  • src/TheRestOfYourLife

1 file changed

+3
-8
lines changed

src/TheRestOfYourLife/bvh.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,15 @@ bool box_z_compare (const hittable *a, const hittable *b) { return box_compare(a
5252

5353

5454
bvh_node::bvh_node(
55-
std::vector<hittable*> &objects, size_t start, size_t end, double time0, double time1
55+
std::vector<hittable*>& objects, size_t start, size_t end, double time0, double time1
5656
) {
57-
if (end <= start) {
58-
start = 0;
59-
end = objects.size();
60-
}
61-
62-
size_t object_span = end - start;
63-
6457
int axis = random_int(0,2);
6558
auto comparator = (axis == 0) ? box_x_compare
6659
: (axis == 1) ? box_y_compare
6760
: box_z_compare;
6861

62+
size_t object_span = end - start;
63+
6964
if (object_span == 1) {
7065
left = right = objects[start];
7166
} else if (object_span == 2) {

0 commit comments

Comments
 (0)