diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2024-08-26 20:43:03 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-09-20 16:08:45 +0200 |
| commit | 1efe1e05181a9131cbcf114122513fc91e65014f (patch) | |
| tree | 36ded0d6dc87bcf8b55e7c2800ebb2be177222a1 /src/chunk-render.cpp | |
| parent | a0b26eea80f4703c632a60efcc4115e826e36506 (diff) | |
src/chunk: don't allocate empty ground/wall/scenery meshes
Diffstat (limited to 'src/chunk-render.cpp')
| -rw-r--r-- | src/chunk-render.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/chunk-render.cpp b/src/chunk-render.cpp index 0cc88af2..0c5d5bc6 100644 --- a/src/chunk-render.cpp +++ b/src/chunk-render.cpp @@ -52,6 +52,12 @@ auto chunk::ensure_ground_mesh() noexcept -> ground_mesh_tuple if (_ground->atlases[i]) _ground->indexes[count++] = uint8_t(i); + if (count == 0) + { + ground_mesh = GL::Mesh{NoCreate}; + return { ground_mesh, {}, 0 }; + } + std::sort(_ground->indexes.begin(), _ground->indexes.begin() + count, [this](uint8_t a, uint8_t b) { return _ground->atlases[a].get() < _ground->atlases[b].get(); |
