[ClientChunk] Only start meshing if all neighbours are initialized.

This commit is contained in:
Quentin Bazin 2021-05-18 02:52:37 +02:00
parent d6d5717a43
commit bfc78434f5
2 changed files with 6 additions and 4 deletions

View File

@ -56,12 +56,14 @@ void ClientChunk::update() {
}
void ClientChunk::process() {
if (m_isReadyForMeshing) {
m_verticesCount = m_builder.buildChunk(*this, m_vbo);
++ClientChunk::chunkUpdateCounter;
m_lastMeshingTime = gk::GameClock::getInstance().getTicks(true);
}
}
void ClientChunk::onBlockPlaced(int x, int y, int z, const Block &) {
auto addSurroundingChunkToProcess = [this](u8 i) {

View File

@ -84,7 +84,7 @@ void ClientWorld::requestClosestChunkMeshing() {
// If we have a chunk marked for initialization
if (ud < 1000000.0) {
ClientChunk *chunk = (ClientChunk *)getChunk(ux, uy, uz);
if(chunk && !chunk->isReadyForMeshing()) {
if(chunk && !chunk->isReadyForMeshing() && chunk->areAllNeighboursInitialized()) {
chunk->setReadyForMeshing(true);
chunk->setChanged();
addChunkToUpdate(chunk);