diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-24 15:57:43 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-24 15:57:43 +0100 |
commit | 16f6ec061a2c6b1122974fe149b7645d8ad46e2b (patch) | |
tree | 07cede31134ef3bb1e3ae621c3ac81e23aad8e66 /src/chunk.hpp | |
parent | fabb82b7850d9a332579b5d05c5a787ce8a24ce8 (diff) |
move walkable region calculation to class chunk
Diffstat (limited to 'src/chunk.hpp')
-rw-r--r-- | src/chunk.hpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/chunk.hpp b/src/chunk.hpp index 3e142abf..5404d25b 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -27,6 +27,7 @@ public: friend struct tile_ref; friend struct object; friend class world; + struct pass_region; tile_ref operator[](size_t idx) noexcept; tile_proto operator[](size_t idx) const noexcept; @@ -62,10 +63,12 @@ public: void mark_walls_modified() noexcept; void mark_scenery_modified() noexcept; void mark_passability_modified() noexcept; + void mark_region_modified() noexcept; void mark_modified() noexcept; bool is_passability_modified() const noexcept; bool is_scenery_modified() const noexcept; + bool is_region_modified() const noexcept; struct ground_mesh_tuple final { GL::Mesh& mesh; @@ -116,6 +119,9 @@ public: static constexpr size_t max_wall_quad_count = TILE_COUNT*Wall::Direction_COUNT*(Wall::Group_COUNT+4); + const pass_region* get_pass_region(); + void make_pass_region(pass_region& ret); + private: struct ground_stuff { @@ -133,23 +139,27 @@ private: Pointer<ground_stuff> _ground; Pointer<wall_stuff> _walls; + pass_region* _region = nullptr; Array<std::shared_ptr<object>> _objects; class world* _world; GL::Mesh ground_mesh{NoCreate}, wall_mesh{NoCreate}, scenery_mesh{NoCreate}; Pointer<RTree> _rtree; chunk_coords_ _coord; - mutable bool _maybe_empty : 1 = true, - _ground_modified : 1 = true, - _walls_modified : 1 = true, - _scenery_modified : 1 = true, - _pass_modified : 1 = true, - _teardown : 1 = false, - _objects_sorted : 1 = true; + mutable bool _maybe_empty : 1 = true, + _ground_modified : 1 = true, + _walls_modified : 1 = true, + _scenery_modified : 1 = true, + _pass_modified : 1 = true, + _region_modified : 1 = true, + _teardown : 1 = false, + _objects_sorted : 1 = true; void ensure_scenery_buffers(scenery_scratch_buffers bufs); static topo_sort_data make_topo_sort_data(object& e, uint32_t mesh_idx); + static void delete_pass_region(pass_region*& ptr); + struct bbox final // NOLINT(cppcoreguidelines-pro-type-member-init) { object_id id; |