1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Increase the maximum number of octaves in OpenSimplexNoise to 9

An error message is now printed when trying to set the number of octaves
above the maximum allowed value.

The magic constant was also replaced with a define that can be
easily changed.

This closes #28714.

(cherry picked from commit 13622d40fc)
This commit is contained in:
Hugo Locurcio
2020-01-30 23:49:17 +01:00
committed by Rémi Verschelde
parent cbd4784d14
commit 1898240af8
3 changed files with 14 additions and 5 deletions

View File

@@ -37,11 +37,16 @@
#include "thirdparty/misc/open-simplex-noise.h"
// The maximum number of octaves allowed. Note that these are statically allocated.
// Higher values become exponentially slower, so this shouldn't be set too high
// to avoid freezing the editor for long periods of time.
#define MAX_OCTAVES 9
class OpenSimplexNoise : public Resource {
GDCLASS(OpenSimplexNoise, Resource);
OBJ_SAVE_TYPE(OpenSimplexNoise);
osn_context contexts[6];
osn_context contexts[MAX_OCTAVES];
int seed;
float persistence; // Controls details, value in [0,1]. Higher increases grain, lower increases smoothness.