diff options
author | Robert Guetzkow <rjg> | 2021-02-02 22:35:47 +0300 |
---|---|---|
committer | Robert Guetzkow <gitcommit@outlook.de> | 2021-02-02 22:37:28 +0300 |
commit | 4a80c0e27519b63929aa48b6fb1d673666829b21 (patch) | |
tree | 88ee5548a4fbe4d4a2b38a844b388e0e9bac078d /source/blender/blenlib | |
parent | 8c36f6becff2e53e8d545c4c82f3334588140c8f (diff) |
Fix T85225: Variable scope in ridged multi-fractal noise
This patch fixes a bug introduced in
rB74188e65028d268af887ab2140e4253087410c1e.
The commit incorrectly moved the declaration and intialization of the
variable `pwr` inside the loop. Since the value was originally modified
in each iteration based on it's previous value and `pwHL` through
`pwr *= pwHL`, this change in scope was wrong. It resetted the value in
each iteration. This patch moves the declaration of `pwr` outside the
loop again.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10258
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/noise.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 4ba533c72aa..b770a267eee 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -1636,9 +1636,9 @@ float BLI_noise_mg_ridged_multi_fractal(float x, float signal = powf(offset - fabsf(noisefunc(x, y, z)), 2); float result = signal; + float pwHL = powf(lacunarity, -H); + float pwr = pwHL; /* starts with i=1 instead of 0 */ for (int i = 1; i < (int)octaves; i++) { - float pwHL = powf(lacunarity, -H); - float pwr = pwHL; /* starts with i=1 instead of 0 */ x *= lacunarity; y *= lacunarity; z *= lacunarity; |