diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2024-07-28 08:43:26 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-07-28 08:43:26 +0200 |
| commit | 74a123a9fdf72fa4a2d0322de011d10b69898191 (patch) | |
| tree | 7aaee73b410fc1a247ff7885dc56226a7a25b5b6 /src | |
| parent | eeaaef1547891b2a0d5c03a967d134a85458a36d (diff) | |
move out from hole.hpp to hole-cut.hpp
Now the latter doesn't require including <src/object.hpp>.
Diffstat (limited to 'src')
| -rw-r--r-- | src/chunk.hpp | 1 | ||||
| -rw-r--r-- | src/hole-cut.cpp | 1 | ||||
| -rw-r--r-- | src/hole-cut.hpp | 22 | ||||
| -rw-r--r-- | src/hole.hpp | 15 |
4 files changed, 24 insertions, 15 deletions
diff --git a/src/chunk.hpp b/src/chunk.hpp index 65730d42..3d3bbe5a 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -6,6 +6,7 @@ #include "global-coords.hpp" #include "wall-defs.hpp" #include "search-pred.hpp" +#include "hole-cut.hpp" #include <type_traits> #include <array> #include <Corrade/Containers/Array.h> diff --git a/src/hole-cut.cpp b/src/hole-cut.cpp index 1ecf96ce..e159383f 100644 --- a/src/hole-cut.cpp +++ b/src/hole-cut.cpp @@ -2,6 +2,7 @@ #include "compat/array-size.hpp" #include "compat/iota.hpp" #include "compat/map.hpp" +#include "hole-cut.hpp" //#include <mg/Functions.h> #ifdef __GNUG__ diff --git a/src/hole-cut.hpp b/src/hole-cut.hpp new file mode 100644 index 00000000..52eeaf71 --- /dev/null +++ b/src/hole-cut.hpp @@ -0,0 +1,22 @@ +#pragma once +#include <mg/Vector2.h> +#include <Magnum/DimensionTraits.h> + +namespace floormat { + +template<typename T> +struct CutResult +{ + using Vec2 = VectorTypeFor<2, T>; + struct bbox { Vec2 position; Vector2ub bbox_size; }; + struct rect { Vec2 min, max; }; + + static CutResult cut(bbox input, bbox hole); + static CutResult cut(Vec2 r0, Vec2 r1, Vec2 h0, Vec2 h1); + + std::array<rect, 8> array; + uint8_t size = 0; + bool found = false; +}; + +} // namespace floormat diff --git a/src/hole.hpp b/src/hole.hpp index 35fd29d9..927c2b61 100644 --- a/src/hole.hpp +++ b/src/hole.hpp @@ -57,19 +57,4 @@ private: void maybe_mark_neighbor_chunks_modified() override; }; -template<typename T> -struct CutResult -{ - using Vec2 = VectorTypeFor<2, T>; - struct bbox { Vec2 position; Vector2ub bbox_size; }; - struct rect { Vec2 min, max; }; - - static CutResult cut(bbox input, bbox hole); - static CutResult cut(Vec2 r0, Vec2 r1, Vec2 h0, Vec2 h1); - - std::array<rect, 8> array; - uint8_t size = 0; - bool found = false; -}; - } // namespace floormat |
