diff options
| author | Mel <einebeere@gmail.com> | 2022-10-18 18:44:54 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-10-18 18:44:54 +0200 |
| commit | ebad1227aaafbd962756155732f0ec39085f7d51 (patch) | |
| tree | ec88d18e0d1b5bdcee1527332666f93f8bfb7534 /src/World/Chunk.hpp | |
| parent | 63ecb48a75f0b7df491b00e9048ebb38d923089a (diff) | |
| download | meowcraft-ebad1227aaafbd962756155732f0ec39085f7d51.tar.zst meowcraft-ebad1227aaafbd962756155732f0ec39085f7d51.zip | |
Basic Chunk
Diffstat (limited to 'src/World/Chunk.hpp')
| -rw-r--r-- | src/World/Chunk.hpp | 30 |
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]; +}; + +} |
