1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Updated open-simplex to have const noise functions

"open-simplex-noise-in-c" now updated to master and "opensimplex" module refactored accordingly

(cherry picked from commit 7e2b88a7eb)
This commit is contained in:
Sacha Waked
2020-12-04 09:38:42 +01:00
committed by Rémi Verschelde
parent 796ab24540
commit d5ea412848
5 changed files with 33 additions and 33 deletions

View File

@@ -64,7 +64,7 @@ void OpenSimplexNoise::set_seed(int p_seed) {
emit_changed();
}
int OpenSimplexNoise::get_seed() {
int OpenSimplexNoise::get_seed() const {
return seed;
}
@@ -96,7 +96,7 @@ void OpenSimplexNoise::set_lacunarity(float p_lacunarity) {
emit_changed();
}
Ref<Image> OpenSimplexNoise::get_image(int p_width, int p_height) {
Ref<Image> OpenSimplexNoise::get_image(int p_width, int p_height) const {
PoolVector<uint8_t> data;
data.resize(p_width * p_height * 4);
@@ -119,7 +119,7 @@ Ref<Image> OpenSimplexNoise::get_image(int p_width, int p_height) {
return image;
}
Ref<Image> OpenSimplexNoise::get_seamless_image(int p_size) {
Ref<Image> OpenSimplexNoise::get_seamless_image(int p_size) const {
PoolVector<uint8_t> data;
data.resize(p_size * p_size * 4);
@@ -191,12 +191,12 @@ void OpenSimplexNoise::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "lacunarity", PROPERTY_HINT_RANGE, "0.1,4.0,0.01"), "set_lacunarity", "get_lacunarity");
}
float OpenSimplexNoise::get_noise_1d(float x) {
float OpenSimplexNoise::get_noise_1d(float x) const {
return get_noise_2d(x, 1.0);
}
float OpenSimplexNoise::get_noise_2d(float x, float y) {
float OpenSimplexNoise::get_noise_2d(float x, float y) const {
x /= period;
y /= period;
@@ -217,7 +217,7 @@ float OpenSimplexNoise::get_noise_2d(float x, float y) {
return sum / max;
}
float OpenSimplexNoise::get_noise_3d(float x, float y, float z) {
float OpenSimplexNoise::get_noise_3d(float x, float y, float z) const {
x /= period;
y /= period;
@@ -240,7 +240,7 @@ float OpenSimplexNoise::get_noise_3d(float x, float y, float z) {
return sum / max;
}
float OpenSimplexNoise::get_noise_4d(float x, float y, float z, float w) {
float OpenSimplexNoise::get_noise_4d(float x, float y, float z, float w) const {
x /= period;
y /= period;