DimensionGenerator.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 DimensionEnum
  9. {
  10. public:
  11. static const int OVERWORLD = 0;
  12. };
  13. class DimensionGenerator : public virtual Framework::ReferenceCounter
  14. {
  15. private:
  16. Framework::RCArray<BiomGenerator> biomGenerators;
  17. Framework::Array<double> biomDistribution;
  18. const int dimensionId;
  19. Framework::Vec3<int> minTemplateAffectedPosition;
  20. Framework::Vec3<int> maxTemplateAffectedPosition;
  21. CaveGenerator* caveGenerator;
  22. BiomGenerator* zBiomGenerator(int x, int y);
  23. protected:
  24. int seed;
  25. DimensionGenerator(int dimensionId, CaveGenerator* caveGenerator);
  26. ~DimensionGenerator();
  27. void registerBiom(BiomGenerator* generator, double possibility);
  28. Framework::RCArray<GeneratedStructure>* getGeneratedStructoresForArea(Framework::Vec3<int> minPos, Framework::Vec3<int> maxPos);
  29. public:
  30. void initialize(int seed);
  31. Chunk* generateChunk(int centerX, int centerY);
  32. Framework::Either<Block*, int> generateBlock(Framework::Vec3<int> location);
  33. bool spawnStructure(Framework::Vec3<int> location, std::function<bool(GenerationTemplate* tmpl)> filter);
  34. int getDimensionId() const;
  35. virtual Noise* zBiomNoise() = 0;
  36. virtual Noise* zStructureNoise() = 0;
  37. };