Skip to content

Commit f3df879

Browse files
committed
Merge branch 'development' into tdb/normals_and_dielectrics_rebase
2 parents 48452d8 + cf3b2bd commit f3df879

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

books/RayTracingInOneWeekend.html

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,10 @@
140140
1 253 51
141141
2 253 51
142142
3 253 51
143-
4 253 51
144143
5 253 51
145144
6 253 51
146145
7 253 51
147146
8 253 51
148-
9 253 51
149-
10 253 51
150-
11 253 51
151-
12 253 51
152-
13 253 51
153-
14 253 51
154-
15 253 51
155147
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156148
[Listing [first-img]: First image output]
157149
</div>

books/RayTracingTheNextWeek.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -694,17 +694,20 @@
694694
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
695695
class bvh_node : public hittable {
696696
public:
697+
bvh_node();
698+
697699
bvh_node(hittable_list& list, double time0, double time1)
698-
: bvh_node(list.objects, 0, 0, time0, time1)
700+
: bvh_node(list.objects, 0, list.objects.size(), time0, time1)
699701
{}
700702

701703
bvh_node(
702-
std::vector<hittable*> &objects,
704+
std::vector<hittable*>& objects,
703705
size_t start, size_t end, double time0, double time1);
704706

705707
virtual bool hit(const ray& r, double tmin, double tmax, hit_record& rec) const;
706708
virtual bool bounding_box(double t0, double t1, aabb& output_box) const;
707709

710+
public:
708711
hittable *left;
709712
hittable *right;
710713
aabb box;
@@ -769,7 +772,9 @@
769772
#include <algorithm>
770773
...
771774

772-
bvh_node::bvh_node(std::vector<hittable*>& objects, int n, double time0, double time1) {
775+
bvh_node::bvh_node(
776+
std::vector<hittable*>& objects, size_t start, size_t end, double time0, double time1
777+
) {
773778
int axis = random_int(0,2);
774779
auto comparator = (axis == 0) ? box_x_compare
775780
: (axis == 1) ? box_y_compare

books/RayTracingTheRestOfYourLife.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2139,7 +2139,6 @@
21392139
auto u = (i + random_double()) / nx;
21402140
auto v = (j + random_double()) / ny;
21412141
ray r = cam->get_ray(u, v);
2142-
vec3 p = r.at(2.0);
21432142
col += ray_color(r, world, glass_sphere, max_depth);
21442143
}
21452144
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/TheRestOfYourLife/bvh.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,27 @@
1818

1919
class bvh_node : public hittable {
2020
public:
21-
bvh_node::bvh_node(hittable_list &list, double time0, double time1)
22-
: bvh_node(list.objects, 0, 0, time0, time1)
21+
bvh_node();
22+
23+
bvh_node(hittable_list& list, double time0, double time1)
24+
: bvh_node(list.objects, 0, list.objects.size(), time0, time1)
2325
{}
2426

2527
bvh_node(
26-
std::vector<hittable*> &objects,
28+
std::vector<hittable*>& objects,
2729
size_t start, size_t end, double time0, double time1);
2830

2931
virtual bool hit(const ray& r, double t_min, double t_max, hit_record& rec) const;
3032
virtual bool bounding_box(double t0, double t1, aabb& output_box) const;
3133

34+
public:
3235
hittable *left;
3336
hittable *right;
3437
aabb box;
3538
};
3639

3740

38-
inline bool box_compare(const hittable *a, const hittable *b, int axis) {
41+
inline bool box_compare(const hittable* a, const hittable* b, int axis) {
3942
aabb box_a;
4043
aabb box_b;
4144

@@ -46,9 +49,9 @@ inline bool box_compare(const hittable *a, const hittable *b, int axis) {
4649
}
4750

4851

49-
bool box_x_compare (const hittable *a, const hittable *b) { return box_compare(a, b, 0); }
50-
bool box_y_compare (const hittable *a, const hittable *b) { return box_compare(a, b, 1); }
51-
bool box_z_compare (const hittable *a, const hittable *b) { return box_compare(a, b, 2); }
52+
bool box_x_compare (const hittable* a, const hittable* b) { return box_compare(a, b, 0); }
53+
bool box_y_compare (const hittable* a, const hittable* b) { return box_compare(a, b, 1); }
54+
bool box_z_compare (const hittable* a, const hittable* b) { return box_compare(a, b, 2); }
5255

5356

5457
bvh_node::bvh_node(

0 commit comments

Comments
 (0)