|
1719 | 1719 |
|
1720 | 1720 |
|
1721 | 1721 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
1722 | | - shared_ptr<hittable> light_shape = make_shared<xz_rect>(213, 343, 227, 332, 554, 0); |
| 1722 | + shared_ptr<hittable> light_shape = |
| 1723 | + make_shared<xz_rect>(213, 343, 227, 332, 554, shared_ptr<material>()); |
1723 | 1724 | hittable_pdf p(light_shape, rec.p); |
1724 | 1725 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
1725 | 1726 |
|
|
1806 | 1807 | if (!rec.mat_ptr->scatter(r, rec, albedo, scattered, pdf_val)) |
1807 | 1808 | return emitted; |
1808 | 1809 |
|
1809 | | - |
| 1810 | + shared_ptr<hittable> light_shape = |
| 1811 | + make_shared<xz_rect>(213, 343, 227, 332, 554, make_shared<material>()); |
1810 | 1812 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
1811 | | - shared_ptr<hittable> light_ptr = make_shared<xz_rect>(213, 343, 227, 332, 554, 0); |
1812 | | - hittable_pdf p0(light_ptr, rec.p); |
1813 | | - |
1814 | | - cosine_pdf p1(rec.normal); |
1815 | | - mixture_pdf p(&p0, &p1); |
| 1813 | + auto p0 = make_shared<hittable_pdf>(light_shape, rec.p); |
| 1814 | + auto p1 = make_shared<cosine_pdf>(rec.normal); |
| 1815 | + mixture_pdf p(p0, p1); |
1816 | 1816 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
1817 | 1817 |
|
1818 | 1818 | scattered = ray(rec.p, p.generate(), r.time()); |
|
0 commit comments