]> git.localhorst.tv Git - blank.git/blobdiff - src/chunk.cpp
add some light blocks to generated surfaces
[blank.git] / src / chunk.cpp
index 81c8698db803dbcc3a1e99a4ebe1a9226bf15976..51694221b8a1c4acb359feb3a7b05ca5efe5024e 100644 (file)
@@ -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);