#ifndef CHUNK_H #define CHUNK_H #include "common/block/Block.h" class Chunk { public: Chunk(int chunkX, int chunkZ); virtual ~Chunk(); void setBlock(int x, int y, int z, const Block& block); const Block& getBlock(int x, int y, int z); int getChunkX() const; int getChunkZ() const; bool isDirty() const; bool isDirty(int index) const; void clearDirtyFlag(int index); // chunk constants static const int PARTION_HEIGHT = 16; static const int HEIGHT_PARTIONS = 16; static const int WIDTH = 16; static const int HEIGHT = PARTION_HEIGHT * HEIGHT_PARTIONS; static const int DEPTH = 16; static const int BITMASK_WIDTH = WIDTH - 1; static const int BITMASK_HEIGHT = HEIGHT - 1; static const int BITMASK_DEPTH = DEPTH - 1; private: int chunkX; int chunkZ; BlockId blocks[HEIGHT][WIDTH][DEPTH]; bool dirty[HEIGHT_PARTIONS]; }; #endif