fix extended blocks culling on chunk borders

This commit is contained in:
MihailRis 2026-02-18 22:32:31 +03:00
parent 8e51f1b77c
commit 7abbe43c3c
5 changed files with 33 additions and 13 deletions

View file

@ -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 {