summary refs log tree commit diff
path: root/src/World/Chunk.cpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2023-08-14 03:40:10 +0200
committerMel <einebeere@gmail.com>2023-08-14 03:40:10 +0200
commit7562a79fa214245544cb379423314c3a0766a7f2 (patch)
tree0aaafd06c6026fabc82dbc3454487d009c9043e7 /src/World/Chunk.cpp
parent5a1b126f1f6d55226c2b5068d0c17c428fd29ba8 (diff)
downloadmeowcraft-7562a79fa214245544cb379423314c3a0766a7f2.tar.zst
meowcraft-7562a79fa214245544cb379423314c3a0766a7f2.zip
Generate AABBs for terrain that collides with Player
Diffstat (limited to 'src/World/Chunk.cpp')
-rw-r--r--src/World/Chunk.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/World/Chunk.cpp b/src/World/Chunk.cpp
index 8b204c0..6cb67bb 100644
--- a/src/World/Chunk.cpp
+++ b/src/World/Chunk.cpp
@@ -19,10 +19,6 @@ Chunk::BlockData& Chunk::at(Position::BlockLocal pos) {
     return at(pos.x(), pos.y(), pos.z());
 }
 
-Bool Chunk::is_empty(U32 x, U32 y, U32 z) const {
-    return at(x, y, z).empty();
-}
-
 ChunkIndex Chunk::index() const {
     return m_index;
 }
@@ -39,12 +35,19 @@ void Chunk::damage() {
     m_damaged = true;
 }
 
-Bool Chunk::is_valid_position(U32 x, U32 y, U32 z) {
-    return x < Width && y < Height && z < Width;
+Bool Chunk::is_valid_position(Position::BlockLocal pos) {
+    return pos.x() < Width && pos.y() < Height && pos.z() < Width;
 }
 
 U64 Chunk::pos(U32 x, U32 y, U32 z) {
     return x + Width * y + Width * Height * z;
 }
 
+AABB Chunk::block_bounds(Position::BlockLocal pos) {
+    return {
+        {pos.x(), pos.y(), pos.z()},
+        {pos.x() + 1, pos.y() + 1, pos.z() + 1},
+    };
+}
+
 }