summaryrefslogtreecommitdiffhomepage
path: root/src/floor-mesh.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-07 16:45:28 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-07 16:45:28 +0200
commit15e8cebc19bfb484ba46a3589378d52ca769769e (patch)
treecd4174c7d15671434773acdc957a6bf894d6b29d /src/floor-mesh.cpp
parent7b7e0ba851189848ff1c89761a1609e6a978fb19 (diff)
a
Diffstat (limited to 'src/floor-mesh.cpp')
-rw-r--r--src/floor-mesh.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/floor-mesh.cpp b/src/floor-mesh.cpp
index ce0a3d19..fdace9d8 100644
--- a/src/floor-mesh.cpp
+++ b/src/floor-mesh.cpp
@@ -33,16 +33,16 @@ void floor_mesh::set_tile(quad_data& data, tile& x)
void floor_mesh::draw(tile_shader& shader, chunk& c)
{
std::array<quad_data, TILE_COUNT> data;
- c.foreach_tile([&](tile& x, std::size_t idx, local_coords) {
- set_tile(data[idx], x);
- });
+ for (auto [x, idx, pt] : c) {
+ set_tile(data[idx], x);
+ }
_vertex_buffer.setSubData(0, data);
Magnum::GL::MeshView mesh{_mesh};
mesh.setCount(quad_index_count);
const tile_atlas* last_tile_atlas = nullptr;
- c.foreach_tile([&](tile& x, std::size_t i, local_coords) {
+ for (auto [x, i, pt] : c) {
if (!x.ground_image)
- return;
+ continue;
mesh.setIndexRange((int)(i*quad_index_count), 0, quad_index_count*TILE_COUNT - 1);
if (auto* atlas = x.ground_image.atlas.get(); atlas != last_tile_atlas)
{
@@ -50,7 +50,7 @@ void floor_mesh::draw(tile_shader& shader, chunk& c)
last_tile_atlas = atlas;
}
shader.draw(mesh);
- });
+ }
}
std::array<std::array<UnsignedShort, 6>, TILE_COUNT> floor_mesh::make_index_array()