GrasslandBiom.cpp 804 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "GrasslandBiom.h"
  2. #include "BlockType.h"
  3. #include "BasicBlocks.h"
  4. #include "FastNoiseLite.h"
  5. #include "FastNoiseWrapper.h"
  6. GrasslandBiom::GrasslandBiom()
  7. : BiomGenerator()
  8. {
  9. heightNoise = 0;
  10. }
  11. GrasslandBiom::~GrasslandBiom()
  12. {
  13. if( heightNoise )
  14. heightNoise->release();
  15. }
  16. Framework::Either<Block*, int> GrasslandBiom::getBlock( int x, int y, int z )
  17. {
  18. return DirtBlockType::ID;
  19. }
  20. Noise* GrasslandBiom::zHeightMapNoise( int seed )
  21. {
  22. if( heightNoise )
  23. return heightNoise;
  24. FastNoiseLite* noise = new FastNoiseLite( seed );
  25. noise->SetNoiseType( FastNoiseLite::NoiseType::NoiseType_ValueCubic );
  26. FastNoiseWrapper* wrapper = new FastNoiseWrapper( noise, seed );
  27. wrapper->setMultiplier( 0.2f );
  28. heightNoise = wrapper;
  29. return heightNoise;
  30. }