diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-09 19:45:46 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-09 19:45:46 +0100 |
commit | 9482f370e56397d50e5d7efef81a33af7390d07a (patch) | |
tree | bc1f4cec23cd4a31ee90e2bbaf592ac5d54f7625 /draw | |
parent | 5907a8902e6f01774cebbb515349a66c86a47fb3 (diff) |
now sorting both wall types together
Diffstat (limited to 'draw')
-rw-r--r-- | draw/wall.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/draw/wall.cpp b/draw/wall.cpp index 2008fe05..c65b19fc 100644 --- a/draw/wall.cpp +++ b/draw/wall.cpp @@ -9,7 +9,7 @@ namespace floormat { -#define FM_DEBUG_DRAW_COUNT +//#define FM_DEBUG_DRAW_COUNT constexpr auto quad_index_count = 6; @@ -17,7 +17,7 @@ wall_mesh::wall_mesh() = default; void wall_mesh::draw(tile_shader& shader, chunk& c) { - auto [mesh_, ids_n, ids_w] = c.ensure_wall_mesh(); + auto [mesh_, ids] = c.ensure_wall_mesh(); tile_atlas* last_atlas = nullptr; std::size_t last_pos = 0; @@ -32,7 +32,7 @@ void wall_mesh::draw(tile_shader& shader, chunk& c) { last_atlas->texture().bind(0); mesh.setCount((int)(quad_index_count * len)); - mesh.setIndexRange((int)(last_pos*quad_index_count), 0, quad_index_count*TILE_COUNT - 1); + mesh.setIndexRange((int)(last_pos*quad_index_count), 0, quad_index_count*TILE_COUNT*2 - 1); shader.draw(mesh); draw_count++; } @@ -40,12 +40,12 @@ void wall_mesh::draw(tile_shader& shader, chunk& c) last_pos = i; }; - for (std::size_t k = 0; k < TILE_COUNT; k++) - if (auto* atlas = c.wall_n_atlas_at(ids_n[k])) + for (std::size_t k = 0; k < TILE_COUNT*2; k++) + { + const std::size_t i = ids[k]; + if (auto* atlas = c.wall_atlas_at(i)) do_draw(k, atlas); - for (std::size_t k = 0; k < TILE_COUNT; k++) - if (auto* atlas = c.wall_w_atlas_at(ids_w[k])) - do_draw(k + TILE_COUNT, atlas); + } do_draw(TILE_COUNT*2, nullptr); #ifdef FM_DEBUG_DRAW_COUNT |