Skip to content

Commit 165238d

Browse files
committed
Include hittable.h from material.h
The prior version used a forward declaration of `hit_record`, which was insufficient since hittable.h lines referenced members of `hit_record`, and was unnecessary because hittable.h was included before material.h in practice. For this specific code, the inclusion is unnecessary, but is proper form. Resolves #1608
1 parent fe3385b commit 165238d

File tree

6 files changed

+8
-16
lines changed

6 files changed

+8
-16
lines changed

books/RayTracingInOneWeekend.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2791,7 +2791,7 @@
27912791

27922792
#include "rtweekend.h"
27932793

2794-
class hit_record;
2794+
#include "hittable.h"
27952795

27962796
class material {
27972797
public:

books/RayTracingTheNextWeek.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,13 +1346,11 @@
13461346
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
13471347
#include "rtweekend.h"
13481348

1349-
1349+
#include "hittable.h"
13501350
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
13511351
#include "texture.h"
13521352
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
13531353

1354-
class hit_record;
1355-
13561354
...
13571355

13581356
class lambertian : public material {

books/RayTracingTheRestOfYourLife.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2286,14 +2286,12 @@
22862286
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
22872287
#include "rtweekend.h"
22882288

2289-
2289+
#include "hittable.h"
22902290
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
22912291
#include "onb.h"
22922292
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
22932293
#include "texture.h"
22942294

2295-
class hit_record;
2296-
22972295
class material {
22982296
public:
22992297
...
@@ -3329,11 +3327,10 @@
33293327
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
33303328
#include "rtweekend.h"
33313329

3330+
#include "hittable.h"
33323331
#include "onb.h"
33333332
#include "texture.h"
33343333

3335-
class hit_record;
3336-
33373334

33383335
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
33393336
class scatter_record {
@@ -3370,15 +3367,14 @@
33703367
#include "rtweekend.h"
33713368

33723369

3370+
#include "hittable.h"
33733371
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ delete
33743372
#include "onb.h"
33753373
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
33763374
#include "pdf.h"
33773375
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
33783376
#include "texture.h"
33793377

3380-
class hit_record;
3381-
33823378
...
33833379

33843380
class lambertian : public material {

src/InOneWeekend/material.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include "rtweekend.h"
1515

16-
class hit_record;
16+
#include "hittable.h"
1717

1818

1919
class material {

src/TheNextWeek/material.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313

1414
#include "rtweekend.h"
1515

16+
#include "hittable.h"
1617
#include "texture.h"
1718

18-
class hit_record;
19-
2019

2120
class material {
2221
public:

src/TheRestOfYourLife/material.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313

1414
#include "rtweekend.h"
1515

16+
#include "hittable.h"
1617
#include "pdf.h"
1718
#include "texture.h"
1819

19-
class hit_record;
20-
2120

2221
class scatter_record {
2322
public:

0 commit comments

Comments
 (0)