diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-12-08 08:13:37 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-12-08 08:29:12 +0100 |
commit | ab31f0ed81301c23d6847f3ca1513d4b90275de7 (patch) | |
tree | 735d63bd525eccabc43ebc75e804469e898950af /draw/anim.hpp | |
parent | b26ddfcee60de0951f0feaf4ae4e12551853ee21 (diff) |
draw, main, src/chunk: batch scenery writes
Diffstat (limited to 'draw/anim.hpp')
-rw-r--r-- | draw/anim.hpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/draw/anim.hpp b/draw/anim.hpp index e11d45ae..263d851d 100644 --- a/draw/anim.hpp +++ b/draw/anim.hpp @@ -1,7 +1,5 @@ #pragma once - #include "local-coords.hpp" -#include "scenery.hpp" #include <array> #include <Corrade/Containers/ArrayViewStl.h> #include <Magnum/Magnum.h> @@ -9,6 +7,8 @@ #include <Magnum/Math/Vector3.h> #include <Magnum/GL/Mesh.h> #include <Magnum/GL/Buffer.h> +#include "src/scenery.hpp" +#include "main/clickable.hpp" //namespace floormat::Serialize { struct anim_frame; } @@ -17,13 +17,21 @@ namespace floormat { struct tile_shader; struct anim_atlas; struct chunk; -//using anim_frame = Serialize::anim_frame; +template<typename Atlas, typename T> struct clickable; +struct scenery; struct anim_mesh final { + using clickable_scenery = clickable<anim_atlas, scenery>; + anim_mesh(); - void draw(tile_shader& shader, anim_atlas& atlas, rotation r, std::size_t frame, local_coords xy); + + 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); + static void add_clickable(tile_shader& shader, const Vector2i& win_size, + chunk_coords c, std::uint8_t i, const std::shared_ptr<anim_atlas>& atlas, scenery& s, + std::vector<clickable_scenery>& clickable); private: struct vertex_data final { |