summaryrefslogtreecommitdiffhomepage
path: root/draw
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-04-09 22:46:17 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-04-09 22:46:17 +0200
commita5d5ad64ff97201e2ccf83c1d79008190906ebcd (patch)
treeebde66821202c21d339d2164c14abc0518c8e7f2 /draw
parentc04906db429b7c626a753d49e2d64c51135c6039 (diff)
move scenery draw scratch buffers to central place
Diffstat (limited to 'draw')
-rw-r--r--draw/anim.cpp2
-rw-r--r--draw/anim.hpp3
2 files changed, 4 insertions, 1 deletions
diff --git a/draw/anim.cpp b/draw/anim.cpp
index b99b02e3..b24dffa7 100644
--- a/draw/anim.cpp
+++ b/draw/anim.cpp
@@ -59,7 +59,7 @@ void anim_mesh::draw(tile_shader& shader, const Vector2i& win_size, chunk& c, st
{
constexpr auto quad_index_count = 6;
- auto [mesh_, es, size] = c.ensure_scenery_mesh(_draw_array);
+ auto [mesh_, es, size] = c.ensure_scenery_mesh({ _draw_array, _draw_vertexes, _draw_indexes });
GL::MeshView mesh{mesh_};
const auto max_index = uint32_t(size*quad_index_count - 1);
diff --git a/draw/anim.hpp b/draw/anim.hpp
index eaa191f5..da484d6c 100644
--- a/draw/anim.hpp
+++ b/draw/anim.hpp
@@ -44,6 +44,9 @@ private:
using quad_data = std::array<vertex_data, 4>;
Array<chunk::entity_draw_order> _draw_array;
+ std::vector<std::array<uint16_t, 6>> _draw_indexes;
+ std::vector<std::array<chunk::vertex, 4>> _draw_vertexes;
+
GL::Mesh _mesh;
GL::Buffer _vertex_buffer{quad_data{}, Magnum::GL::BufferUsage::DynamicDraw},
_index_buffer{make_index_array()};