Skip to content

Commit 24992a8

Browse files
authored
Merge pull request RayTracing#821 from RayTracing/book3_chapter1-3_edits
Book 3 Chapter 1-3 First Draft with Figures
2 parents 2e5cc2e + cdfb484 commit 24992a8

17 files changed

+753
-194
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ add_executable(cos_cubed src/TheRestOfYourLife/cos_cubed.cc ${CO
8080
add_executable(cos_density src/TheRestOfYourLife/cos_density.cc ${COMMON_ALL})
8181
add_executable(integrate_x_sq src/TheRestOfYourLife/integrate_x_sq.cc ${COMMON_ALL})
8282
add_executable(pi src/TheRestOfYourLife/pi.cc ${COMMON_ALL})
83+
add_executable(estimate_halfway src/TheRestOfYourLife/estimate_halfway.cc ${COMMON_ALL})
8384
add_executable(sphere_importance src/TheRestOfYourLife/sphere_importance.cc ${COMMON_ALL})
8485
add_executable(sphere_plot src/TheRestOfYourLife/sphere_plot.cc ${COMMON_ALL})
8586

books/RayTracingInOneWeekend.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
8080
#include <iostream>
8181

82-
void main() {
82+
int main() {
8383

8484
// Image
8585

@@ -391,7 +391,7 @@
391391

392392
#include <iostream>
393393

394-
void main() {
394+
int main() {
395395

396396
// Image
397397

@@ -523,7 +523,7 @@
523523
}
524524
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
525525

526-
void main() {
526+
int main() {
527527

528528
// Image
529529

@@ -1223,7 +1223,7 @@
12231223
return (1.0-t)*color(1.0, 1.0, 1.0) + t*color(0.5, 0.7, 1.0);
12241224
}
12251225

1226-
void main() {
1226+
int main() {
12271227

12281228
// Image
12291229

@@ -1554,7 +1554,7 @@
15541554

15551555
...
15561556

1557-
void main() {
1557+
int main() {
15581558

15591559
// Image
15601560

@@ -1744,7 +1744,7 @@
17441744

17451745
...
17461746

1747-
void main() {
1747+
int main() {
17481748

17491749
// Image
17501750

@@ -2299,7 +2299,7 @@
22992299

23002300
...
23012301

2302-
void main() {
2302+
int main() {
23032303

23042304
// Image
23052305

@@ -2409,7 +2409,7 @@
24092409
We can try that out by adding fuzziness 0.3 and 1.0 to the metals:
24102410

24112411
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2412-
void main() {
2412+
int main() {
24132413
...
24142414
// World
24152415

@@ -2862,7 +2862,7 @@
28622862
#include "scene.h"
28632863
#include "sphere.h"
28642864

2865-
void main() {
2865+
int main() {
28662866
scene scene_desc;
28672867

28682868
const double aspect_ratio = 16.0 / 9.0;
@@ -2983,7 +2983,7 @@
29832983
And a small change to our `main()` routine defines the aspect ratio in the scene:
29842984

29852985
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2986-
void main() {
2986+
int main() {
29872987
scene scene_desc;
29882988

29892989

@@ -3066,7 +3066,7 @@
30663066
Now update `main()` to use a 90° field of view, looking at the point where two spheres touch.
30673067

30683068
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
3069-
void main() {
3069+
int main() {
30703070
scene scene_desc;
30713071

30723072
scene_desc.aspect_ratio = 16.0 / 9.0;
@@ -3171,7 +3171,7 @@
31713171
We'll change back to the prior scene, and use the new viewpoint:
31723172

31733173
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
3174-
void main() {
3174+
int main() {
31753175
scene scene_desc;
31763176

31773177
scene_desc.aspect_ratio = 16.0 / 9.0;
@@ -3441,7 +3441,7 @@
34413441
}
34423442

34433443

3444-
void main() {
3444+
int main() {
34453445
scene scene_desc;
34463446
random_spheres(scene_desc);
34473447
scene_desc.render();

books/RayTracingTheNextWeek.html

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@
13501350
world.add(make_shared<sphere>(point3(0, 10, 0), 10, make_shared<lambertian>(checker)));
13511351
}
13521352

1353-
void main() {
1353+
int main() {
13541354
scene scene_desc;
13551355

13561356
scene_desc.cam.vup = vec3(0,1,0);
@@ -1522,7 +1522,7 @@
15221522
world.add(make_shared<sphere>(point3(0, 2, 0), 2, make_shared<lambertian>(pertext)));
15231523
}
15241524

1525-
void main() {
1525+
int main() {
15261526
...
15271527
switch (0) {
15281528
case 1: random_spheres(scene_desc); break;
@@ -2156,7 +2156,7 @@
21562156
scene_desc.world = hittable_list(globe);
21572157
}
21582158

2159-
void main() {
2159+
int main() {
21602160
...
21612161
switch (0) {
21622162
case 1: random_spheres(scene_desc); break;
@@ -2298,7 +2298,7 @@
22982298
`main()` is updated to set the background color for the prior scenes:
22992299

23002300
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2301-
void main() {
2301+
int main() {
23022302
scene scene_desc;
23032303

23042304
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
@@ -2441,7 +2441,7 @@
24412441
world.add(make_shared<xy_rect>(3, 5, 1, 3, -2, difflight));
24422442
}
24432443

2444-
void main() {
2444+
int main() {
24452445
...
24462446
switch (0) {
24472447
case 1: random_spheres(scene_desc); break;
@@ -2605,7 +2605,7 @@
26052605
world.add(make_shared<xy_rect>(0, 555, 0, 555, 555, white));
26062606
}
26072607

2608-
void main() {
2608+
int main() {
26092609
...
26102610
switch (0) {
26112611
case 1: random_spheres(scene_desc); break;
@@ -3153,7 +3153,7 @@
31533153
}
31543154
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
31553155

3156-
void main() {
3156+
int main() {
31573157
...
31583158
switch (0) {
31593159
case 1: random_spheres(scene_desc); break;
@@ -3275,7 +3275,7 @@
32753275
}
32763276
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
32773277

3278-
void main() {
3278+
int main() {
32793279
...
32803280
switch (0) {
32813281
case 1: random_spheres(scene_desc); break;
@@ -3293,7 +3293,6 @@
32933293

32943294
scene_desc.render();
32953295
}
3296-
}
32973296
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32983297
[Listing [scene-final]: <kbd>[main.cc]</kbd> Final scene]
32993298

0 commit comments

Comments
 (0)