ChunkMap.h 874 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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();
  29. void setMaxHeight(unsigned char maxHeight);
  30. const Framework::Bild &getRenderedImage() const;
  31. unsigned char* getHeightMap() const;
  32. Framework::Punkt getChunkCenter() const;
  33. };