blob: 0a5f26917c89d8c0d7a2d0942fad9dc0eca965e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#pragma once
#include <cstdint>
#include "BlockType.hpp"
#include "../Mesh.hpp"
#include "BlockSide.hpp"
#define CHUNK_WIDTH 16
#define CHUNK_HEIGHT 32
namespace MC {
class Chunk {
public:
Chunk() : m_blocks{} {};
void set(uint32_t x, uint32_t y, uint32_t z, BlockType type);
Mesh mesh();
private:
bool is_face_visible(uint32_t x, uint32_t y, uint32_t z, BlockSide side);
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];
};
}
|