2021-07-12 23:54:52 +00:00
|
|
|
local wea = worldeditadditions
|
2022-09-19 00:16:22 +00:00
|
|
|
local wea_c = worldeditadditions_core
|
|
|
|
local Vector3 = wea_c.Vector3
|
2021-07-12 23:54:52 +00:00
|
|
|
|
|
|
|
local White = dofile(wea.modpath.."/lib/noise/engines/white.lua")
|
|
|
|
|
|
|
|
local Infrared = {}
|
|
|
|
Infrared.__index = Infrared
|
|
|
|
|
|
|
|
|
|
|
|
function Infrared.new(seed)
|
|
|
|
local result = {
|
|
|
|
seed = seed or math.random(),
|
|
|
|
white = White.new(seed),
|
|
|
|
window = 2
|
|
|
|
}
|
|
|
|
setmetatable(result, Infrared)
|
|
|
|
return result
|
|
|
|
end
|
|
|
|
|
|
|
|
function Infrared:noise( x, y, z )
|
|
|
|
local values = { }
|
|
|
|
for nx=x-self.window,x+self.window do
|
|
|
|
for ny=y-self.window,y+self.window do
|
|
|
|
for nz=z-self.window,z+self.window do
|
|
|
|
table.insert(values, self.white:noise(nx, ny, nz))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2022-09-19 00:16:22 +00:00
|
|
|
return wea_c.average(values)
|
2021-07-12 23:54:52 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return Infrared
|