From 9e6ff82e887d2fcede932fd7043c7cab14b73f14 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 16 Mar 2026 19:24:50 +0300 Subject: [PATCH] fix chunk meshes refresh in some cases --- src/graphics/render/ChunksRenderer.cpp | 3 ++- src/logic/scripting/lua/libs/libblock.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/graphics/render/ChunksRenderer.cpp b/src/graphics/render/ChunksRenderer.cpp index 57603d63e..baf4cf356 100644 --- a/src/graphics/render/ChunksRenderer.cpp +++ b/src/graphics/render/ChunksRenderer.cpp @@ -126,12 +126,12 @@ const ChunkMesh* ChunksRenderer::render( const std::shared_ptr& chunk, bool important, bool lowPriority ) { glm::ivec2 key(chunk->x, chunk->z); - chunk->flags.modified = false; if (important) { ChunkMesh mesh {}; auto voxelsBuffer = prepareVoxelsVolume(*chunk); mesh = renderer->render(chunk.get(), *voxelsBuffer); meshes[key] = std::move(mesh); + chunk->flags.modified = false; return &meshes[key]; } if (inwork.find(key) != inwork.end() || @@ -140,6 +140,7 @@ const ChunkMesh* ChunksRenderer::render( lowPriority)) { return nullptr; } + chunk->flags.modified = false; enqueuedInFrame++; auto voxelsBuffer = prepareVoxelsVolume(*chunk); threadPool.enqueueJob({chunk, std::move(voxelsBuffer)}); diff --git a/src/logic/scripting/lua/libs/libblock.cpp b/src/logic/scripting/lua/libs/libblock.cpp index f2a615dc0..6c9550dde 100644 --- a/src/logic/scripting/lua/libs/libblock.cpp +++ b/src/logic/scripting/lua/libs/libblock.cpp @@ -100,7 +100,7 @@ static int l_seek_origin(lua::State* L) { auto z = lua::tointeger(L, 3); const auto& level = require_level(); const auto& vox = blocks_agent::require(*level.chunks, x, y, z); - auto& def = indices->blocks.require(vox.id); + const auto& def = indices->blocks.require(vox.id); return lua::pushivec_stack( L, blocks_agent::seek_origin(*level.chunks, {x, y, z}, def, vox.state) );