diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-06-07 23:10:49 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-06-08 01:11:44 +0200 |
commit | ec524fddfa0d2583d06ee194b06720be0eee8341 (patch) | |
tree | 663497f84b276308c45fda0b4c0c97da34a71254 /src/chunk.hpp | |
parent | 089e50cc986730f05c64ae814e21529fcdd44f91 (diff) |
wa
Diffstat (limited to 'src/chunk.hpp')
-rw-r--r-- | src/chunk.hpp | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/chunk.hpp b/src/chunk.hpp index 4b18ada8..94d1e3ca 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -100,14 +100,13 @@ public: [[nodiscard]] bool can_place_object(const object_proto& proto, local_coords pos); - void add_object(const std::shared_ptr<object>& e); - void add_object_unsorted(const std::shared_ptr<object>& e); - void sort_objects(); - void remove_object(size_t i); void on_teardown(); bool is_teardown() const; ArrayView<const std::shared_ptr<object>> objects() const; + 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); @@ -148,6 +147,11 @@ private: void ensure_scenery_buffers(scenery_scratch_buffers bufs); + void add_object(const std::shared_ptr<object>& e); + void add_object_pre(const std::shared_ptr<object>& e); + [[nodiscard]] size_t add_objectʹ(const std::shared_ptr<object>& e); + void add_object_unsorted(const std::shared_ptr<object>& e); + struct bbox final { collision_data data; @@ -156,11 +160,25 @@ private: bool operator==(const bbox& other) const noexcept; }; - static bool _bbox_for_scenery(const object& s, bbox& value) noexcept; - static bool _bbox_for_scenery(const object& s, local_coords local, Vector2b offset, Vector2b bbox_offset, Vector2ub bbox_size, bbox& value) noexcept; - void _remove_bbox(const bbox& x); - void _add_bbox(const bbox& x); - void _replace_bbox(const bbox& x0, const bbox& x, bool b0, bool b); + [[nodiscard]] static bool _bbox_for_scenery(const object& s, bbox& value) noexcept; + [[nodiscard]] static bool _bbox_for_scenery(const object& s, local_coords local, Vector2b offset, + Vector2b bbox_offset, Vector2ub bbox_size, bbox& value) noexcept; + + void _remove_bbox_(const bbox& x, bool upd, bool is_dynamic); + void _remove_bbox_dynamic(const bbox& x); + void _remove_bbox_static(const bbox& x); + void _remove_bbox_static_(); + + void _add_bbox_(const bbox& x, bool upd, bool is_dynamic); + void _add_bbox_dynamic(const bbox& x); + void _add_bbox_static(const bbox& x); + void _add_bbox_static_(); + + template<bool Dynamic> void _replace_bbox_impl(const bbox& x0, const bbox& x, bool b0, bool b); + void _replace_bbox_(const bbox& x0, const bbox& x, bool b0, bool b, bool upd, bool is_dynamic); + void _replace_bbox_dynamic(const bbox& x0, const bbox& x, bool b0, bool b); + void _replace_bbox_static(const bbox& x0, const bbox& x, bool b0, bool b); + GL::Mesh make_wall_mesh(); template<size_t N> static std::array<std::array<UnsignedShort, 6>, N*TILE_COUNT> make_index_array(size_t max); |