Minetest-WorldEditAdditions/worldeditadditions/lib/noise/engines/sin.lua
2021-07-04 13:21:13 +01:00

23 lines
361 B
Lua

local wea = worldeditadditions
local Sin = {}
Sin.__index = Sin
function Sin.new()
local result = {}
setmetatable(result, Sin)
return result
end
function Sin:noise( x, y, z )
-- local value = math.sin(x)
local value = (math.sin(x) + math.sin(y) + math.sin(z)) / 3
-- Rescale from -1 - +1 to 0 - 1
return (value + 1) / 2
-- return (
end
return Sin