Changed vmg.get_noise

It's now correct for noise lacunarity different to 2,
and it solves a problem about humidity calculation
(it was not the same value on mapgen and after mapgen)
master
Gael-de-Sailly 2015-12-21 22:29:41 +01:00
parent 8ad7702acf
commit 3c52ab7194
1 changed files with 3 additions and 3 deletions

View File

@ -699,11 +699,11 @@ end
function vmg.get_noise(pos, i)
local n = vmg.noises[i]
local noise = minetest.get_perlin(n.seed, n.octaves, n.persist, 1)
local noise = minetest.get_perlin(n)
if not pos.z then -- 2D noise
return noise:get2d({x = pos.x / n.spread.x, y = pos.y / n.spread.y}) * n.scale + n.offset
return noise:get2d(pos)
else -- 3D noise
return noise:get3d({x = pos.x / n.spread.x, y = pos.y / n.spread.y, z = pos.z / n.spread.z}) * n.scale + n.offset
return noise:get3d(pos)
end
end