#pragma once #include "tile-defs.hpp" #include #include #include #include #include #include #include namespace floormat { struct tile_ref; struct tile_proto; struct tile_shader; struct chunk; struct floor_mesh final { floor_mesh(); floor_mesh(floor_mesh&&) = delete; floor_mesh(const floor_mesh&) = delete; void draw(tile_shader& shader, chunk& c); private: struct vertex_data final { Vector2 texcoords; }; using quad_data = std::array; static std::array, TILE_COUNT> make_index_array(); static std::array, TILE_COUNT> make_position_array(); GL::Mesh _mesh; GL::Buffer _vertex_buffer{std::array{}, Magnum::GL::BufferUsage::DynamicDraw}, _index_buffer{make_index_array()}, _positions_buffer{make_position_array()}; static void set_tile(quad_data& data, tile_ref& x); }; } // namespace floormat