X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fchunk.cpp;fp=src%2Fchunk.cpp;h=51694221b8a1c4acb359feb3a7b05ca5efe5024e;hb=774253e509ce13881229efda8849bf6f3c47b665;hp=81c8698db803dbcc3a1e99a4ebe1a9226bf15976;hpb=b368ecb2c0f34e27b1d3b97cceb218b554dee324;p=blank.git diff --git a/src/chunk.cpp b/src/chunk.cpp index 81c8698..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);