1
0
mirror of https://github.com/HybridDog/nether-pack.git synced 2024-12-26 18:50:24 +01:00

…fix one perlin noise outside [-1; 1] problem

This commit is contained in:
HybridDog 2015-05-21 17:14:54 +02:00
parent 0d07fa3cd4
commit 314930714b
2 changed files with 8 additions and 3 deletions

View File

@ -8,4 +8,4 @@ http://i.imgur.com/pMZYqt9.png
TODO:
— care about nether torches
— find out why the nether forests top is sometimes flat
— find a way to get the perlin noise inside [-1; 1]

View File

@ -481,8 +481,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
if not f_perlins[pstr] then
f_perlins[pstr] = math.floor(f_h_min+(math.abs(perlin_f_bottom:get2d({x=p.x, y=p.z})+1))*f_yscale_bottom+0.5)
end
f_top = math.floor(f_h_max - (pmap_f_top[count]+1)*f_yscale_top + 0.5)
f_bottom = f_perlins[pstr]+math.random(0,f_bottom_scale-1)
local top_noise = pmap_f_top[count]+1
if top_noise < 0 then
top_noise = -top_noise/10
--nether:inform("ERROR: (perlin noise) "..pmap_f_top[count].." is not inside [-1; 1]", 1)
end
f_top = math.floor(f_h_max - top_noise*f_yscale_top + 0.5)
f_bottom = f_perlins[pstr]+pr:next(0,f_bottom_scale-1)
is_forest = f_bottom < f_top
f_h_dirt = f_bottom-pr:next(0,1)
end