Skip to content

Commit b54ce97

Browse files
committed
Merge branch 'master' into dev-minor
2 parents 3b9578f + 5111229 commit b54ce97

File tree

6 files changed

+1390
-45
lines changed

6 files changed

+1390
-45
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,26 @@ Change Log -- Ray Tracing in One Weekend
2323

2424

2525
----------------------------------------------------------------------------------------------------
26-
# v3.0.2 (in progress)
26+
# v3.0.2 (2020-04-11)
2727

2828
### Common
29-
- Change: Every book source now includes from a single common acknowledgments document.
29+
- Fix: code styling for source code both inline and in fenced blocks (#430)
30+
- Change: Every book source now includes from a single common acknowledgments document
3031

3132
### _In One Weekend_
3233
- Fix: Correct typo: "consine" to "cosine"
3334

3435
### _The Next Week_
3536
- Fix: `shared_ptr` dereference and simplify code in `hittable_list::bounding_box()` (#435)
3637
- Fix: Erroneous en-dash in code block. Replace `–>` with `->` (#439)
38+
- Fix: Introduce `u`,`v` surface coordinates to `hit_record` (#441)
3739
- Fix: Add highlight to new `hittable::bounding_box()` method (#442)
3840

41+
### _The Rest of Your Life_
42+
- Fix: unitialized variable in first version of `integrate_x_sq.cc`
43+
- Fix: remove unreferenced variables in several sample programs
44+
- Fix: correct program computation of the integral of x^2 (#438)
45+
3946

4047
----------------------------------------------------------------------------------------------------
4148
# v3.0.1 (2020-03-31)

books/RayTracingInOneWeekend.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@
609609
auto discriminant = b*b - 4*a*c;
610610
return (discriminant > 0);
611611
}
612+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
612613

613614

614615
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
@@ -1154,11 +1155,12 @@
11541155
<div class='together'>
11551156
And the new main:
11561157

1157-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
1158+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
11581159
#include "rtweekend.h"
11591160

11601161
#include "hittable_list.h"
11611162
#include "sphere.h"
1163+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
11621164

11631165
#include <iostream>
11641166

books/RayTracingTheNextWeek.html

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -815,11 +815,6 @@
815815

816816
</div>
817817

818-
I used the old-school C `qsort` rather than the C++ sort because I need a different compare operator
819-
depending on axis, and `qsort` takes a compare function rather than using the less-than operator. I
820-
pass in a pointer to pointer -- this is just C for “array of pointers” because a pointer in C can
821-
also just be a pointer to the first element of an array.
822-
823818
<div class='together'>
824819
When the list coming in is two elements, I put one in each subtree and end the recursion. The
825820
traverse algorithm should be smooth and not have to check for null pointers, so if I just have one
@@ -953,6 +948,24 @@
953948
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
954949
[Listing [texture]: <kbd>[texture.h]</kbd> A texture class]
955950

951+
We'll need to update the `hit_record` structure to store the U,V surface coordinates of the
952+
ray-object hit point.
953+
954+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
955+
struct hit_record {
956+
vec3 p;
957+
vec3 normal;
958+
shared_ptr<material> mat_ptr;
959+
double t;
960+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
961+
double u;
962+
double v;
963+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
964+
bool front_face;
965+
...
966+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
967+
[Listing [hit-record-uv]: <kbd>[hittable.h]</kbd> Adding U,V coordinates to the `hit_record`]
968+
956969
<div class='together'>
957970
Now we can make textured materials by replacing the `const color& a` with a texture pointer:
958971

@@ -2918,13 +2931,6 @@
29182931

29192932
(insert acknowledgments.md.html here)
29202933

2921-
<<<<<<< HEAD
2922-
[acknowledgments]: #acknowledgments
2923-
[Limnu]: https://limnu.com/
2924-
[Markdeep]: https://casual-effects/markdeep/
2925-
[stb_image]: https://github.com/nothings/stb
2926-
=======
2927-
>>>>>>> dev-patch
29282934

29292935

29302936
<!-- Markdeep: https://casual-effects.com/markdeep/ -->

books/RayTracingTheRestOfYourLife.html

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,14 @@
235235
#include <stdlib.h>
236236

237237
int main() {
238-
int inside_circle = 0;
239-
int inside_circle_stratified = 0;
240238
int N = 1000000;
241-
double sum;
239+
auto sum = 0.0;
242240
for (int i = 0; i < N; i++) {
243241
auto x = random_double(0,2);
244242
sum += x*x;
245243
}
246244
std::cout << std::fixed << std::setprecision(12);
247-
std::cout << "I = " << sum/N << '\n';
245+
std::cout << "I = " << 2 * sum/N << '\n';
248246
}
249247
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
250248
[Listing [integ-xsq-1]: <kbd>[integrate_x_sq.cc]</kbd> Integrating $x^2$]
@@ -426,8 +424,6 @@
426424
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
427425

428426
int main() {
429-
int inside_circle = 0;
430-
int inside_circle_stratified = 0;
431427
int N = 1000000;
432428
auto sum = 0.0;
433429
for (int i = 0; i < N; i++) {
@@ -462,8 +458,6 @@
462458
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
463459

464460
int main() {
465-
int inside_circle = 0;
466-
int inside_circle_stratified = 0;
467461
int N = 1000000;
468462
auto sum = 0.0;
469463
for (int i = 0; i < N; i++) {
@@ -507,8 +501,6 @@
507501
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
508502

509503
int main() {
510-
int inside_circle = 0;
511-
int inside_circle_stratified = 0;
512504
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
513505
int N = 1;
514506
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++

books/markdeep.min.js

Lines changed: 1348 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

style/book.css

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,27 +78,25 @@ div.indented {
7878
** Code
7979
** -----------------------------------------------------------------------------------------------*/
8080

81-
.md code {
82-
font-family: Consolas, Menlo, monospace;
83-
color: #000;
84-
}
85-
86-
.md p code {
87-
padding: 0 .4ex;
88-
background: #e4e4e0;
89-
}
90-
9181
.md pre.listing.tilde {
9282
border: solid 3px #d4d4d4;
93-
background: #e4e4e0;
9483
padding: 1.5ex;
9584
width: 96%;
9685
overflow: visible;
86+
background: #e4e4e0;
9787
}
9888

99-
.md pre.listing.tilde code {
89+
.md code {
90+
/* All code, both in fenced blocks and inline. */
91+
font-family: Consolas, Menlo, monospace;
10092
font-size: 86%;
93+
background: #e0e0dc;
94+
}
95+
96+
.md pre.listing.tilde code {
97+
/* Only code in fenced blocks. */
10198
letter-spacing: -0.20;
99+
background: #e4e4e0;
102100
}
103101

104102
/* Hilight.js Syntax Coloring */

0 commit comments

Comments
 (0)