-
Notifications
You must be signed in to change notification settings - Fork 2
/
lump.lua
30 lines (29 loc) · 1.14 KB
/
lump.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--made by rerere284
function init()
setName("Lump")
setDesc("Hill shaped equation near zero")
--Lump is a better name, but it seems more hill shaped.
setSize(100, 24+64+8+8+18+18+18+18+7+4)
addOutput(24+32)
addInputParameter("Number", "Equation Input", 24+64+8+8, 1, -1, -1)
addParameter("Multiplier", "Multiplies input", 24+64+8+8+18, 100, -1, -1)
addParameter("Shift Input", "Higher means softer", 24+64+8+8+18+18, 1, 1, -1)
addParameter("Height", "Height of lump, though height is affected by other values too", 24+64+8+8+18+18+18, 1, -1, -1)
addParameter("Offset", "Moves lump sideways", 24+64+8+8+18+18+18+18, 0, -1, -1)
end
function apply()
tileSize = getTileSize()
mlt = getValue(1, x, y, 100.0)
shft = getValue(2, x, y, 100.0) / 10
hght = getValue(3, x, y, 100.0) / 10
ofst = getValue(4, x, y, 100.0)
for i=0, tileSize*tileSize-1 do
x = i%tileSize
y = math.floor(i/tileSize)
ar, ag, ab = getValue(0, x, y, 100.0) --get pixel at that location
fr = hght/((((ar-ofst)*mlt)^2)+shft)
fg = hght/((((ag-ofst)*mlt)^2)+shft)
fb = hght/((((ab-ofst)*mlt)^2)+shft)
setPixel(0, x, y, fr, fg, fb)
end
end