diff options
Diffstat (limited to 'modules/opensimplex')
-rw-r--r-- | modules/opensimplex/doc_classes/SimplexNoise.xml | 32 | ||||
-rw-r--r-- | modules/opensimplex/simplex_noise.cpp | 20 | ||||
-rw-r--r-- | modules/opensimplex/simplex_noise.h | 6 |
3 files changed, 29 insertions, 29 deletions
diff --git a/modules/opensimplex/doc_classes/SimplexNoise.xml b/modules/opensimplex/doc_classes/SimplexNoise.xml index a5a01d88a7..de29ff874c 100644 --- a/modules/opensimplex/doc_classes/SimplexNoise.xml +++ b/modules/opensimplex/doc_classes/SimplexNoise.xml @@ -15,12 +15,12 @@ noise.octaves = 4 noise.period = 20.0 noise.persistance = 0.8 - - #Sample + + # Sample print("Values:") - print(noise.get_noise_2d(1.0,1.0)) - print(noise.get_noise_3d(0.5,3.0,15.0)) - print(noise.get_noise_3d(0.5,1.9,4.7,0.0)) + print(noise.get_noise_2d(1.0, 1.0)) + print(noise.get_noise_3d(0.5, 3.0, 15.0)) + print(noise.get_noise_4d(0.5, 1.9, 4.7, 0.0)) [/codeblock] </description> <tutorials> @@ -47,7 +47,7 @@ <argument index="1" name="y" type="float"> </argument> <description> - 2D noise value [-1,1] at position [code]x[/code],[code]y[/code]. + Returns the 2D noise value [code][-1,1][/code] at the given position. </description> </method> <method name="get_noise_2dv"> @@ -56,7 +56,7 @@ <argument index="0" name="pos" type="Vector2"> </argument> <description> - 2D noise value [-1,1] at position [code]pos.x[/code],[code]pos.y[/code]. + Returns the 2D noise value [code][-1,1][/code] at the given position. </description> </method> <method name="get_noise_3d"> @@ -69,7 +69,7 @@ <argument index="2" name="z" type="float"> </argument> <description> - 3D noise value [-1,1] at position [code]x[/code],[code]y[/code],[code]z[/code]. + Returns the 3D noise value [code][-1,1][/code] at the given position. </description> </method> <method name="get_noise_3dv"> @@ -78,7 +78,7 @@ <argument index="0" name="pos" type="Vector3"> </argument> <description> - 3D noise value [-1,1] at position [code]pos.x[/code],[code]pos.y[/code],[code]pos.z[/code]. + Returns the 3D noise value [code][-1,1][/code] at the given position. </description> </method> <method name="get_noise_4d"> @@ -93,7 +93,7 @@ <argument index="3" name="w" type="float"> </argument> <description> - 4D noise value [-1,1] at position [code]x[/code],[code]y[/code],[code]z[/code],[code]w[/code]. + Returns the 4D noise value [code][-1,1][/code] at the given position. </description> </method> <method name="get_seamless_image"> @@ -102,8 +102,8 @@ <argument index="0" name="size" type="int"> </argument> <description> - Generate a tileable noise image, based on the current noise parameters. - Generated seamless images are always square ([code]size[/code]x[code]size[/code]). + Generate a tileable noise image, based on the current noise parameters. + Generated seamless images are always square ([code]size[/code] x [code]size[/code]). </description> </method> </methods> @@ -112,14 +112,14 @@ Difference in period between [member octaves]. </member> <member name="octaves" type="int" setter="set_octaves" getter="get_octaves"> - Number of Simplex Noise layers that are sampled to get the fractal noise. + Number of Simplex noise layers that are sampled to get the fractal noise. </member> <member name="period" type="float" setter="set_period" getter="get_period"> - Period of the base octave. - A lower period results in a higher frequancy noise (more value changes across the same distance). + Period of the base octave. + A lower period results in a higher-frequency noise (more value changes across the same distance). </member> <member name="persistance" type="float" setter="set_persistance" getter="get_persistance"> - Contribuiton factor of the different octaves. + Contribution factor of the different octaves. A [code]persistance[/code] value of 1 means all the octaves have the same contribution, a value of 0.5 means each octave contributes half as much as the previous one. </member> <member name="seed" type="int" setter="set_seed" getter="get_seed"> diff --git a/modules/opensimplex/simplex_noise.cpp b/modules/opensimplex/simplex_noise.cpp index 6d66c7110e..e489b7f6f0 100644 --- a/modules/opensimplex/simplex_noise.cpp +++ b/modules/opensimplex/simplex_noise.cpp @@ -35,7 +35,7 @@ SimplexNoise::SimplexNoise() { seed = 0; - persistance = 0.5; + persistence = 0.5; octaves = 3; period = 64; lacunarity = 2.0; @@ -81,9 +81,9 @@ void SimplexNoise::set_period(float p_period) { emit_changed(); } -void SimplexNoise::set_persistance(float p_persistance) { - if (p_persistance == persistance) return; - persistance = p_persistance; +void SimplexNoise::set_persistence(float p_persistence) { + if (p_persistence == persistence) return; + persistence = p_persistence; emit_changed(); } @@ -164,8 +164,8 @@ void SimplexNoise::_bind_methods() { ClassDB::bind_method(D_METHOD("set_period", "period"), &SimplexNoise::set_period); ClassDB::bind_method(D_METHOD("get_period"), &SimplexNoise::get_period); - ClassDB::bind_method(D_METHOD("set_persistance", "persistance"), &SimplexNoise::set_persistance); - ClassDB::bind_method(D_METHOD("get_persistance"), &SimplexNoise::get_persistance); + ClassDB::bind_method(D_METHOD("set_persistence", "persistence"), &SimplexNoise::set_persistence); + ClassDB::bind_method(D_METHOD("get_persistence"), &SimplexNoise::get_persistence); ClassDB::bind_method(D_METHOD("set_lacunarity", "lacunarity"), &SimplexNoise::set_lacunarity); ClassDB::bind_method(D_METHOD("get_lacunarity"), &SimplexNoise::get_lacunarity); @@ -183,7 +183,7 @@ void SimplexNoise::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "seed"), "set_seed", "get_seed"); ADD_PROPERTY(PropertyInfo(Variant::INT, "octaves", PROPERTY_HINT_RANGE, "1,6,1"), "set_octaves", "get_octaves"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "period", PROPERTY_HINT_RANGE, "0.1,256.0,0.1"), "set_period", "get_period"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "persistance", PROPERTY_HINT_RANGE, "0.0,1.0,0.001"), "set_persistance", "get_persistance"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "persistence", PROPERTY_HINT_RANGE, "0.0,1.0,0.001"), "set_persistence", "get_persistence"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "lacunarity", PROPERTY_HINT_RANGE, "0.1,4.0,0.01"), "set_lacunarity", "get_lacunarity"); } @@ -200,7 +200,7 @@ float SimplexNoise::get_noise_2d(float x, float y) { while (++i < octaves) { x *= lacunarity; y *= lacunarity; - amp *= persistance; + amp *= persistence; max += amp; sum += _get_octave_noise_2d(i, x, y) * amp; } @@ -223,7 +223,7 @@ float SimplexNoise::get_noise_3d(float x, float y, float z) { x *= lacunarity; y *= lacunarity; z *= lacunarity; - amp *= persistance; + amp *= persistence; max += amp; sum += _get_octave_noise_3d(i, x, y, z) * amp; } @@ -248,7 +248,7 @@ float SimplexNoise::get_noise_4d(float x, float y, float z, float w) { y *= lacunarity; z *= lacunarity; w *= lacunarity; - amp *= persistance; + amp *= persistence; max += amp; sum += _get_octave_noise_4d(i, x, y, z, w) * amp; } diff --git a/modules/opensimplex/simplex_noise.h b/modules/opensimplex/simplex_noise.h index 59390c6172..9a48dbf809 100644 --- a/modules/opensimplex/simplex_noise.h +++ b/modules/opensimplex/simplex_noise.h @@ -44,7 +44,7 @@ class SimplexNoise : public Resource { osn_context contexts[6]; int seed; - float persistance; // Controls details, value in [0,1]. Higher increases grain, lower increases smoothness. + float persistence; // Controls details, value in [0,1]. Higher increases grain, lower increases smoothness. int octaves; // Number of noise layers float period; // Distance above which we start to see similarities. The higher, the longer "hills" will be on a terrain. float lacunarity; // Controls period change across octaves. 2 is usually a good value to address all detail levels. @@ -64,8 +64,8 @@ public: void set_period(float p_period); float get_period() const { return period; } - void set_persistance(float p_persistance); - float get_persistance() const { return persistance; } + void set_persistence(float p_persistence); + float get_persistence() const { return persistence; } void set_lacunarity(float p_lacunarity); float get_lacunarity() const { return lacunarity; } |