FastNoiseWrapper.cpp 558 B

123456789101112131415161718192021222324252627282930
  1. #include "FastNoiseWrapper.h"
  2. FastNoiseWrapper::FastNoiseWrapper(FastNoiseLite* noise, int seed)
  3. {
  4. this->noise = noise;
  5. this->seed = seed;
  6. this->multiplier = 1.f;
  7. }
  8. FastNoiseWrapper::~FastNoiseWrapper()
  9. {
  10. delete noise;
  11. }
  12. void FastNoiseWrapper::setMultiplier(float multiplier)
  13. {
  14. assert(multiplier > 0);
  15. this->multiplier = multiplier;
  16. }
  17. int FastNoiseWrapper::getSeed() const
  18. {
  19. return seed;
  20. }
  21. double FastNoiseWrapper::getNoise(double x, double y, double z)
  22. {
  23. // scale the noise from 0 to 1
  24. return (noise->GetNoise(x, y, z) * multiplier + 1) / 2;
  25. }