1234567891011121314151617181920212223242526272829303132 |
- #ifndef CHUNK_H
- #define CHUNK_H
- #include "../engine/TextureMesh.h"
- class Chunk
- {
- public:
- Chunk(int chunkX, int chunkZ);
- Chunk(const Chunk& orig);
- virtual ~Chunk();
-
- void setBlock(int x, int y, int z, unsigned short block);
- unsigned short getBlock(int x, int y, int z);
-
- static const int WORLD_HIGH = 16;
- static const int CHUNK_SIZE = 16;
- static const int MAX_Y = WORLD_HIGH * CHUNK_SIZE;
-
- void init();
- void renderTick(float lag);
- private:
- int chunkX;
- int chunkZ;
-
- unsigned short blocks[MAX_Y][CHUNK_SIZE][CHUNK_SIZE];
- bool dirty[WORLD_HIGH];
- TextureMesh mesh[WORLD_HIGH];
- };
- #endif
|