X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FChunk.hpp;h=8d6816c29b8f526527bbb8fb07688f74132c340c;hb=6f94235a5b7c140852703e60c8a74760b8b61d99;hp=8493ef6e2ef1b7f4f61ef5439484282a8e3ffbab;hpb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;p=blank.git diff --git a/src/world/Chunk.hpp b/src/world/Chunk.hpp index 8493ef6..8d6816c 100644 --- a/src/world/Chunk.hpp +++ b/src/world/Chunk.hpp @@ -71,6 +71,15 @@ public: } glm::mat4 ToTransform(const Pos &pos, int idx) const noexcept; + static bool IsBorder(const Pos &pos) noexcept { + return + pos.x == 0 || + pos.x == width - 1 || + pos.y == 0 || + pos.y == height - 1 || + pos.z == 0 || + pos.z == depth - 1; + } static constexpr bool IsBorder(int idx) noexcept { return idx < width * height || // low Z plane @@ -149,8 +158,8 @@ private: private: const BlockTypeRegistry *types; Chunk *neighbor[Block::FACE_COUNT]; - Block blocks[16 * 16 * 16]; - unsigned char light[16 * 16 * 16]; + Block blocks[size]; + unsigned char light[size]; BlockModel model; Pos position; bool dirty;