Skip to content

Commit d3e5bf9

Browse files
committed
Add missing camera::ray_color change for emission
Resolves #1314
1 parent a23eb7b commit d3e5bf9

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

books/RayTracingTheRestOfYourLife.html

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2487,7 +2487,7 @@
24872487
----------------------------------
24882488
The noisy pops around the light on the ceiling are because the light is two-sided and there is a
24892489
small space between light and ceiling. We probably want to have the light just emit down. We can do
2490-
that by letting the emitted member function of hittable take extra information:
2490+
that by letting the `hittable::emitted()` function take extra information:
24912491

24922492
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
24932493
class material {
@@ -2524,6 +2524,28 @@
25242524
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25252525
[Listing [emitted-directional]: <kbd>[material.h]</kbd> Material emission, directional]
25262526

2527+
2528+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2529+
class camera {
2530+
...
2531+
private:
2532+
color ray_color(const ray& r, int depth, const hittable& world) const {
2533+
...
2534+
2535+
2536+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
2537+
color color_from_emission = rec.mat->emitted(r, rec, rec.u, rec.v, rec.p);
2538+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2539+
2540+
...
2541+
}
2542+
};
2543+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2544+
[Listing [emitted-ray-color]: <kbd>[camera.h]</kbd>
2545+
Material emission, camera::ray_color() changes
2546+
]
2547+
2548+
25272549
<div class='together'>
25282550
This gives us:
25292551

0 commit comments

Comments
 (0)