Raytracer
Loading...
Searching...
No Matches
Perlin.hpp
1#include "utils/Color.hpp"
2#include "utils/VecN.hpp"
3
4#ifndef __PERLIN_HPP__
5 #define __PERLIN_HPP__
6
7namespace Raytracer::Utils
8{
9 class Perlin {
10 private:
11 static constexpr int pointCount = 256;
12 Utils::Vec3 *_randVec;
13 int *_permX;
14 int *_permY;
15 int *_permZ;
16
17 public:
18 Perlin();
19 ~Perlin();
20 double noise(const Utils::Point3 &point) const;
21 double turbulence(const Utils::Point3 &point, int depth = 7) const;
22 static int *perlinGeneratePerm();
23 static void permute(int *perm, int n);
24 static double perlinInterp(
25 const Utils::Vec3 c[2][2][2], double u, double v, double w);
26 };
27} // namespace Raytracer::Utils
28
29#endif /* __PERLIN_HPP__ */
Definition Perlin.hpp:9
static int * perlinGeneratePerm()
Generate the permutation table.
Definition Perlin.cpp:103
static void permute(int *perm, int n)
Permute the permutation table.
Definition Perlin.cpp:122
double noise(const Utils::Point3 &point) const
Get the noise value at the given point.
Definition Perlin.cpp:46
~Perlin()
Destroy the Perlin object.
Definition Perlin.cpp:29
static double perlinInterp(const Utils::Vec3 c[2][2][2], double u, double v, double w)
Interpolate the noise value.
Definition Perlin.cpp:144
double turbulence(const Utils::Point3 &point, int depth=7) const
Get the turbulence value at the given point.
Definition Perlin.cpp:80
Perlin()
Construct a new Perlin object.
Definition Perlin.cpp:12
Definition VecN.hpp:40