1 #ifndef BLANK_NOISE_HPP_
2 #define BLANK_NOISE_HPP_
14 // seed should be non-zero
15 explicit GaloisLFSR(std::uint64_t seed) noexcept;
18 bool operator ()() noexcept;
21 T operator ()(T &out) noexcept {
22 constexpr int num_bits =
23 std::numeric_limits<T>::digits +
24 std::numeric_limits<T>::is_signed;
25 for (int i = 0; i < num_bits; ++i) {
28 return out = static_cast<T>(state);
33 // bits 64, 63, 61, and 60 set to 1 (counting from 1 lo to hi)
34 static constexpr std::uint64_t mask = 0xD800000000000000;
39 /// (3D only) adaptation of Stefan Gustavson's SimplexNoise java class
43 explicit SimplexNoise(unsigned int seed) noexcept;
45 float operator ()(const glm::vec3 &) const noexcept;
48 int Perm(int idx) const noexcept;
49 int Perm12(int idx) const noexcept;
50 const glm::vec3 &Grad(int idx) const noexcept;
60 /// implementation of Worley noise (aka Cell or Voroni noise)
64 explicit WorleyNoise(unsigned int seed) noexcept;
66 float operator ()(const glm::vec3 &) const noexcept;
69 const unsigned int seed;
81 float frequency = 1.0f,
82 float amplitude = 1.0f,
87 for (int i = 0; i < num; ++i) {
88 total += noise(in * frequency) * amplitude;
90 amplitude *= persistence;