diff options
| author | Mel <einebeere@gmail.com> | 2023-12-07 02:14:47 +0100 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2023-12-07 02:14:47 +0100 |
| commit | efd17623627607a26f33dac8f7ef1a1ddc931907 (patch) | |
| tree | 76cf0389ae927bfc697c830155d926843178030e /src/World/Chunk.hpp | |
| parent | 581f50e0bd45a19282d7958975997d376512b195 (diff) | |
| download | meowcraft-efd17623627607a26f33dac8f7ef1a1ddc931907.tar.zst meowcraft-efd17623627607a26f33dac8f7ef1a1ddc931907.zip | |
Gather all possibly colliding blocks in the player move domain for collision detection
Diffstat (limited to 'src/World/Chunk.hpp')
| -rw-r--r-- | src/World/Chunk.hpp | 12 |
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; |
