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.cpp | |
| parent | 41fbca10f6c6cdd9c1623f1347e7ecb40f5e7f59 (diff) | |
| download | meowcraft-fe2baedc760c2f29e2c720f6b1132a2de33c5430.tar.zst meowcraft-fe2baedc760c2f29e2c720f6b1132a2de33c5430.zip | |
Use own size types
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(); |
