Skip to content

Commit 2c6e0f2

Browse files
authored
Merge pull request #667 from RayTracing/drop-scenes-79
Pull scenes 7 & 9 from book 2
2 parents 82796b2 + 09fb6ff commit 2c6e0f2

File tree

3 files changed

+32
-89
lines changed

3 files changed

+32
-89
lines changed

CHANGELOG.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,6 @@ Change Log -- Ray Tracing in One Weekend
99
- Change: Added header guards to the text of all three books whenever a new header file was
1010
introduced
1111

12-
### _The Next Week_
13-
- Removed: Deleted the section covering the old `flip_face` class, renumbered images as this
14-
eliminated the rendering with missing Cornell box faces (#482, #661)
15-
- Change: Renamed and explicitly numbered book images and figures (#495)
16-
- Fix: Reduced code duplication in dielectric::scatter() function
17-
- New: Added alternative constructors that take color arguments in addition to the constructors
18-
that take `shared_ptr<texture>` arguments, simplifying calling code. This applies to the
19-
following classes: `checker_texture`, `constant_medium`, `diffuse_light`, and `lambertian`.
20-
(#516)
21-
- Fix: "Intance" typo in Chapter 8.1 to "Instance" (#629)
22-
2312
### _In One Weekend_
2413
- Change: Updated all rendered images except for 1.13, 1.14 (#179, #547, #548, #549, #550, #551,
2514
#552, #553, #554, #555, #556, #557, #560, #561, #562, #563, #564, #565, #566)
@@ -46,9 +35,20 @@ Change Log -- Ray Tracing in One Weekend
4635
- New: Add new isotropic constructor taking color argument (#644)
4736

4837
### _The Next Week_
38+
- Removed: Deleted the section covering the old `flip_face` class, renumbered images as this
39+
eliminated the rendering with missing Cornell box faces (#482, #661)
40+
- Change: Renamed and explicitly numbered book images and figures (#495)
41+
- Fix: Reduced code duplication in dielectric::scatter() function
42+
- New: Added alternative constructors that take color arguments in addition to the constructors
43+
that take `shared_ptr<texture>` arguments, simplifying calling code. This applies to the
44+
following classes: `checker_texture`, `constant_medium`, `diffuse_light`, and `lambertian`.
45+
(#516)
46+
- Fix: "Intance" typo in Chapter 8.1 to "Instance" (#629)
4947
- Fix: Listing 7: Show reverted viewing parameters from book 1 final scene
5048
- Change: Listing 10: Separate out world & camera definitions in main (#646)
5149
- New: Add new isotropic constructor taking color argument (#644)
50+
- Removed: scenes 7 & 9 from the original (`cornell_balls` and `cornell_final`). There are now a
51+
total of eight scenes for the second book (#653, #620)
5252

5353

5454
----------------------------------------------------------------------------------------------------

books/RayTracingTheNextWeek.html

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2969,7 +2969,7 @@
29692969

29702970
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
29712971
shared_ptr<hittable> box1 = make_shared<box>(point3(0, 0, 0), point3(165, 330, 165), white);
2972-
box1 = make_shared<rotate_y>(box1, 15);
2972+
box1 = make_shared<rotate_y>(box1, 15);
29732973
box1 = make_shared<translate>(box1, vec3(265,0,295));
29742974
objects.add(box1);
29752975

@@ -3180,7 +3180,7 @@
31803180
objects.add(make_shared<xy_rect>(0, 555, 0, 555, 555, white));
31813181

31823182
shared_ptr<hittable> box1 = make_shared<box>(point3(0,0,0), point3(165,330,165), white);
3183-
box1 = make_shared<rotate_y>(box1, 15);
3183+
box1 = make_shared<rotate_y>(box1, 15);
31843184
box1 = make_shared<translate>(box1, vec3(265,0,295));
31853185

31863186
shared_ptr<hittable> box2 = make_shared<box>(point3(0,0,0), point3(165,165,165), white);
@@ -3192,6 +3192,22 @@
31923192

31933193
return objects;
31943194
}
3195+
3196+
...
3197+
3198+
int main() {
3199+
...
3200+
switch (0) {
3201+
...
3202+
default:
3203+
case 7:
3204+
world = cornell_smoke();
3205+
lookfrom = point3(278, 278, -800);
3206+
lookat = point3(278, 278, 0);
3207+
vfov = 40.0;
3208+
break;
3209+
...
3210+
}
31953211
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31963212
[Listing [cornell-smoke]: <kbd>[main.cc]</kbd> Cornell box, with smoke]
31973213
</div>

src/TheNextWeek/main.cc

Lines changed: 3 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ hittable_list cornell_box() {
160160
objects.add(make_shared<xy_rect>(0, 555, 0, 555, 555, white));
161161

162162
shared_ptr<hittable> box1 = make_shared<box>(point3(0,0,0), point3(165,330,165), white);
163-
box1 = make_shared<rotate_y>(box1, 15);
163+
box1 = make_shared<rotate_y>(box1, 15);
164164
box1 = make_shared<translate>(box1, vec3(265,0,295));
165165
objects.add(box1);
166166

@@ -173,34 +173,6 @@ hittable_list cornell_box() {
173173
}
174174

175175

176-
hittable_list cornell_balls() {
177-
hittable_list objects;
178-
179-
auto red = make_shared<lambertian>(color(.65, .05, .05));
180-
auto white = make_shared<lambertian>(color(.73, .73, .73));
181-
auto green = make_shared<lambertian>(color(.12, .45, .15));
182-
auto light = make_shared<diffuse_light>(color(5, 5, 5));
183-
184-
objects.add(make_shared<yz_rect>(0, 555, 0, 555, 555, green));
185-
objects.add(make_shared<yz_rect>(0, 555, 0, 555, 0, red));
186-
objects.add(make_shared<xz_rect>(113, 443, 127, 432, 554, light));
187-
objects.add(make_shared<xz_rect>(0, 555, 0, 555, 555, white));
188-
objects.add(make_shared<xz_rect>(0, 555, 0, 555, 0, white));
189-
objects.add(make_shared<xy_rect>(0, 555, 0, 555, 555, white));
190-
191-
auto boundary = make_shared<sphere>(point3(160,100,145), 100, make_shared<dielectric>(1.5));
192-
objects.add(boundary);
193-
objects.add(make_shared<constant_medium>(boundary, 0.1, color(1,1,1)));
194-
195-
shared_ptr<hittable> box1 = make_shared<box>(point3(0,0,0), point3(165,330,165), white);
196-
box1 = make_shared<rotate_y>(box1, 15);
197-
box1 = make_shared<translate>(box1, vec3(265,0,295));
198-
objects.add(box1);
199-
200-
return objects;
201-
}
202-
203-
204176
hittable_list cornell_smoke() {
205177
hittable_list objects;
206178

@@ -217,7 +189,7 @@ hittable_list cornell_smoke() {
217189
objects.add(make_shared<xy_rect>(0, 555, 0, 555, 555, white));
218190

219191
shared_ptr<hittable> box1 = make_shared<box>(point3(0,0,0), point3(165,330,165), white);
220-
box1 = make_shared<rotate_y>(box1, 15);
192+
box1 = make_shared<rotate_y>(box1, 15);
221193
box1 = make_shared<translate>(box1, vec3(265,0,295));
222194

223195
shared_ptr<hittable> box2 = make_shared<box>(point3(0,0,0), point3(165,165,165), white);
@@ -231,37 +203,6 @@ hittable_list cornell_smoke() {
231203
}
232204

233205

234-
hittable_list cornell_final() {
235-
hittable_list objects;
236-
237-
auto pertext = make_shared<noise_texture>(0.1);
238-
239-
auto mat = make_shared<lambertian>(make_shared<image_texture>("earthmap.jpg"));
240-
241-
auto red = make_shared<lambertian>(color(.65, .05, .05));
242-
auto white = make_shared<lambertian>(color(.73, .73, .73));
243-
auto green = make_shared<lambertian>(color(.12, .45, .15));
244-
auto light = make_shared<diffuse_light>(color(7, 7, 7));
245-
246-
objects.add(make_shared<yz_rect>(0, 555, 0, 555, 555, green));
247-
objects.add(make_shared<yz_rect>(0, 555, 0, 555, 0, red));
248-
objects.add(make_shared<xz_rect>(123, 423, 147, 412, 554, light));
249-
objects.add(make_shared<xz_rect>(0, 555, 0, 555, 555, white));
250-
objects.add(make_shared<xz_rect>(0, 555, 0, 555, 0, white));
251-
objects.add(make_shared<xy_rect>(0, 555, 0, 555, 555, white));
252-
253-
shared_ptr<hittable> boundary2 =
254-
make_shared<box>(point3(0,0,0), point3(165,165,165), make_shared<dielectric>(1.5));
255-
boundary2 = make_shared<rotate_y>(boundary2, -18);
256-
boundary2 = make_shared<translate>(boundary2, vec3(130,0,65));
257-
258-
objects.add(boundary2);
259-
objects.add(make_shared<constant_medium>(boundary2, 0.2, color(0.9, 0.9, 0.9)));
260-
261-
return objects;
262-
}
263-
264-
265206
hittable_list final_scene() {
266207
hittable_list boxes1;
267208
auto ground = make_shared<lambertian>(color(0.48, 0.83, 0.53));
@@ -397,27 +338,13 @@ int main() {
397338
break;
398339

399340
case 7:
400-
world = cornell_balls();
401-
lookfrom = point3(278, 278, -800);
402-
lookat = point3(278, 278, 0);
403-
vfov = 40.0;
404-
break;
405-
406-
case 8:
407341
world = cornell_smoke();
408342
lookfrom = point3(278, 278, -800);
409343
lookat = point3(278, 278, 0);
410344
vfov = 40.0;
411345
break;
412346

413-
case 9:
414-
world = cornell_final();
415-
lookfrom = point3(278, 278, -800);
416-
lookat = point3(278, 278, 0);
417-
vfov = 40.0;
418-
break;
419-
420-
case 10:
347+
case 8:
421348
world = final_scene();
422349
lookfrom = point3(478, 278, -600);
423350
lookat = point3(278, 278, 0);

0 commit comments

Comments
 (0)