mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
fix chunk meshes refresh in some cases
This commit is contained in:
parent
6cccb3876b
commit
9e6ff82e88
2 changed files with 3 additions and 2 deletions
|
|
@ -126,12 +126,12 @@ const ChunkMesh* ChunksRenderer::render(
|
|||
const std::shared_ptr<Chunk>& 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)});
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue