diff options
| author | Mel <einebeere@gmail.com> | 2023-07-08 03:25:44 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2023-07-08 03:25:44 +0200 |
| commit | fe2baedc760c2f29e2c720f6b1132a2de33c5430 (patch) | |
| tree | dfbe1c72a17805a3cab6e0d47433e9021890c9ca /src/Math/Perlin.hpp | |
| parent | 41fbca10f6c6cdd9c1623f1347e7ecb40f5e7f59 (diff) | |
| download | meowcraft-fe2baedc760c2f29e2c720f6b1132a2de33c5430.tar.zst meowcraft-fe2baedc760c2f29e2c720f6b1132a2de33c5430.zip | |
Use own size types
Diffstat (limited to 'src/Math/Perlin.hpp')
| -rw-r--r-- | src/Math/Perlin.hpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/Math/Perlin.hpp b/src/Math/Perlin.hpp index 17d33fd..b28f992 100644 --- a/src/Math/Perlin.hpp +++ b/src/Math/Perlin.hpp @@ -4,27 +4,27 @@ namespace Math::Perlin { -float raw(Vector<2> pos); -float raw(Vector<3> pos); +Real raw(Vector<2> pos); +Real raw(Vector<3> pos); -template <size_t D> +template <USize D> struct Noise { static_assert(D > 1 && D < 4); Vector<D> offset{20000.0f}; - float scale = 15.0f; + Real scale = 15.0f; - uint octaves = 3; - float persistence = 0.3f; - float lacunarity = 2.0f; + UInt octaves = 3; + Real persistence = 0.3f; + Real lacunarity = 2.0f; - float at(Vector<D> pos) const { - float result = 0; - float max = 0; - float frequency = 1; - float amplitude = 1; + Real at(Vector<D> pos) const { + Real result = 0; + Real max = 0; + Real frequency = 1; + Real amplitude = 1; - for (uint octave = 0; octave < octaves; octave++) { + for (UInt octave = 0; octave < octaves; octave++) { result += raw((pos + offset).abs() / scale * frequency) * amplitude; max += amplitude; |
