Skip to content

Commit b997f18

Browse files
authored
Merge pull request #612 from RayTracing/fix-608
Book 3 listg 30: mixture_pdf needs shared_ptr args
2 parents ee077cb + a33ef27 commit b997f18

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

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

1516

books/RayTracingTheRestOfYourLife.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,9 +1801,9 @@
18011801
shared_ptr<hittable> light_shape =
18021802
make_shared<xz_rect>(213, 343, 227, 332, 554, make_shared<material>());
18031803
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
1804-
hittable_pdf p0(light_shape, rec.p);
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());

0 commit comments

Comments
 (0)