-
Notifications
You must be signed in to change notification settings - Fork 2
/
rotatesimp.lua
35 lines (35 loc) · 931 Bytes
/
rotatesimp.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
31
32
33
34
35
-- by Ningow
function init()
setName("Rotate Simply")
setDesc("Simple 90 Rotations")
setSize(120,18+24+64+8+8+7+4)
addOutput(24+32)
addInput("Texture",24+64+8+8)
addInputParameter("Rotation","Image Rotation",18+24+64+8+8,0,0,3)
end
-- Ugly way to use channels
function apply()
x = 0
y = 0
tileSize = getTileSize()
for i=0, tileSize*tileSize-1 do
x = i%tileSize
y = math.floor(i/tileSize)
if (getValue(1,0,0,1) == 0) then
outr, outg, outb = getValue(0,x,y,1)
setPixel(0,x,y,outr,outg,outb)
end
if (getValue(1,0,0,1) == 1) then
outr, outg, outb = getValue(0,x,y,1)
setPixel(0,y,tileSize-x,outr,outg,outb)
end
if (getValue(1,0,0,1) == 2) then
outr, outg, outb = getValue(0,x,y,1)
setPixel(0,tileSize-x,tileSize-y,outr,outg,outb)
end
if (getValue(1,0,0,1) == 3) then
outr, outg, outb = getValue(0,x,y,1)
setPixel(0,tileSize-y,x,outr,outg,outb)
end
end
end