chunkmesher: check for NULLBLK to avoid holes at chunkborders

pull/5/head
EmaMaker 2023-06-15 10:10:49 +02:00
parent 73f38e5d2f
commit 4ada24e0d5
1 changed files with 7 additions and 3 deletions

View File

@ -124,9 +124,13 @@ void mesh(Chunk::Chunk* chunk)
} }
// Compute the mask // Compute the mask
mask[n++] = b1 != Block::NULLBLK && b2 != Block::NULLBLK && b1 == b2 ? Block::NULLBLK // Checking if b1==b2 is needed to generate a single quad
: backFace ? b1 == Block::AIR ? b2 : Block::NULLBLK // The else case provides face culling for adjacent solid faces
: b2 == Block::AIR ? b1 : Block::NULLBLK; // Checking for NULLBLK avoids creating empty faces if nearby chunk was not
// yet generated
mask[n++] = b1 == b2 ? Block::NULLBLK
: backFace ? b1 == Block::NULLBLK || b1 == Block::AIR ? b2 : Block::NULLBLK
: b2 == Block::NULLBLK || b2 == Block::AIR ? b1 : Block::NULLBLK;
} }
} }