#ifndef CHUNK_H #define CHUNK_H #include "common/block/Block.h" #include "common/utils/Types.h" class Chunk final { public: Chunk(); void setBlock(u32 x, u32 y, u32 z, const Block& block); const Block& getBlock(u32 x, u32 y, u32 z) const; static const u32 CHUNK_BIT_SIZE = 4; private: static const u32 CHUNK_PARTION_SIZE = 1 << CHUNK_BIT_SIZE; static const u32 HEIGHT_PARTIONS = 16; static const u32 HEIGHT = CHUNK_PARTION_SIZE * HEIGHT_PARTIONS; static const u32 BITMASK = CHUNK_PARTION_SIZE - 1; static const u32 BITMASK_HEIGHT = HEIGHT - 1; u16 blocks[HEIGHT][CHUNK_PARTION_SIZE][CHUNK_PARTION_SIZE]; }; #endif