Skip to content

Commit b112511

Browse files
committed
Fix references to lambertian constructor
The prior code initialized lambertian materials with a texture, but that change has not yet occurred in the text. Restore it to the state at the end of book 1, where the lambertian constructor took a vector argument. Resolves #343
1 parent a919d02 commit b112511

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

books/RayTracingTheNextWeek.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@
275275
hittable_list random_scene() {
276276
hittable_list world;
277277

278-
world.add(make_shared<sphere>(vec3(0,-1000,0), 1000, make_shared<lambertian>(checker)));
278+
world.add(make_shared<sphere>(
279+
vec3(0,-1000,0), 1000, make_shared<lambertian>(vec3(0.5, 0.5, 0.5))));
279280

280281
int i = 1;
281282
for (int a = -10; a < 10; a++) {
@@ -288,8 +289,7 @@
288289
auto albedo = vec3::random() * vec3::random();
289290
world.add(make_shared<moving_sphere>(
290291
center, center + vec3(0, random_double(0,.5), 0), 0.0, 1.0, 0.2,
291-
make_shared<lambertian>(make_shared<constant_texture>(albedo))
292-
));
292+
make_shared<lambertian>(albedo)));
293293
} else if (choose_mat < 0.95) {
294294
// metal
295295
auto albedo = vec3::random(.5, 1);

0 commit comments

Comments
 (0)