123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- #pragma once
- #include <Noise.h>
- class NoiseCombinerM : public Noise
- {
- private:
- Noise* a;
- Noise* b;
- public:
- NoiseCombinerM(Noise* a, Noise* b)
- : Noise(),
- a(a),
- b(b)
- {}
- virtual int getSeed() const
- {
- return 0;
- }
- virtual double getNoise(double x, double y, double z)
- {
- return (((a->getNoise(x, y, z) - 0.5) * 2) * (b->getNoise(x, y, z)) * 0.9 + 0.1)
- / 2 + 0.5;
- }
- };
- class NoiseCombinerA : public Noise
- {
- private:
- Noise* a;
- Noise* b;
- public:
- NoiseCombinerA(Noise* a, Noise* b)
- : Noise(),
- a(a),
- b(b)
- {}
- virtual int getSeed() const
- {
- return 0;
- }
- virtual double getNoise(double x, double y, double z)
- {
- return a->getNoise(x, y, z)* 0.7 + b->getNoise(x, y, z) * 0.3;
- }
- };
- class RescaleNoise : public Noise
- {
- Noise* n;
- double factor;
- public:
- RescaleNoise(Noise* n, double factor)
- : Noise(),
- n(n),
- factor(factor)
- {}
- virtual int getSeed() const
- {
- return n->getSeed();
- }
- virtual double getNoise(double x, double y, double z)
- {
- return MAX(MIN(n->getNoise(x, y, z) * factor, 1.0), 0.0);
- }
- };
- class FlattenNoise : public Noise
- {
- Noise* n;
- double factor;
- double minValue;
- public:
- FlattenNoise(Noise* n, double factor, double minValue)
- : Noise(),
- n(n),
- factor(factor),
- minValue(minValue)
- {}
- virtual int getSeed() const
- {
- return n->getSeed();
- }
- virtual double getNoise(double x, double y, double z)
- {
- return MAX(0, MIN(1, (n->getNoise(x, y, z) - 0.5) * factor + 0.5 + minValue));
- }
- };
- class NegatedNoise : public Noise
- {
- Noise* n;
- public:
- NegatedNoise(Noise* n)
- : Noise(),
- n(n)
- {}
- virtual int getSeed() const override
- {
- return n->getSeed();
- }
- virtual double getNoise(double x, double y, double z) override
- {
- return 1 - n->getNoise(x, y, z);
- }
- };
|