summaryrefslogtreecommitdiffhomepage
path: root/draw/wall.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-08-26 20:43:03 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-09-20 16:08:45 +0200
commit1efe1e05181a9131cbcf114122513fc91e65014f (patch)
tree36ded0d6dc87bcf8b55e7c2800ebb2be177222a1 /draw/wall.cpp
parenta0b26eea80f4703c632a60efcc4115e826e36506 (diff)
src/chunk: don't allocate empty ground/wall/scenery meshes
Diffstat (limited to 'draw/wall.cpp')
-rw-r--r--draw/wall.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/draw/wall.cpp b/draw/wall.cpp
index 1c9c80cc..cbe90b23 100644
--- a/draw/wall.cpp
+++ b/draw/wall.cpp
@@ -16,6 +16,9 @@ wall_mesh::wall_mesh() = default;
void wall_mesh::draw(tile_shader& shader, chunk& c)
{
const auto [mesh_, ids, size] = c.ensure_wall_mesh();
+ if (size == 0)
+ return;
+
struct { wall_atlas* atlas = nullptr; size_t pos = 0; } last;
GL::MeshView mesh{mesh_};
[[maybe_unused]] size_t draw_count = 0;