GrasslandBiom.cpp 740 B

1234567891011121314151617181920212223242526272829303132
  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, Game* zGame )
  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. heightNoise = new FastNoiseWrapper( noise, seed );
  27. return heightNoise;
  28. }