mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-30 11:04:00 +01:00
2af1226b49
phew!
20 lines
316 B
Lua
20 lines
316 B
Lua
|
|
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
|
|
end
|
|
|
|
return Sin
|