ChunkMap.h 913 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include <Bild.h>
  3. #pragma pack(push, 1)
  4. // stores the color aof the map at a specific height
  5. struct MapBlock
  6. {
  7. unsigned char height;
  8. int color;
  9. };
  10. // stores the colors at all heights of a specific x and y position on the map.
  11. // there can by only 256 colors stored per position
  12. struct MapPixel
  13. {
  14. unsigned char len;
  15. MapBlock* blocks;
  16. };
  17. #pragma pack(pop)
  18. class ChunkMap : public Framework::ReferenceCounter
  19. {
  20. private:
  21. MapPixel* pixels;
  22. unsigned char* heightMap;
  23. Framework::Punkt chunkCenter;
  24. Framework::Bild rendered;
  25. unsigned char maxHeight;
  26. public:
  27. ChunkMap(Framework::StreamReader* zReader);
  28. ChunkMap(Framework::Punkt center);
  29. ~ChunkMap();
  30. void setMaxHeight(unsigned char maxHeight);
  31. const Framework::Bild &getRenderedImage() const;
  32. unsigned char* getHeightMap() const;
  33. Framework::Punkt getChunkCenter() const;
  34. };