Skip to content

Commit 58da8d4

Browse files
authored
Merge pull request #655 from RayTracing/header_guards
Header guards added
2 parents 8bc2d63 + f007be0 commit 58da8d4

File tree

4 files changed

+14
-26
lines changed

4 files changed

+14
-26
lines changed

CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Change Log -- Ray Tracing in One Weekend
66
### Common
77
- Removed: now that the code handles ray-surface intersection from either side, we no longer need
88
the `flip_face` class, so we've deleted it from the text and from the code (#482, #270)
9+
- Change: Added header guards to the text of all three books whenever a new header file was
10+
introduced
911

1012
### _The Next Week_
1113
- Removed: Deleted the section covering the old `flip_face` class, renumbered images as this
@@ -48,10 +50,6 @@ Change Log -- Ray Tracing in One Weekend
4850
- New: Add new isotropic constructor taking color argument (#644)
4951

5052

51-
----------------------------------------------------------------------------------------------------
52-
# v3.1.3 (in progress)
53-
54-
5553
----------------------------------------------------------------------------------------------------
5654
# v3.1.2 (2020-06-03)
5755

books/RayTracingInOneWeekend.html

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,11 +1002,6 @@
10021002
calculation for us.
10031003

10041004
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
1005-
#ifndef HITTABLE_H
1006-
#define HITTABLE_H
1007-
1008-
#include "ray.h"
1009-
10101005
struct hit_record {
10111006
point3 p;
10121007
vec3 normal;
@@ -1020,13 +1015,6 @@
10201015
}
10211016
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
10221017
};
1023-
1024-
class hittable {
1025-
public:
1026-
virtual bool hit(const ray& r, double t_min, double t_max, hit_record& rec) const = 0;
1027-
};
1028-
1029-
#endif
10301018
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10311019
[Listing [hittable-time-side]: <kbd>[hittable.h]</kbd> The hittable class with time and side]
10321020

@@ -1962,12 +1950,10 @@
19621950
that the pointer is to a class, which the “class material” in the hittable class below does:
19631951

19641952
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
1965-
#ifndef HITTABLE_H
1966-
#define HITTABLE_H
1967-
19681953

19691954
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
19701955
#include "rtweekend.h"
1956+
#include "ray.h"
19711957

19721958
class material;
19731959
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
@@ -1986,13 +1972,6 @@
19861972
normal = front_face ? outward_normal :-outward_normal;
19871973
}
19881974
};
1989-
1990-
class hittable {
1991-
public:
1992-
virtual bool hit(const ray& r, double t_min, double t_max, hit_record& rec) const = 0;
1993-
};
1994-
1995-
#endif
19961975
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19971976
[Listing [hit-with-material]: <kbd>[hittable.h]</kbd> Hit record with added material pointer]
19981977
</div>

books/RayTracingTheRestOfYourLife.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,9 @@
12911291
class because it won't really be more complicated than utility functions:
12921292

12931293
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
1294+
#ifndef ONB_H
1295+
#define ONB_H
1296+
12941297
class onb {
12951298
public:
12961299
onb() {}
@@ -1322,6 +1325,8 @@
13221325
axis[1] = unit_vector(cross(w(), a));
13231326
axis[0] = cross(w(), v());
13241327
}
1328+
1329+
#endif
13251330
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13261331
[Listing [class-onb]: <kbd>[onb.h]</kbd> Orthonormal basis class]
13271332

@@ -1545,13 +1550,18 @@
15451550
to be greedy and hope a minimal interface works, and for the PDF this implies:
15461551

15471552
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
1553+
#ifndef PDF_H
1554+
#define PDF_H
1555+
15481556
class pdf {
15491557
public:
15501558
virtual ~pdf() {}
15511559

15521560
virtual double value(const vec3& direction) const = 0;
15531561
virtual vec3 generate() const = 0;
15541562
};
1563+
1564+
#endif
15551565
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15561566
[Listing [class-pdf]: <kbd>[pdf.h]</kbd> The `pdf` class]
15571567
</div>

src/InOneWeekend/hittable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
//==============================================================================================
1313

1414
#include "rtweekend.h"
15+
#include "ray.h"
1516

1617

1718
class material;

0 commit comments

Comments
 (0)