Chunk.h 944 B

123456789101112131415161718192021222324252627282930313233343536
  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. bool isLoading;
  17. Framework::Critical cs;
  18. public:
  19. Chunk(Framework::Punkt location);
  20. Chunk(Framework::Punkt location, Framework::StreamReader* zReader);
  21. ~Chunk();
  22. void api(char* message);
  23. Block* zBlockAt(Framework::Vec3<int> cLocation);
  24. void setBlock(Block* block);
  25. void removeBlock(Block* zBlock);
  26. void load(Framework::StreamReader* zReader);
  27. Framework::Punkt getCenter() const;
  28. Framework::Vec3<int> getMin() const;
  29. Framework::Vec3<int> getMax() const;
  30. void forAll(std::function<void(Model3D*)> f) override;
  31. void updateVisibility();
  32. };