summaryrefslogtreecommitdiff
path: root/rotord/src/nodes_maths.h
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/src/nodes_maths.h')
-rw-r--r--rotord/src/nodes_maths.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/rotord/src/nodes_maths.h b/rotord/src/nodes_maths.h
index 07f111b..2696b2e 100644
--- a/rotord/src/nodes_maths.h
+++ b/rotord/src/nodes_maths.h
@@ -6,6 +6,8 @@
#include <libnoise/mathconsts.h>
#include "Poco/Logger.h"
+using namespace noise;
+
namespace Rotor {
#define COMPARISON_Equal 1
#define COMPARISON_Not_equal 2
@@ -233,22 +235,27 @@ namespace Rotor {
description="Fractal noise (seedable)";
create_signal_input("signal","Signal");
create_parameter("seed","number","Seed value","Seed",1.0f);
+ create_parameter("octaves","number","Octaves of noise","octaves",6.0f);
+ create_parameter("frequency","number","Frequency of noise","frequency",1.0f);
+ create_parameter("scale","number","scale of noise","scale",1.0f);
UID="28b3c154-2d0b-11e3-bdf2-1b9b2678a2f6";
};
Noise(map<string,string> &settings):Noise() {
base_settings(settings);
- seed=find_setting(settings,"seed",0);
};
Noise* clone(map<string,string> &_settings) { return new Noise(_settings);};
const float output(const Time_spec &time) {
- uint32_t seed=Seed+parameters["seed"]->value;
- //hash the integer part and add the fractional part back on
- float o=inputs[0]->get(time);
- uint32_t m=(int)o;
- return ((float)(fnv1a(m,seed)%((uint32_t)time.duration)))+(o-m);
+ perlin.SetOctaveCount(parameters["octaves"]->value);
+ perlin.SetFrequency(parameters["frequency"]->value);
+ perlin.SetSeed(Seed+parameters["seed"]->value);
+ if (inputs[0]->connection){
+ return perlin.GetValue(inputs[0]->get(time),0,0)*parameters["scale"]->value;
+ }
+ return perlin.GetValue(time.time,0,0)*parameters["scale"]->value;
}
uint32_t seed;
private:
+ module::RidgedMulti perlin;
};
}