X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fchunk.hpp;h=e27cf5ed09d5b3e6a9b018e5bd1b4ca927450a47;hb=a58c4558e7d4934f4d0ee621520acfe1c8258c93;hp=e442e4e289107ee735417c9677ffa6157b42396d;hpb=2d5671c2ef977defae9ce0ce7248582ab3e8f011;p=blank.git diff --git a/src/chunk.hpp b/src/chunk.hpp index e442e4e..e27cf5e 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -52,6 +52,17 @@ public: ); } + static constexpr bool IsBorder(int idx) { + return + idx < Width() * Height() || + (idx / Width()) % Height() == 0 || + (idx / Width()) % Height() == Height() - 1 || + (idx / (Width() * Height())) == Depth() - 1; + } + + // check if block at given index is completely enclosed (and therefore invisible) + bool Obstructed(int idx) const; + void Allocate(); void Invalidate() { dirty = true; }