diff options
-rw-r--r-- | src/chunk-render.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/chunk-render.cpp b/src/chunk-render.cpp index 3072f472..c5dd068a 100644 --- a/src/chunk-render.cpp +++ b/src/chunk-render.cpp @@ -3,6 +3,7 @@ #include "quads.hpp" #include "shaders/shader.hpp" #include <algorithm> +#include <Corrade/Containers/Array.h> #include <Corrade/Containers/ArrayViewStl.h> #include <Magnum/GL/Buffer.h> @@ -10,6 +11,12 @@ namespace floormat { using namespace floormat::Quads; +namespace { + +static Array<std::array<chunk::vertex, 4>> static_vertexes{NoInit, TILE_COUNT}; + +} // namespace + template<size_t N> std::array<std::array<UnsignedShort, 6>, N*TILE_COUNT> chunk::make_index_array(size_t max) @@ -49,8 +56,8 @@ auto chunk::ensure_ground_mesh() noexcept -> ground_mesh_tuple }); float hack_offset = _coord.z <= 0 ? -16 : 0; // XXX hack + auto& vertexes = static_vertexes; - std::array<std::array<vertex, 4>, TILE_COUNT> vertexes; for (auto k = 0uz; k < count; k++) { const uint8_t i = _ground->indexes[k]; |