summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--floor-mesh.cpp9
-rw-r--r--floor-mesh.hpp2
2 files changed, 5 insertions, 6 deletions
diff --git a/floor-mesh.cpp b/floor-mesh.cpp
index 5c797ef7..66aa2b12 100644
--- a/floor-mesh.cpp
+++ b/floor-mesh.cpp
@@ -14,21 +14,20 @@ floor_mesh::floor_mesh()
.setIndexBuffer(_index_buffer, 0, GL::MeshIndexType::UnsignedShort);
}
-void floor_mesh::set_tile(std::array<quad_data, TILE_COUNT>& data, tile& x, const local_coords pt)
+void floor_mesh::set_tile(quad_data& data, tile& x)
{
CORRADE_INTERNAL_ASSERT(x.ground_image);
- const auto idx = pt.to_index();
auto texcoords = x.ground_image.atlas->texcoords_for_id(x.ground_image.variant);
for (std::size_t i = 0; i < 4; i++)
- data[idx][i] = { texcoords[i] };
+ data[i] = { texcoords[i] };
}
void floor_mesh::draw(tile_shader& shader, chunk& c)
{
std::array<quad_data, TILE_COUNT> data;
- c.foreach_tile([&](tile& x, std::size_t, local_coords pt) {
- set_tile(data, x, pt);
+ c.foreach_tile([&](tile& x, std::size_t idx, local_coords) {
+ set_tile(data[idx], x);
});
_vertex_buffer.setData(data, Magnum::GL::BufferUsage::DynamicDraw);
#if 1
diff --git a/floor-mesh.hpp b/floor-mesh.hpp
index 7b717613..bcc5a443 100644
--- a/floor-mesh.hpp
+++ b/floor-mesh.hpp
@@ -31,7 +31,7 @@ private:
using quad_positions_data = std::array<Vector3, 4>;
using index_type = std::array<UnsignedShort, quad_index_count>;
- static void set_tile(std::array<quad_data, TILE_COUNT>& data, tile& x, local_coords pt);
+ static void set_tile(quad_data& data, tile& x);
static const std::array<index_type, TILE_COUNT> _index_data;
static const std::array<quad_positions_data, TILE_COUNT> _position_data;