Skip to content

Commit 044f5da

Browse files
committed
Book 3 listg 30: mixture_pdf needs shared_ptr args
Resolves #608
1 parent e46df59 commit 044f5da

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
@@ -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 30, `mixture_pdf` needs `shared_ptr` arguments (#608)
1011

1112

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

books/RayTracingTheRestOfYourLife.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,10 +1800,10 @@
18001800

18011801
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
18021802
shared_ptr<hittable> light_ptr = make_shared<xz_rect>(213, 343, 227, 332, 554, 0);
1803-
hittable_pdf p0(light_ptr, rec.p);
18041803

1805-
cosine_pdf p1(rec.normal);
1806-
mixture_pdf p(&p0, &p1);
1804+
auto p0 = make_shared<hittable_pdf>(light_ptr, 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)