diff options
| author | Mel <einebeere@gmail.com> | 2023-06-12 17:09:55 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2023-06-12 17:14:03 +0200 |
| commit | d0de60dc33df75fbcacb53a09568b14d0fd48cb9 (patch) | |
| tree | 7aefdbb81f114552881834bd5b0d842bc2bdb691 /src/Math/Grid.hpp | |
| parent | 23b0bc4d1ddc9fad3c32e8257497ddd13ac6a155 (diff) | |
| download | meowcraft-d0de60dc33df75fbcacb53a09568b14d0fd48cb9.tar.zst meowcraft-d0de60dc33df75fbcacb53a09568b14d0fd48cb9.zip | |
Multithreaded world generation with Perlin
Diffstat (limited to 'src/Math/Grid.hpp')
| -rw-r--r-- | src/Math/Grid.hpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/Math/Grid.hpp b/src/Math/Grid.hpp new file mode 100644 index 0000000..1c1a7ca --- /dev/null +++ b/src/Math/Grid.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include "Common.hpp" +#include "Matrix.hpp" + +namespace Math { + +struct GridCellBoundaries { + float x1, x2, y1, y2; + + [[nodiscard]] Vector<2> top_left() const; + [[nodiscard]] Vector<2> top_right() const; + [[nodiscard]] Vector<2> bottom_left() const; + [[nodiscard]] Vector<2> bottom_right() const; +}; + +GridCellBoundaries grid_cell_for_point(Vector<2> point); + +struct CubeCellBoundaries { + float x1, x2, y1, y2, z1, z2; + + [[nodiscard]] Vector<3> front_top_left() const; + [[nodiscard]] Vector<3> front_top_right() const; + [[nodiscard]] Vector<3> front_bottom_left() const; + [[nodiscard]] Vector<3> front_bottom_right() const; + [[nodiscard]] Vector<3> back_top_left() const; + [[nodiscard]] Vector<3> back_top_right() const; + [[nodiscard]] Vector<3> back_bottom_left() const; + [[nodiscard]] Vector<3> back_bottom_right() const; + + [[nodiscard]] GridCellBoundaries grid_cell() const; +}; + +CubeCellBoundaries cube_cell_for_point(Vector<3> point); + +} \ No newline at end of file |
