diff options
Diffstat (limited to 'src/Math/Perlin.cpp')
| -rw-r--r-- | src/Math/Perlin.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Math/Perlin.cpp b/src/Math/Perlin.cpp index 5614bb6..992a08e 100644 --- a/src/Math/Perlin.cpp +++ b/src/Math/Perlin.cpp @@ -4,11 +4,11 @@ namespace Math::Perlin { -float ease(float t) { +Real ease(Real t) { return t * t * t * ((6 * t - 15) * t + 10); } -uint8_t hash(uint8_t x) { +U8 hash(U8 x) { auto rot = x * 5 % 8; return x << rot | x >> (8 - rot); } @@ -23,7 +23,7 @@ Vector<2> gradient(Vector<2> pos) { return gradients[x % 4].normalize(); } -float raw(Vector<2> pos) { +Real raw(Vector<2> pos) { auto cell = grid_cell_for_point(pos); auto uv = pos - cell.top_left(); @@ -47,7 +47,7 @@ float raw(Vector<2> pos) { } Vector<3> gradient(Vector<3> pos) { - constexpr float e = 0.5773502692; + constexpr Real e = 0.5773502692; static Vector<3> gradients[] = { {e, e, e}, {-e, e, e}, {e, -e, e}, {-e, -e, e}, {e, e, -e}, {-e, e, -e}, {e, -e, -e}, {-e, -e, -e}, @@ -57,7 +57,7 @@ Vector<3> gradient(Vector<3> pos) { return gradients[x % 8]; } -float raw(Vector<3> pos) { +Real raw(Vector<3> pos) { auto cell = cube_cell_for_point(pos); auto uv = pos - cell.front_top_left(); |
