OverworldDimension.cpp 1.2 KB

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