WorldGenerator.h 845 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include <Critical.h>
  3. #include <Thread.h>
  4. #include "Area.h"
  5. #include "DimensionGenerator.h"
  6. class WorldGenerator : public Framework::Thread
  7. {
  8. private:
  9. Framework::Critical cs;
  10. Framework::Array<Area> requestQueue;
  11. Framework::RCArray<DimensionGenerator> dimensionGenerators;
  12. bool exit;
  13. int seed;
  14. DimensionGenerator* zGenerator(int dimensionId);
  15. public:
  16. WorldGenerator(int seed);
  17. ~WorldGenerator();
  18. Dimension *createDimension(int dimensionId);
  19. void thread() override;
  20. void requestGeneration(Area request);
  21. void exitAndWait();
  22. Framework::Either<Block*, int> generateSingleBlock(
  23. Framework::Vec3<int> location, int dimensionId);
  24. bool spawnStructure(Framework::Vec3<int> location,
  25. int dimensionId,
  26. std::function<bool(GeneratorTemplate* tmpl)> filter);
  27. };