]> git.localhorst.tv Git - blank.git/blobdiff - src/world/Chunk.hpp
some cleaning :)
[blank.git] / src / world / Chunk.hpp
index 8493ef6e2ef1b7f4f61ef5439484282a8e3ffbab..8d6816c29b8f526527bbb8fb07688f74132c340c 100644 (file)
@@ -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;