summaryrefslogtreecommitdiffhomepage
path: root/draw/anim.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-04-09 21:54:56 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-04-09 21:55:29 +0200
commit3c6e95bd369270e90472bc25f91dff76d0811b71 (patch)
tree62e1ee33f244252ba854d5494fd2ce8c8de83fe0 /draw/anim.hpp
parent3694207151dbee36ea89681fc0fd163bdac5695c (diff)
draw: do batching in an easier way for now
Diffstat (limited to 'draw/anim.hpp')
-rw-r--r--draw/anim.hpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/draw/anim.hpp b/draw/anim.hpp
index eaa191f5..93900caf 100644
--- a/draw/anim.hpp
+++ b/draw/anim.hpp
@@ -34,7 +34,9 @@ struct anim_mesh final
std::vector<clickable>& list);
private:
- static std::array<UnsignedShort, 6> make_index_array();
+ static constexpr size_t batch_size = 256, quad_index_count = 6;
+ static std::array<UnsignedShort, quad_index_count> make_index_array();
+ static std::array<std::array<UnsignedShort, quad_index_count>, batch_size> make_batch_index_array();
struct vertex_data final {
Vector3 position;
@@ -47,6 +49,10 @@ private:
GL::Mesh _mesh;
GL::Buffer _vertex_buffer{quad_data{}, Magnum::GL::BufferUsage::DynamicDraw},
_index_buffer{make_index_array()};
+
+ GL::Mesh _batch_mesh{NoCreate};
+ GL::Buffer _batch_vertex_buffer{std::array<quad_data, batch_size>{}, Magnum::GL::BufferUsage::DynamicDraw},
+ _batch_index_buffer{make_batch_index_array()};
};
} // namespace floormat