DimensionGenerator.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. bool spawnStructure(Framework::Vec3<int> location, std::function<bool(GenerationTemplate* tmpl)> filter);
  29. int getDimensionId() const;
  30. virtual Noise* zBiomNoise() = 0;
  31. virtual Noise* zStructureNoise() = 0;
  32. };