X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Frand%2FSimplexNoise.hpp;fp=src%2Frand%2FSimplexNoise.hpp;h=a91e1c4bfd83ec1a492a8b32cd936ed020a94d39;hb=dfe661278fe5fd69e821d530d50b78082d19ce54;hp=0000000000000000000000000000000000000000;hpb=88073614253d3a9c678848a6e905c3794aa831ca;p=tacos.git diff --git a/src/rand/SimplexNoise.hpp b/src/rand/SimplexNoise.hpp new file mode 100644 index 0000000..a91e1c4 --- /dev/null +++ b/src/rand/SimplexNoise.hpp @@ -0,0 +1,35 @@ +#ifndef TACOS_RAND_SIMPLEXNOISE_HPP_ +#define TACOS_RAND_SIMPLEXNOISE_HPP_ + +#include +#include + + +namespace tacos { + +class SimplexNoise { + +public: + explicit SimplexNoise(std::uint64_t seed) noexcept; + + float operator ()(const glm::vec3 &) const noexcept; + +private: + int Perm(int idx) const noexcept; + int Perm12(int idx) const noexcept; + const glm::vec3 &Grad(int idx) const noexcept; + +private: + int perm[512]; + int perm12[512]; + glm::vec3 grad[12]; + glm::ivec3 second_ints[8]; + glm::ivec3 third_ints[8]; + glm::vec3 second_floats[8]; + glm::vec3 third_floats[8]; + +}; + +} + +#endif