# lump

Apr 12th, 2016
290
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
2. function init()
3.     setName("Lump")
4.     setDesc("Hill shaped equation near zero")
5.     --Lump is a better name, but it seems more hill shaped.
6.     setSize(100, 24+64+8+8+18+18+18+18+7+4)
8.     addInputParameter("Number", "Equation Input", 24+64+8+8, 1, -1, -1)
9.     addParameter("Multiplier", "Multiplies input", 24+64+8+8+18, 100, -1, -1)
10.     addParameter("Shift Input", "Higher means softer", 24+64+8+8+18+18, 1, 1, -1)
11.     addParameter("Height", "Height of lump, though height is affected by other values too", 24+64+8+8+18+18+18, 1, -1, -1)
12.     addParameter("Offset", "Moves lump sideways", 24+64+8+8+18+18+18+18, 0, -1, -1)
13. end
14.
15. function apply()
16.     tileSize = getTileSize()
17.     mlt  = getValue(1, x, y, 100.0)
18.     shft = getValue(2, x, y, 100.0) / 10
19.     hght = getValue(3, x, y, 100.0) / 10
20.     ofst = getValue(4, x, y, 100.0)
21.     for i=0, tileSize*tileSize-1 do
22.         x = i%tileSize
23.         y = math.floor(i/tileSize)
24.         ar, ag, ab = getValue(0, x, y, 100.0) --get pixel at that location
25.         fr = hght/((((ar-ofst)*mlt)^2)+shft)
26.         fg = hght/((((ag-ofst)*mlt)^2)+shft)
27.         fb = hght/((((ab-ofst)*mlt)^2)+shft)
28.         setPixel(0, x, y, fr, fg, fb)
29.     end
30. end
RAW Paste Data