From ebad1227aaafbd962756155732f0ec39085f7d51 Mon Sep 17 00:00:00 2001 From: Mel Date: Tue, 18 Oct 2022 18:44:54 +0200 Subject: Basic Chunk --- src/World/Chunk.hpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/World/Chunk.hpp (limited to 'src/World/Chunk.hpp') 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 +#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, 4> face_tex_coords(BlockType type, BlockSide side); + + struct BlockData { + BlockType type; + }; + + BlockData m_blocks[CHUNK_WIDTH][CHUNK_HEIGHT][CHUNK_WIDTH]; +}; + +} -- cgit 1.4.1