X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fchunk.hpp;h=255d73b163f70ff25db4bade6f1b9a087a767aee;hb=b4995967309bf5570161db2287e27b84ca94ab9a;hp=61303aad02280f102c7d3d14a3175e2b8c73a67d;hpb=374843f5b3ae60c0d02704a8da5100ac8abe7f1a;p=blank.git diff --git a/src/chunk.hpp b/src/chunk.hpp index 61303aa..255d73b 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -51,6 +51,18 @@ public: 0.5f + (idx / (Width() * Height())) ); } + glm::mat4 ToTransform(int idx) const; + + 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; } @@ -101,8 +113,8 @@ public: std::list &Loaded() { return loaded; } Chunk *Loaded(const Chunk::Pos &); - Chunk *Queued(const Chunk::Pos &); - Chunk *Known(const Chunk::Pos &); + bool Queued(const Chunk::Pos &); + bool Known(const Chunk::Pos &); Chunk &ForceLoad(const Chunk::Pos &); void Rebase(const Chunk::Pos &); @@ -115,7 +127,7 @@ private: const Generator &gen; std::list loaded; - std::list to_generate; + std::list to_generate; std::list to_free; int load_dist;