diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-20 06:29:31 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-20 07:54:17 +0100 |
commit | 1c13313ec845d43077bd7e78538358ca4e007f8a (patch) | |
tree | 95923091df12f95bae5049d88037c9c8ff39f07f /draw/anim.hpp | |
parent | 38a87664deaedacf0aa8e97d9b0aa46dfb6c8ae6 (diff) |
sort entities by id rather than draw order
Diffstat (limited to 'draw/anim.hpp')
-rw-r--r-- | draw/anim.hpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/draw/anim.hpp b/draw/anim.hpp index 632a89e3..9f279b38 100644 --- a/draw/anim.hpp +++ b/draw/anim.hpp @@ -1,7 +1,9 @@ #pragma once #include "local-coords.hpp" #include "rotation.hpp" +#include "chunk.hpp" #include <array> +#include <Corrade/Containers/Array.h> #include <Corrade/Containers/ArrayViewStl.h> #include <Magnum/Magnum.h> #include <Magnum/Math/Vector2.h> @@ -30,6 +32,8 @@ struct anim_mesh final static void add_clickable(tile_shader& shader, const Vector2i& win_size, const std::shared_ptr<entity>& s, std::vector<clickable>& list); private: + static std::array<UnsignedShort, 6> make_index_array(); + struct vertex_data final { Vector3 position; Vector2 texcoords; @@ -37,8 +41,7 @@ private: }; using quad_data = std::array<vertex_data, 4>; - static std::array<UnsignedShort, 6> make_index_array(); - + Array<typename chunk::draw_entity> _draw_array; GL::Mesh _mesh; GL::Buffer _vertex_buffer{quad_data{}, Magnum::GL::BufferUsage::DynamicDraw}, _index_buffer{make_index_array()}; |