summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-04-02 05:31:06 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-04-02 05:31:06 +0200
commitab16b95656fbcf719604072263f8375cd80213c2 (patch)
tree41b52d7a95126e85c8f44adc6d7138a319746cb8 /src
parent93880a5b068239768ba8b6e562a21e3d9103c124 (diff)
a
Diffstat (limited to 'src')
-rw-r--r--src/chunk-scenery.cpp6
-rw-r--r--src/chunk-scenery.hpp5
-rw-r--r--src/chunk.hpp2
3 files changed, 8 insertions, 5 deletions
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<chunk::entity_draw_order>& 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<entity_draw_order>& 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)
{