mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix extended blocks culling on chunk borders
This commit is contained in:
parent
8e51f1b77c
commit
7abbe43c3c
5 changed files with 33 additions and 13 deletions
|
|
@ -251,6 +251,10 @@ void BlocksRenderer::blockAABB(
|
|||
Z = orient.axes[2];
|
||||
orient.transform(hitbox);
|
||||
}
|
||||
if (block->rt.extended) {
|
||||
meshAABB.addPoint(coord + hitbox.max());
|
||||
meshAABB.addPoint(coord + hitbox.min());
|
||||
}
|
||||
coord -= glm::vec3(0.5f) - hitbox.center();
|
||||
|
||||
if (ao) {
|
||||
|
|
@ -687,6 +691,7 @@ SortingMeshData BlocksRenderer::renderTranslucent(
|
|||
void BlocksRenderer::build(
|
||||
const Chunk* chunk, const VoxelsRenderVolume& volume
|
||||
) {
|
||||
meshAABB = AABB(glm::vec3(CHUNK_W, CHUNK_H, CHUNK_D));
|
||||
this->chunk = chunk;
|
||||
this->voxelsBuffer = &volume;
|
||||
if (voxelsBuffer->pickBlockId(
|
||||
|
|
@ -767,7 +772,8 @@ ChunkMeshData BlocksRenderer::createMesh() {
|
|||
sizeof(ChunkVertex::ATTRIBUTES) / sizeof(VertexAttribute)
|
||||
)
|
||||
),
|
||||
std::move(sortingMesh)
|
||||
std::move(sortingMesh),
|
||||
std::move(meshAABB)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -786,7 +792,7 @@ ChunkMesh BlocksRenderer::render(
|
|||
IndexBufferData {indexBuffer.get(), indexCount},
|
||||
IndexBufferData {denseIndexBuffer.get(), denseIndexCount},
|
||||
}
|
||||
), std::move(sortingMesh), nullptr};
|
||||
), std::move(sortingMesh), nullptr, std::move(meshAABB)};
|
||||
}
|
||||
|
||||
size_t BlocksRenderer::getMemoryConsumption() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue