mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
fix extended blocks culling and lighting at chunk boundaries
This commit is contained in:
parent
1eeb59de26
commit
27ce16db27
3 changed files with 19 additions and 6 deletions
|
|
@ -181,6 +181,10 @@ const Mesh<ChunkVertex>* ChunksRenderer::retrieveChunk(
|
|||
chunk->top,
|
||||
chunk->z * CHUNK_D + CHUNK_D
|
||||
);
|
||||
// Expand bounds to include possible overhang from extended blocks rendered by this chunk
|
||||
const float overhang = 4.0f; // blocks
|
||||
min.x -= overhang; min.z -= overhang;
|
||||
max.x += overhang; max.z += overhang;
|
||||
|
||||
if (!frustum.isBoxVisible(min, max)) return nullptr;
|
||||
}
|
||||
|
|
@ -332,6 +336,9 @@ void ChunksRenderer::drawSortedMeshes(const Camera& camera, Shader& shader) {
|
|||
chunk->top,
|
||||
chunk->z * CHUNK_D + CHUNK_D
|
||||
);
|
||||
const float overhang = 4.0f;
|
||||
min.x -= overhang; min.z -= overhang;
|
||||
max.x += overhang; max.z += overhang;
|
||||
|
||||
if (!frustum.isBoxVisible(min, max)) continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue