Chunk.h 986 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include <Punkt.h>
  3. #include <Model3DCollection.h>
  4. #include <Reader.h>
  5. #include <Model3D.h>
  6. #include <Array.h>
  7. #include <Critical.h>
  8. #include "Block.h"
  9. #include "Area.h"
  10. class Chunk : public Framework::Model3DCollection
  11. {
  12. private:
  13. Framework::Punkt location;
  14. // TODO: use native array for bedder performance?
  15. Framework::RCArray<Block> blocks;
  16. Framework::Array<Block*> visibleBlocks;
  17. bool isLoading;
  18. Framework::Critical cs;
  19. Framework::Critical vcs;
  20. public:
  21. Chunk(Framework::Punkt location);
  22. Chunk(Framework::Punkt location, Framework::StreamReader* zReader);
  23. ~Chunk();
  24. void api(char* message);
  25. Block* zBlockAt(Framework::Vec3<int> cLocation);
  26. void setBlock(Block* block);
  27. void removeBlock(Block* zBlock);
  28. void load(Framework::StreamReader* zReader);
  29. Framework::Punkt getCenter() const;
  30. Framework::Vec3<int> getMin() const;
  31. Framework::Vec3<int> getMax() const;
  32. void forAll(std::function<void(Model3D*)> f) override;
  33. };