OverworldDimension.cpp 1.5 KB

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