mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix chunk mesh refreshing
This commit is contained in:
parent
7b962841d6
commit
29e018cff8
1 changed files with 10 additions and 2 deletions
|
|
@ -135,7 +135,7 @@ const Mesh* ChunksRenderer::getOrRender(
|
|||
if (found == meshes.end()) {
|
||||
return render(chunk, important);
|
||||
}
|
||||
if (chunk->flags.modified) {
|
||||
if (chunk->flags.modified && chunk->flags.lighted) {
|
||||
render(chunk, important);
|
||||
}
|
||||
return found->second.mesh.get();
|
||||
|
|
@ -149,9 +149,17 @@ const Mesh* ChunksRenderer::retrieveChunk(
|
|||
size_t index, const Camera& camera, Shader& shader, bool culling
|
||||
) {
|
||||
auto chunk = chunks.getChunks()[index];
|
||||
if (chunk == nullptr || !chunk->flags.lighted) {
|
||||
if (chunk == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!chunk->flags.lighted) {
|
||||
const auto& found = meshes.find({chunk->x, chunk->z});
|
||||
if (found == meshes.end()) {
|
||||
return nullptr;
|
||||
} else {
|
||||
return found->second.mesh.get();
|
||||
}
|
||||
}
|
||||
float distance = glm::distance(
|
||||
camera.position,
|
||||
glm::vec3(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue