]> git.localhorst.tv Git - blank.git/blob - src/noise.hpp
add chunk inspect button (C)
[blank.git] / src / noise.hpp
1 #ifndef BLANK_NOISE_HPP_
2 #define BLANK_NOISE_HPP_
3
4 #include <glm/glm.hpp>
5
6
7 namespace blank {
8
9 /// (3D only) adaptation of Stefan Gustavson's SimplexNoise java class
10 class SimplexNoise {
11
12 public:
13         explicit SimplexNoise(unsigned int seed);
14
15         float operator ()(const glm::vec3 &) const;
16
17 private:
18         unsigned char Perm(size_t idx) const;
19         const glm::vec3 &Grad(size_t idx) const;
20
21 private:
22         unsigned char perm[512];
23         glm::vec3 grad[12];
24
25 };
26
27
28 /// implementation of Worley noise (aka Cell or Voroni noise)
29 class WorleyNoise {
30
31 public:
32         explicit WorleyNoise(unsigned int seed);
33
34         float operator ()(const glm::vec3 &) const;
35
36 private:
37         const unsigned int seed;
38         const int num_points;
39
40 };
41
42 }
43
44 #endif