1 #ifndef BLANK_NOISE_HPP_
2 #define BLANK_NOISE_HPP_
14 // seed should be non-zero
15 explicit GaloisLFSR(std::uint64_t seed);
21 void operator ()(T &out) {
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 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);
45 float operator ()(const glm::vec3 &) const;
48 unsigned char Perm(size_t idx) const;
49 const glm::vec3 &Grad(size_t idx) const;
52 unsigned char perm[512];
58 /// implementation of Worley noise (aka Cell or Voroni noise)
62 explicit WorleyNoise(unsigned int seed);
64 float operator ()(const glm::vec3 &) const;
67 const unsigned int seed;
79 float frequency = 1.0f,
80 float amplitude = 1.0f,
85 for (int i = 0; i < num; ++i) {
86 total += noise(in * frequency) * amplitude;
88 amplitude *= persistence;