From ab16b95656fbcf719604072263f8375cd80213c2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 2 Apr 2023 05:31:06 +0200 Subject: a --- src/chunk-scenery.cpp | 6 ++++-- src/chunk-scenery.hpp | 5 +++-- src/chunk.hpp | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/chunk-scenery.cpp b/src/chunk-scenery.cpp index b89baeb9..7852088f 100644 --- a/src/chunk-scenery.cpp +++ b/src/chunk-scenery.cpp @@ -71,7 +71,7 @@ static void topological_sort(Array& array, size_t size fm_assert(output == (size_t)-1); } -auto chunk::make_topo_sort_data(const entity& e) -> topo_sort_data +auto chunk::make_topo_sort_data(entity& e) -> topo_sort_data { const auto& a = *e.atlas; const auto& f = a.frame(e.r, e.frame); @@ -100,10 +100,12 @@ auto chunk::make_topo_sort_data(const entity& e) -> topo_sort_data const auto bb_min = tile_shader::project(Vector3(Vector2(bb_min_[0], bb_max_[1]), 0)); const auto bb_max = tile_shader::project(Vector3(Vector2(bb_max_[0], bb_min_[1]), 0)); const auto bb_len = bb_max[0] - bb_min[0]; - if (bb_len >= 1 && a.info().pixel_size.x() > iTILE_SIZE[0]) + if (bb_len >= 1 && f.size[0] > iTILE_SIZE[0]) { data.slope = (bb_max[1]-bb_min[1])/bb_len; data.mode = topo_sort_data::mode_static; + data.bb_min = Vector2s(bb_min); + data.bb_max = Vector2s(bb_max); } break; } diff --git a/src/chunk-scenery.hpp b/src/chunk-scenery.hpp index fcb59c50..cbe2ea83 100644 --- a/src/chunk-scenery.hpp +++ b/src/chunk-scenery.hpp @@ -9,9 +9,10 @@ struct chunk::topo_sort_data { enum m : uint8_t { mode_none, mode_static, mode_character, }; - const entity* in = nullptr; + entity* in = nullptr; Vector2i min, max, center; float slope = 0, ord; + Vector2s bb_min = {}, bb_max = {}; m mode : 2 = mode_none; uint8_t visited : 1 = false; @@ -19,7 +20,7 @@ struct chunk::topo_sort_data }; struct chunk::entity_draw_order { - const entity *e; + entity *e; float ord; topo_sort_data data; }; diff --git a/src/chunk.hpp b/src/chunk.hpp index ddcf2c50..385ba72e 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -138,7 +138,7 @@ private: _entities_sorted : 1 = true; void ensure_scenery_draw_array(Array& array); - static topo_sort_data make_topo_sort_data(const entity& e); + static topo_sort_data make_topo_sort_data(entity& e); struct bbox final // NOLINT(cppcoreguidelines-pro-type-member-init) { -- cgit v1.2.3