diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-04 02:36:36 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-04 02:36:36 +0100 |
commit | d867b03f7ca7f51f64ccca070b83d45fdccdb40c (patch) | |
tree | 64da2db80adb1d8602ba24fb9d354ecc4c399631 | |
parent | 5c2052c03e5ddab5f37de4e9991ed2a791c04222 (diff) |
b
-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]; |