summary refs log tree commit diff
path: root/src/World/Chunk.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/World/Chunk.hpp')
-rw-r--r--src/World/Chunk.hpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/World/Chunk.hpp b/src/World/Chunk.hpp
index ed3220d..9a29284 100644
--- a/src/World/Chunk.hpp
+++ b/src/World/Chunk.hpp
@@ -48,6 +48,18 @@ public:
     void set_details(const Details& details) { m_details = details; }
     Details& details(){ return m_details; }
 
+    template <typename F>
+    void for_each(F f) {
+        for (U32 x = 0; x < Width; ++x) {
+            for (U32 y = 0; y < Height; ++y) {
+                for (U32 z = 0; z < Width; ++z) {
+                    Position::BlockLocal pos{x, y, z};
+                    f(pos, at(x, y, z));
+                }
+            }
+        }
+    }
+
     ChunkIndex index() const;
     Vector<3> position() const;