summaryrefslogtreecommitdiffhomepage
path: root/floor-mesh.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-02 18:41:48 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-02 18:41:48 +0200
commitfc0dbf31301f42eceb33a452e703d6b41dd80756 (patch)
tree0190ef253d4d343f1db66604aecbc74fced0554c /floor-mesh.hpp
parentc8e9f5289ea1d04f169f270c22237c656236c4ea (diff)
a
Diffstat (limited to 'floor-mesh.hpp')
-rw-r--r--floor-mesh.hpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/floor-mesh.hpp b/floor-mesh.hpp
index 7d7eff6f..7b717613 100644
--- a/floor-mesh.hpp
+++ b/floor-mesh.hpp
@@ -19,25 +19,25 @@ struct floor_mesh final
floor_mesh(floor_mesh&&) = delete;
floor_mesh(const floor_mesh&) = delete;
- void set_tile(tile& x, local_coords pt);
void draw(tile_shader& shader, chunk& c);
private:
+ static constexpr auto quad_index_count = 6;
+
struct vertex_data final {
Vector2 texcoords;
};
using quad_data = std::array<vertex_data, 4>;
- using vertex_positions_data = std::array<Vector3, 4>;
- static constexpr auto quad_index_count = std::tuple_size_v<decltype(tile_atlas::indices(0))>;
+ 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 const std::array<index_type, TILE_COUNT> _index_data;
- static const std::array<vertex_positions_data, TILE_COUNT> _position_data;
+ static const std::array<quad_positions_data, TILE_COUNT> _position_data;
GL::Mesh _mesh;
- std::array<quad_data, TILE_COUNT> _vertex_data = {};
-
- GL::Buffer _vertex_buffer{_vertex_data, Magnum::GL::BufferUsage::DynamicDraw},
+ GL::Buffer _vertex_buffer{{}, Magnum::GL::BufferUsage::DynamicDraw},
_index_buffer{_index_data, Magnum::GL::BufferUsage::StaticDraw},
_positions_buffer{_position_data, Magnum::GL::BufferUsage::StaticDraw};
};