Skip to content

Commit d25d3df

Browse files
authored
Merge branch 'dev-patch' into dev-patch
2 parents 9fe7196 + b997f18 commit d25d3df

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ Change Log -- Ray Tracing in One Weekend
55

66
### _In One Weekend_
77
- Fix: Correct typo: "Intance Translation" -> "Instance Translation"
8+
- Fix: Corrected geometry type when computing distance between two points, final scene (#609)
89

910
### _The Rest of Your Life_
1011
- Fix: Missing closing parenthesis in listing 10 (#603)
1112
- Fix: Tiny improvements to the lambertian::scatter() development (#604)
1213
- Fix: Correct geometry type and unit vector method in `ray_color()`, listing 20 (#606)
14+
- Fix: Listing 30, `mixture_pdf` needs `shared_ptr` arguments (#608)
15+
- Fix: Listing 28, 30: `light_shape` should have default material, not `0` (#607)
1316

1417

1518
----------------------------------------------------------------------------------------------------

books/RayTracingInOneWeekend.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2889,7 +2889,7 @@
28892889
auto choose_mat = random_double();
28902890
point3 center(a + 0.9*random_double(), 0.2, b + 0.9*random_double());
28912891

2892-
if ((center - vec3(4, 0.2, 0)).length() > 0.9) {
2892+
if ((center - point3(4, 0.2, 0)).length() > 0.9) {
28932893
shared_ptr<material> sphere_material;
28942894

28952895
if (choose_mat < 0.8) {

books/RayTracingTheRestOfYourLife.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,8 @@
17101710

17111711

17121712
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
1713-
shared_ptr<hittable> light_shape = make_shared<xz_rect>(213, 343, 227, 332, 554, 0);
1713+
shared_ptr<hittable> light_shape =
1714+
make_shared<xz_rect>(213, 343, 227, 332, 554, shared_ptr<material>());
17141715
hittable_pdf p(light_shape, rec.p);
17151716
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
17161717

@@ -1797,13 +1798,12 @@
17971798
if (!rec.mat_ptr->scatter(r, rec, albedo, scattered, pdf_val))
17981799
return emitted;
17991800

1800-
1801+
shared_ptr<hittable> light_shape =
1802+
make_shared<xz_rect>(213, 343, 227, 332, 554, make_shared<material>());
18011803
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
1802-
shared_ptr<hittable> light_ptr = make_shared<xz_rect>(213, 343, 227, 332, 554, 0);
1803-
hittable_pdf p0(light_ptr, rec.p);
1804-
1805-
cosine_pdf p1(rec.normal);
1806-
mixture_pdf p(&p0, &p1);
1804+
auto p0 = make_shared<hittable_pdf>(light_shape, rec.p);
1805+
auto p1 = make_shared<cosine_pdf>(rec.normal);
1806+
mixture_pdf p(p0, p1);
18071807
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
18081808

18091809
scattered = ray(rec.p, p.generate(), r.time());

src/InOneWeekend/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ hittable_list random_scene() {
5252
auto choose_mat = random_double();
5353
point3 center(a + 0.9*random_double(), 0.2, b + 0.9*random_double());
5454

55-
if ((center - vec3(4, 0.2, 0)).length() > 0.9) {
55+
if ((center - point3(4, 0.2, 0)).length() > 0.9) {
5656
shared_ptr<material> sphere_material;
5757

5858
if (choose_mat < 0.8) {

0 commit comments

Comments
 (0)