From 4faa5acaa7379fa86d69cb2856edd3a990d190b1 Mon Sep 17 00:00:00 2001 From: JFonS Date: Wed, 19 Sep 2018 21:00:10 +0200 Subject: [PATCH] Replace "persistance" with "persistence" Replace "persistance" with "persistence" in the simplex code. Also made some minor fixes to the docs. --- .../opensimplex/doc_classes/SimplexNoise.xml | 10 +++++----- modules/opensimplex/simplex_noise.cpp | 20 +++++++++---------- modules/opensimplex/simplex_noise.h | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/opensimplex/doc_classes/SimplexNoise.xml b/modules/opensimplex/doc_classes/SimplexNoise.xml index 5c633492e7d..1be7b5896df 100644 --- a/modules/opensimplex/doc_classes/SimplexNoise.xml +++ b/modules/opensimplex/doc_classes/SimplexNoise.xml @@ -47,7 +47,7 @@ - Returns the 2D noise value [-1,1] at the given position. + Returns the 2D noise value [code][-1,1][/code] at the given position. @@ -56,7 +56,7 @@ - Returns the 2D noise value [-1,1] at the given position. + Returns the 2D noise value [code][-1,1][/code] at the given position. @@ -69,7 +69,7 @@ - Returns the 3D noise value [-1,1] at the given position. + Returns the 3D noise value [code][-1,1][/code] at the given position. @@ -78,7 +78,7 @@ - Returns the 3D noise value [-1,1] at the given position. + Returns the 3D noise value [code][-1,1][/code] at the given position. @@ -93,7 +93,7 @@ - Returns the 4D noise value [-1,1] at the given position. + Returns the 4D noise value [code][-1,1][/code] at the given position. diff --git a/modules/opensimplex/simplex_noise.cpp b/modules/opensimplex/simplex_noise.cpp index 6d66c7110ef..e489b7f6f07 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 59390c61721..9a48dbf8093 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; }