]> git.localhorst.tv Git - blank.git/blob - src/rand/SimplexNoise.hpp
6260426fe8235fe1a6afbeb4f0ff0e9c66f34c4b
[blank.git] / src / rand / SimplexNoise.hpp
1 #ifndef BLANK_RAND_SIMPLEXNOISE_HPP_
2 #define BLANK_RAND_SIMPLEXNOISE_HPP_
3
4 #include <cstdint>
5 #include <glm/glm.hpp>
6
7
8 namespace blank {
9
10 class SimplexNoise {
11
12 public:
13         explicit SimplexNoise(std::uint64_t seed) noexcept;
14
15         float operator ()(const glm::vec3 &) const noexcept;
16
17 private:
18         int Perm(int idx) const noexcept;
19         int Perm12(int idx) const noexcept;
20         const glm::vec3 &Grad(int idx) const noexcept;
21
22 private:
23         int perm[512];
24         int perm12[512];
25         glm::vec3 grad[12];
26         glm::ivec3 second_ints[8];
27         glm::ivec3 third_ints[8];
28         glm::vec3 second_floats[8];
29         glm::vec3 third_floats[8];
30
31 };
32
33 }
34
35 #endif