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
This commit is contained in:
committed by
Robert Guetzkow
parent
8c36f6becf
commit
4a80c0e275
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user