X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fchunk.cpp;h=51694221b8a1c4acb359feb3a7b05ca5efe5024e;hb=bd6bd2c875f4b6baef913e5315aa9f7e7cd7da7a;hp=d298fb2640cd737f586aa1ad09ec09ac0ef00b8a;hpb=3072e2cd49ad1614100d1a1c73afe6a4888fb875;p=blank.git diff --git a/src/chunk.cpp b/src/chunk.cpp index d298fb2..5169422 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -263,6 +263,21 @@ int Chunk::GetLight(int index) const { } +bool Chunk::IsSurface(const Pos &pos) const { + const Block &block = BlockAt(pos); + if (!Type(block).visible) { + return false; + } + for (int face = 0; face < Block::FACE_COUNT; ++face) { + const Block *next = FindNext(pos, Block::Face(face)); + if (!next || !Type(*next).visible) { + return true; + } + } + return false; +} + + void Chunk::Allocate() { blocks.resize(Size(), Block(0)); light.resize(Size(), 0); @@ -462,8 +477,8 @@ ChunkLoader::ChunkLoader(const BlockTypeRegistry ®, const Generator &gen) , loaded() , to_generate() , to_free() -, load_dist(4) -, unload_dist(5) { +, load_dist(6) +, unload_dist(8) { }