Fix bad noise analysis if persistence < 0
This commit is contained in:
parent
feacc78f7d
commit
bff6494249
19
init.lua
19
init.lua
@ -346,9 +346,24 @@ local analyze_noiseparams = function(noiseparams)
|
|||||||
local o_min, o_max = 0, 0
|
local o_min, o_max = 0, 0
|
||||||
for o=1, np.octaves do
|
for o=1, np.octaves do
|
||||||
local exp = o-1
|
local exp = o-1
|
||||||
o_max = o_max + (1 * np.persistence ^ exp)
|
-- Calculate the two possible extreme values
|
||||||
|
-- with the octave value being either at 1 or -1.
|
||||||
|
local limit1 = (1 * np.persistence ^ exp)
|
||||||
|
local limit2 = (-1 * np.persistence ^ exp)
|
||||||
|
|
||||||
|
-- To add to the maximum, pick the higher value
|
||||||
|
if limit1 > limit2 then
|
||||||
|
o_max = o_max + limit1
|
||||||
|
else
|
||||||
|
o_max = o_max + limit2
|
||||||
|
end
|
||||||
if not is_absolute then
|
if not is_absolute then
|
||||||
o_min = o_min + (- 1 * np.persistence ^ exp)
|
-- To add to the minimum, pick the LOWER value
|
||||||
|
if limit1 > limit2 then
|
||||||
|
o_min = o_min + limit2
|
||||||
|
else
|
||||||
|
o_min = o_min + limit1
|
||||||
|
end
|
||||||
-- Note: If absvalue flag is set, the sum of the octaves
|
-- Note: If absvalue flag is set, the sum of the octaves
|
||||||
-- is always 0, so we don't need to calculate it
|
-- is always 0, so we don't need to calculate it
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user