]> git.localhorst.tv Git - tacos.git/blobdiff - src/rand/SimplexNoise.hpp
basic floor idea
[tacos.git] / src / rand / SimplexNoise.hpp
diff --git a/src/rand/SimplexNoise.hpp b/src/rand/SimplexNoise.hpp
new file mode 100644 (file)
index 0000000..a91e1c4
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef TACOS_RAND_SIMPLEXNOISE_HPP_
+#define TACOS_RAND_SIMPLEXNOISE_HPP_
+
+#include <cstdint>
+#include <glm/glm.hpp>
+
+
+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