summaryrefslogtreecommitdiffhomepage
path: root/src/chunk.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/chunk.hpp')
-rw-r--r--src/chunk.hpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/chunk.hpp b/src/chunk.hpp
index cf41a970..f49a9653 100644
--- a/src/chunk.hpp
+++ b/src/chunk.hpp
@@ -4,9 +4,8 @@
#include "local-coords.hpp"
#include "src/RTree-fwd.h"
#include "global-coords.hpp"
-#include "wall-defs.hpp"
#include "search-pred.hpp"
-#include <type_traits>
+#include "hole-cut.hpp"
#include <array>
#include <Corrade/Containers/Array.h>
#include <Corrade/Containers/Pointer.h>
@@ -34,10 +33,8 @@ public:
tile_proto operator[](local_coords xy) const noexcept;
chunk_coords_ coord() const noexcept;
- tile_ref at_offset(local_coords pos, Vector2i off);
- tile_ref at_offset(tile_ref r, Vector2i off);
- Optional<tile_ref> at_offset_(local_coords pos, Vector2i off);
- Optional<tile_ref> at_offset_(tile_ref r, Vector2i off);
+ Optional<tile_ref> at_offset(local_coords pos, Vector2i off);
+ Optional<tile_ref> at_offset(tile_ref r, Vector2i off);
using iterator = tile_iterator;
using const_iterator = tile_const_iterator;
@@ -99,6 +96,8 @@ public:
class world& world() noexcept;
[[nodiscard]] bool can_place_object(const object_proto& proto, local_coords pos);
+ [[nodiscard]] bool find_hole_in_bbox(CutResult<float>::rect& hole, Vector2 min, Vector2 max);
+ [[nodiscard]] static bool find_hole_in_bbox(CutResult<float>::rect& hole, const Chunk_RTree& rtree, Vector2 min, Vector2 max);
void on_teardown();
bool is_teardown() const;
@@ -107,14 +106,9 @@ public:
void remove_object(size_t i);
void sort_objects();
- // for drawing only
- static constexpr size_t max_wall_quad_count =
- TILE_COUNT*Wall::Direction_COUNT*(Wall::Group_COUNT+4);
-
pass_region make_pass_region(bool debug = false, ArrayView<const Vector2i> positions = {});
pass_region make_pass_region(const Search::pred& f, bool debug = false, ArrayView<const Vector2i> positions = {});
-private:
struct ground_stuff
{
std::array<bptr<ground_atlas>, TILE_COUNT> atlases;
@@ -126,9 +120,10 @@ private:
{
std::array<bptr<wall_atlas>, 2*TILE_COUNT> atlases;
std::array<variant_t, 2*TILE_COUNT> variants;
- std::array<uint_fast16_t, max_wall_quad_count> mesh_indexes;
+ Array<uint_fast16_t> mesh_indexes;
};
+private:
Pointer<ground_stuff> _ground;
Pointer<wall_stuff> _walls;
Array<bptr<object>> _objects;