12345678910111213141516171819202122232425 |
- #include "FlattenNoise.h"
- FlattenNoise::FlattenNoise(Noise* base, double factor, double minValue)
- : Noise(),
- base(base),
- factor(factor),
- minValue(minValue)
- {}
- FlattenNoise::~FlattenNoise()
- {
- base->release();
- }
- int FlattenNoise::getSeed() const
- {
- return base->getSeed();
- }
- double FlattenNoise::getNoise(double x, double y, double z)
- {
- return MAX(
- MIN((base->getNoise(x, y, z) - 0.5) * factor + 0.5 + minValue, 1.0),
- 0.0);
- }
|