12345678910111213141516171819202122232425262728293031 |
- #include "ShapedNoise.h"
- ShapedNoise::ShapedNoise(Noise* delegateNoise)
- : delegateNoise(delegateNoise),
- neighborOffset(1)
- {}
- ShapedNoise ::~ShapedNoise()
- {
- delegateNoise->release();
- }
- void ShapedNoise::setNeighborOffset(double offset)
- {
- neighborOffset = offset;
- }
- double ShapedNoise::getNoise(double x, double y, double z)
- {
- double max = 0;
- double noise = delegateNoise->getNoise(x, y, z);
- max = MAX(max, abs(noise - delegateNoise->getNoise(x + neighborOffset, y, z)));
- max = MAX(max, abs(noise - delegateNoise->getNoise(x, y + neighborOffset, z)));
- max = MAX(max, abs(noise - delegateNoise->getNoise(x, y, z + neighborOffset)));
- return max;
- }
- int ShapedNoise::getSeed() const
- {
- return delegateNoise->getSeed();
- }
|