X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fchunk.hpp;h=840bac0f3caf312574ebb888998f5aeae29ea4ea;hb=c877ddd21f402381d88a6bebdd5c7c0b4ac28ba9;hp=7e720bd84c5b49945f7dc7a45e6b2f0f1af9d699;hpb=3072e2cd49ad1614100d1a1c73afe6a4888fb875;p=blank.git diff --git a/src/chunk.hpp b/src/chunk.hpp index 7e720bd..840bac0 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -76,6 +76,10 @@ public: (idx / Width()) % Height() == Height() - 1; // high Y plane } + bool IsSurface(int index) const { return IsSurface(ToPos(index)); } + bool IsSurface(const Block::Pos &pos) const { return IsSurface(Pos(pos)); } + bool IsSurface(const Pos &pos) const; + void SetNeighbor(Chunk &); bool HasNeighbor(Block::Face f) const { return neighbor[f]; } Chunk &GetNeighbor(Block::Face f) { return *neighbor[f]; } @@ -154,9 +158,15 @@ class Generator; class ChunkLoader { public: - ChunkLoader(const BlockTypeRegistry &, const Generator &); + struct Config { + int load_dist = 6; + int unload_dist = 8; + }; + + ChunkLoader(const Config &, const BlockTypeRegistry &, const Generator &); void Generate(const Chunk::Pos &from, const Chunk::Pos &to); + void GenerateSurrounding(const Chunk::Pos &); std::list &Loaded() { return loaded; }