Skip to content

Commit 3971dab

Browse files
authored
Fix change highlighting for listing 30, 46
Resolves #1313
1 parent f129a52 commit 3971dab

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

books/RayTracingTheRestOfYourLife.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2251,17 +2251,17 @@
22512251
class lambertian : public material {
22522252
public:
22532253
...
2254-
2254+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
22552255
bool scatter(
2256-
const ray& r_in, const hit_record& rec, color& alb, ray& scattered, double& pdf
2256+
const ray& r_in, const hit_record& rec, color& attenuation, ray& scattered, double& pdf
22572257
) const override {
2258-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
22592258
onb uvw;
22602259
uvw.build_from_w(rec.normal);
22612260
auto scatter_direction = uvw.local(random_cosine_direction());
2262-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2261+
22632262
scattered = ray(rec.p, unit_vector(scatter_direction), r_in.time());
2264-
alb = albedo->value(rec.u, rec.v, rec.p);
2263+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2264+
attenuation = albedo->value(rec.u, rec.v, rec.p);
22652265
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
22662266
pdf = dot(uvw.w(), scattered.direction()) / pi;
22672267
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
@@ -2297,11 +2297,11 @@
22972297

22982298
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
22992299
bool scatter(
2300-
const ray& r_in, const hit_record& rec, color& alb, ray& scattered, double& pdf
2301-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2300+
const ray& r_in, const hit_record& rec, color& attenuation, ray& scattered, double& pdf
23022301
) const override {
2303-
scattered = ray(rec.p, random_unit_vector(), r_in.time());
23042302
attenuation = albedo->value(rec.u, rec.v, rec.p);
2303+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2304+
scattered = ray(rec.p, random_unit_vector(), r_in.time());
23052305
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
23062306
pdf = 1 / (4 * pi);
23072307
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
@@ -3176,10 +3176,9 @@
31763176
srec.attenuation = albedo->value(rec.u, rec.v, rec.p);
31773177
srec.pdf_ptr = make_shared<sphere_pdf>();
31783178
srec.skip_pdf = false;
3179+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
31793180
return true;
31803181
}
3181-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
3182-
31833182

31843183
double scattering_pdf(const ray& r_in, const hit_record& rec, const ray& scattered)
31853184
const override {
@@ -3268,9 +3267,10 @@
32683267
srec.attenuation = albedo;
32693268
srec.pdf_ptr = nullptr;
32703269
srec.skip_pdf = true;
3270+
32713271
vec3 reflected = reflect(unit_vector(r_in.direction()), rec.normal);
3272-
srec.skip_pdf_ray =
3273-
ray(rec.p, reflected + fuzz*random_in_unit_sphere(), r_in.time());
3272+
srec.skip_pdf_ray = ray(rec.p, reflected + fuzz*random_in_unit_sphere(), r_in.time());
3273+
32743274
return true;
32753275
}
32763276
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++

src/TheRestOfYourLife/material.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ class metal : public material {
7878
srec.attenuation = albedo;
7979
srec.pdf_ptr = nullptr;
8080
srec.skip_pdf = true;
81+
8182
vec3 reflected = reflect(unit_vector(r_in.direction()), rec.normal);
82-
srec.skip_pdf_ray =
83-
ray(rec.p, reflected + fuzz*random_in_unit_sphere(), r_in.time());
83+
srec.skip_pdf_ray = ray(rec.p, reflected + fuzz*random_in_unit_sphere(), r_in.time());
84+
8485
return true;
8586
}
8687

0 commit comments

Comments
 (0)