Skip to content

Commit 2102854

Browse files
committed
Updates for Perlin turbulence
Includes updated Perlin turbulence image.
1 parent 20eed2f commit 2102854

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

books/RayTracingTheNextWeek.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2473,6 +2473,13 @@
24732473
...
24742474
public:
24752475
...
2476+
2477+
double noise(const point3& p) const {
2478+
...
2479+
}
2480+
2481+
2482+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
24762483
double turb(const point3& p, int depth) const {
24772484
auto accum = 0.0;
24782485
auto temp_p = p;
@@ -2486,11 +2493,14 @@
24862493

24872494
return fabs(accum);
24882495
}
2496+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
2497+
24892498
...
24902499
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24912500
[Listing [perlin-turb]: <kbd>[perlin.h]</kbd> Turbulence function]
24922501

2493-
Here `fabs()` is the absolute value function defined in `<cmath>`.
2502+
Here `fabs()` is the absolute value function defined in `<cmath>`. Now we'll use the new Perlin
2503+
turbulence function to update our Perlin sphere:
24942504

24952505
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
24962506
class noise_texture : public texture {

images/img-2.14-perlin-turb.png

-21.5 KB
Loading

0 commit comments

Comments
 (0)