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.hpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/World/Chunk.hpp b/src/World/Chunk.hpp
new file mode 100644
index 0000000..eafc613
--- /dev/null
+++ b/src/World/Chunk.hpp
@@ -0,0 +1,30 @@
+#pragma once
+
+#include <cstdint>
+#include "BlockType.hpp"
+#include "../Mesh.hpp"
+#include "BlockSide.hpp"
+
+#define CHUNK_WIDTH 8
+#define CHUNK_HEIGHT 8
+
+namespace MC {
+
+class Chunk {
+public:
+    Chunk() : m_blocks{} {};
+
+    void set(uint32_t x, uint32_t y, uint32_t z, BlockType type);
+
+    Mesh mesh();
+private:
+    static std::array<Vector<2>, 4> face_tex_coords(BlockType type, BlockSide side);
+
+    struct BlockData {
+        BlockType type;
+    };
+
+    BlockData m_blocks[CHUNK_WIDTH][CHUNK_HEIGHT][CHUNK_WIDTH];
+};
+
+}