Chunk.h 662 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef CHUNK_H
  2. #define CHUNK_H
  3. #include "../engine/TextureMesh.h"
  4. class Chunk
  5. {
  6. public:
  7. Chunk(int chunkX, int chunkZ);
  8. Chunk(const Chunk& orig);
  9. virtual ~Chunk();
  10. void setBlock(int x, int y, int z, unsigned short block);
  11. unsigned short getBlock(int x, int y, int z);
  12. static const int WORLD_HIGH = 16;
  13. static const int CHUNK_SIZE = 16;
  14. static const int MAX_Y = WORLD_HIGH * CHUNK_SIZE;
  15. void init();
  16. void renderTick(float lag);
  17. private:
  18. int chunkX;
  19. int chunkZ;
  20. unsigned short blocks[MAX_Y][CHUNK_SIZE][CHUNK_SIZE];
  21. bool dirty[WORLD_HIGH];
  22. TextureMesh mesh[WORLD_HIGH];
  23. };
  24. #endif