Skip to content

Commit 48198d3

Browse files
committed
Fix book 3 listing 28, 30 / use default material
The original listing had `0` where it should have had `make_shared<material>()`. Resolves #607
1 parent e46df59 commit 48198d3

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Change Log -- Ray Tracing in One Weekend
77
- Fix: Missing closing parenthesis in listing 10 (#603)
88
- Fix: Tiny improvements to the lambertian::scatter() development (#604)
99
- Fix: Correct geometry type and unit vector method in `ray_color()`, listing 20 (#606)
10+
- Fix: Listing 28, 30: `light_shape` should have default material, not `0` (#607)
1011

1112

1213
----------------------------------------------------------------------------------------------------

books/RayTracingTheRestOfYourLife.html

Lines changed: 5 additions & 5 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,11 +1798,10 @@
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-
1804+
hittable_pdf p0(light_shape, rec.p);
18051805
cosine_pdf p1(rec.normal);
18061806
mixture_pdf p(&p0, &p1);
18071807
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++

0 commit comments

Comments
 (0)