OverworldDimension.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "OverworldDimension.h"
  2. #include "FastNoiseWrapper.h"
  3. #include "GrasslandBiom.h"
  4. #include "RandNoise.h"
  5. #include "WormCaveGenerator.h"
  6. OverworldDimension::OverworldDimension()
  7. : DimensionGenerator(
  8. DimensionEnum::OVERWORLD, new WormCaveGenerator(75, 150, 1, 6, 0.1f))
  9. {
  10. registerBiom(new GrasslandBiom(), 1.0);
  11. biomNoise = 0;
  12. structureNoise = 0;
  13. }
  14. OverworldDimension::~OverworldDimension()
  15. {
  16. if (biomNoise) biomNoise->release();
  17. if (structureNoise) structureNoise->release();
  18. }
  19. Noise* OverworldDimension::zBiomNoise()
  20. {
  21. if (biomNoise) return biomNoise;
  22. FastNoiseLite* noise = new FastNoiseLite(seed);
  23. noise->SetNoiseType(FastNoiseLite::NoiseType::NoiseType_Cellular);
  24. noise->SetRotationType3D(
  25. FastNoiseLite::RotationType3D::RotationType3D_None);
  26. noise->SetFrequency(0.015f);
  27. noise->SetFractalType(FastNoiseLite::FractalType::FractalType_None);
  28. noise->SetCellularDistanceFunction(FastNoiseLite::CellularDistanceFunction::
  29. CellularDistanceFunction_Hybrid);
  30. noise->SetCellularReturnType(
  31. FastNoiseLite::CellularReturnType::CellularReturnType_CellValue);
  32. noise->SetCellularJitter(1.f);
  33. noise->SetDomainWarpType(
  34. FastNoiseLite::DomainWarpType::DomainWarpType_OpenSimplex2Reduced);
  35. noise->SetDomainWarpAmp(30.f);
  36. biomNoise = new FastNoiseWrapper(noise, seed);
  37. return biomNoise;
  38. }
  39. Noise* OverworldDimension::zStructureNoise()
  40. {
  41. if (structureNoise) return structureNoise;
  42. structureNoise = new RandNoise(seed);
  43. return structureNoise;
  44. }