DimensionGenerator.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include <Array.h>
  3. #include <Either.h>
  4. #include <ReferenceCounter.h>
  5. #include "BiomGenerator.h"
  6. #include "CaveGenerator.h"
  7. #include "Chunk.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(
  29. Framework::Vec3<int> minPos, Framework::Vec3<int> maxPos);
  30. public:
  31. void initialize(int seed);
  32. Chunk* generateChunk(int centerX, int centerY);
  33. Framework::Either<Block*, int> generateBlock(Framework::Vec3<int> location);
  34. bool spawnStructure(Framework::Vec3<int> location,
  35. std::function<bool(GenerationTemplate* tmpl)> filter);
  36. int getDimensionId() const;
  37. virtual Noise* zBiomNoise() = 0;
  38. virtual Noise* zStructureNoise() = 0;
  39. };