NoiseCombiner.h 845 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #include <Noise.h>
  3. class NoiseCombinerM : public Noise
  4. {
  5. private:
  6. Noise* a;
  7. Noise* b;
  8. public:
  9. NoiseCombinerM(Noise* a, Noise* b)
  10. : Noise(),
  11. a(a),
  12. b(b)
  13. {}
  14. virtual int getSeed() const
  15. {
  16. return 0;
  17. }
  18. virtual double getNoise(double x, double y, double z)
  19. {
  20. return a->getNoise(x, y, z) * b->getNoise(x, y, z)
  21. + (1 - b->getNoise(x, y, z)) / 2;
  22. }
  23. };
  24. class NoiseCombinerA : public Noise
  25. {
  26. private:
  27. Noise* a;
  28. Noise* b;
  29. public:
  30. NoiseCombinerA(Noise* a, Noise* b)
  31. : Noise(),
  32. a(a),
  33. b(b)
  34. {}
  35. virtual int getSeed() const
  36. {
  37. return 0;
  38. }
  39. virtual double getNoise(double x, double y, double z)
  40. {
  41. return a->getNoise(x, y, z)* 0.7 + b->getNoise(x, y, z) * 0.3;
  42. }
  43. };