mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 14:01: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
|
const std::shared_ptr<Chunk>& chunk, bool important, bool lowPriority
|
||||||
) {
|
) {
|
||||||
glm::ivec2 key(chunk->x, chunk->z);
|
glm::ivec2 key(chunk->x, chunk->z);
|
||||||
chunk->flags.modified = false;
|
|
||||||
if (important) {
|
if (important) {
|
||||||
ChunkMesh mesh {};
|
ChunkMesh mesh {};
|
||||||
auto voxelsBuffer = prepareVoxelsVolume(*chunk);
|
auto voxelsBuffer = prepareVoxelsVolume(*chunk);
|
||||||
mesh = renderer->render(chunk.get(), *voxelsBuffer);
|
mesh = renderer->render(chunk.get(), *voxelsBuffer);
|
||||||
meshes[key] = std::move(mesh);
|
meshes[key] = std::move(mesh);
|
||||||
|
chunk->flags.modified = false;
|
||||||
return &meshes[key];
|
return &meshes[key];
|
||||||
}
|
}
|
||||||
if (inwork.find(key) != inwork.end() ||
|
if (inwork.find(key) != inwork.end() ||
|
||||||
|
|
@ -140,6 +140,7 @@ const ChunkMesh* ChunksRenderer::render(
|
||||||
lowPriority)) {
|
lowPriority)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
chunk->flags.modified = false;
|
||||||
enqueuedInFrame++;
|
enqueuedInFrame++;
|
||||||
auto voxelsBuffer = prepareVoxelsVolume(*chunk);
|
auto voxelsBuffer = prepareVoxelsVolume(*chunk);
|
||||||
threadPool.enqueueJob({chunk, std::move(voxelsBuffer)});
|
threadPool.enqueueJob({chunk, std::move(voxelsBuffer)});
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ static int l_seek_origin(lua::State* L) {
|
||||||
auto z = lua::tointeger(L, 3);
|
auto z = lua::tointeger(L, 3);
|
||||||
const auto& level = require_level();
|
const auto& level = require_level();
|
||||||
const auto& vox = blocks_agent::require(*level.chunks, x, y, z);
|
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(
|
return lua::pushivec_stack(
|
||||||
L, blocks_agent::seek_origin(*level.chunks, {x, y, z}, def, vox.state)
|
L, blocks_agent::seek_origin(*level.chunks, {x, y, z}, def, vox.state)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue