fix chunk mesh refreshing
This commit is contained in:
parent
7b962841d6
commit
29e018cff8
@ -135,7 +135,7 @@ const Mesh* ChunksRenderer::getOrRender(
|
|||||||
if (found == meshes.end()) {
|
if (found == meshes.end()) {
|
||||||
return render(chunk, important);
|
return render(chunk, important);
|
||||||
}
|
}
|
||||||
if (chunk->flags.modified) {
|
if (chunk->flags.modified && chunk->flags.lighted) {
|
||||||
render(chunk, important);
|
render(chunk, important);
|
||||||
}
|
}
|
||||||
return found->second.mesh.get();
|
return found->second.mesh.get();
|
||||||
@ -149,9 +149,17 @@ const Mesh* ChunksRenderer::retrieveChunk(
|
|||||||
size_t index, const Camera& camera, Shader& shader, bool culling
|
size_t index, const Camera& camera, Shader& shader, bool culling
|
||||||
) {
|
) {
|
||||||
auto chunk = chunks.getChunks()[index];
|
auto chunk = chunks.getChunks()[index];
|
||||||
if (chunk == nullptr || !chunk->flags.lighted) {
|
if (chunk == nullptr) {
|
||||||
return 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(
|
float distance = glm::distance(
|
||||||
camera.position,
|
camera.position,
|
||||||
glm::vec3(
|
glm::vec3(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user