summaryrefslogtreecommitdiffhomepage
path: root/draw/floor.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-01 16:35:03 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-01 16:35:03 +0100
commit704e9bd3ac58484a5209e186798076f1cbd432ef (patch)
tree511479ebd088d5c9524803c6f3fe4641009b58bc /draw/floor.cpp
parent7ff1f0911e0b0c314d6e639887b705d6fc0d78aa (diff)
wip
Diffstat (limited to 'draw/floor.cpp')
-rw-r--r--draw/floor.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/draw/floor.cpp b/draw/floor.cpp
index 444ee127..861336c7 100644
--- a/draw/floor.cpp
+++ b/draw/floor.cpp
@@ -17,11 +17,11 @@ floor_mesh::floor_mesh()
.setIndexBuffer(_index_buffer, 0, GL::MeshIndexType::UnsignedShort);
}
-void floor_mesh::set_tile(quad_data& data, tile& x)
+void floor_mesh::set_tile(quad_data& data, tile_ref& x)
{
- if (x.ground)
+ if (auto ground = x.ground(); ground)
{
- auto texcoords = x.ground.atlas->texcoords_for_id(x.ground.variant);
+ auto texcoords = ground.atlas->texcoords_for_id(ground.variant);
for (size_t i = 0; i < 4; i++)
data[i] = { texcoords[i] };
}
@@ -34,7 +34,7 @@ void floor_mesh::draw(tile_shader& shader, chunk& c)
{
//_vertex_buffer.setData({nullptr, sizeof(quad_data) * TILE_COUNT}, Magnum::GL::BufferUsage::DynamicDraw); // orphan the buffer
std::array<quad_data, TILE_COUNT> data;
- for (auto& [x, idx, pt] : c) {
+ for (auto [x, idx, pt] : c) {
set_tile(data[idx], x);
}
_vertex_buffer.setSubData(0, data);
@@ -57,8 +57,8 @@ void floor_mesh::draw(tile_shader& shader, chunk& c)
last_pos = i;
};
- for (auto& [x, i, pt] : c)
- do_draw(i, x.ground.atlas.get());
+ for (auto [x, i, pt] : c)
+ do_draw(i, x.ground_atlas().get());
do_draw(TILE_COUNT, nullptr);
}