DimensionGenerator.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include <Array.h>
  3. #include <ReferenceCounter.h>
  4. #include <Either.h>
  5. #include "BiomGenerator.h"
  6. #include "Chunk.h"
  7. #include "CaveGenerator.h"
  8. class DimensionGenerator : public virtual Framework::ReferenceCounter
  9. {
  10. private:
  11. Framework::RCArray<BiomGenerator> biomGenerators;
  12. Framework::Array<double> biomDistribution;
  13. const int dimensionId;
  14. Framework::Vec3<int> minTemplateAffectedPosition;
  15. Framework::Vec3<int> maxTemplateAffectedPosition;
  16. CaveGenerator* caveGenerator;
  17. BiomGenerator* zBiomGenerator(int x, int y);
  18. protected:
  19. int seed;
  20. DimensionGenerator(int dimensionId, CaveGenerator* caveGenerator);
  21. ~DimensionGenerator();
  22. void registerBiom(BiomGenerator* generator, double possibility);
  23. Framework::RCArray<GeneratedStructure>* getGeneratedStructoresForArea(Framework::Vec3<int> minPos, Framework::Vec3<int> maxPos);
  24. public:
  25. void initialize(int seed);
  26. Chunk* generateChunk(int centerX, int centerY);
  27. Framework::Either<Block*, int> generateBlock(Framework::Vec3<int> location);
  28. int getDimensionId() const;
  29. virtual Noise* zBiomNoise() = 0;
  30. virtual Noise* zStructureNoise() = 0;
  31. };