1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

stopped perlin noise returning zero on integer inputs

This commit is contained in:
grilledham 2018-06-12 00:16:20 +01:00
parent e604810e1e
commit a7280b185f

View File

@ -36,6 +36,11 @@ function perlin:noise(x, y, z)
y = y or 0
z = z or 0
-- This prevents integer inputs returning 0, which casues 'straight line' artifacts.
x = x - 0.55077056353912
y = y - 0.131357755512
z = z - 0.20474238274619
-- Calculate the "unit cube" that the point asked will be located in
local xi = bit32.band(math.floor(x),255)
local yi = bit32.band(math.floor(y),255)