chunkmesher: compiler flag to not show borders at world limit

pull/13/head
EmaMaker 2023-10-04 13:26:11 +02:00
parent ba95db4678
commit 78b65894b7
1 changed files with 7 additions and 0 deletions

View File

@ -12,6 +12,7 @@
#include "utils.hpp" #include "utils.hpp"
#define CHUNK_MESH_DATA_QUANTITY 100 #define CHUNK_MESH_DATA_QUANTITY 100
#define CHUNK_MESH_WORLD_LIMIT_BORDERS 0
namespace chunkmesher{ namespace chunkmesher{
@ -129,9 +130,15 @@ void mesh(Chunk::Chunk* chunk)
// The else case provides face culling for adjacent solid faces // The else case provides face culling for adjacent solid faces
// Checking for NULLBLK avoids creating empty faces if nearby chunk was not // Checking for NULLBLK avoids creating empty faces if nearby chunk was not
// yet generated // yet generated
#if CHUNK_MESH_WORLD_LIMIT_BORDERS == 1
mask[n++] = b1 == b2 ? Block::NULLBLK mask[n++] = b1 == b2 ? Block::NULLBLK
: backFace ? b1 == Block::NULLBLK || b1 == Block::AIR ? b2 : Block::NULLBLK : backFace ? b1 == Block::NULLBLK || b1 == Block::AIR ? b2 : Block::NULLBLK
: b2 == Block::NULLBLK || b2 == Block::AIR ? b1 : Block::NULLBLK; : b2 == Block::NULLBLK || b2 == Block::AIR ? b1 : Block::NULLBLK;
#else
mask[n++] = b1 == b2 ? Block::NULLBLK
: backFace ? b1 == Block::AIR ? b2 : Block::NULLBLK
: b2 == Block::AIR ? b1 : Block::NULLBLK;
#endif
} }
} }