#pragma once #include "local-coords.hpp" #include #include #include #include #include #include #include #include "src/scenery.hpp" #include "main/clickable.hpp" //namespace floormat::Serialize { struct anim_frame; } namespace floormat { struct tile_shader; struct anim_atlas; struct chunk; template struct clickable; struct scenery; struct anim_mesh final { using clickable_scenery = clickable; anim_mesh(); void draw(tile_shader& shader, chunk& c); void draw(tile_shader& shader, anim_atlas& atlas, rotation r, std::size_t frame, const Vector3& pos, float depth); void draw(tile_shader& shader, anim_atlas& atlas, rotation r, std::size_t frame, local_coords xy, Vector2b offset); static void add_clickable(tile_shader& shader, const Vector2i& win_size, chunk_coords c, std::uint8_t i, const std::shared_ptr& atlas, scenery& s, std::vector& clickable); private: struct vertex_data final { Vector3 position; Vector2 texcoords; float depth = -1; }; using quad_data = std::array; static std::array make_index_array(); GL::Mesh _mesh; GL::Buffer _vertex_buffer{quad_data{}, Magnum::GL::BufferUsage::DynamicDraw}, _index_buffer{make_index_array()}; }; } // namespace floormat