Guest User

Simple Rotate

a guest
May 9th, 2020
65
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function init()
  2.     setName("Simple Rotate")
  3.     setDesc("Simple 90 Rotations")
  4.     setSize(120,18+24+64+8+8+7+4)
  5.     addOutput(24+32)
  6.     addInput("Texture",24+64+8+8)
  7.     addInputParameter("Rotation","Image Rotation",18+24+64+8+8,0,0,3)
  8. end
  9. -- Ugly way to use channels
  10. function apply()
  11.     x = 0
  12.     y = 0
  13.     tileSize = getTileSize()
  14.     for i=0, tileSize*tileSize-1 do
  15.         x = i%tileSize
  16.         y = math.floor(i/tileSize)
  17.         if (getValue(1,0,0,1) == 0) then
  18.             outr, outg, outb = getValue(0,x,y,1)
  19.             setPixel(0,x,y,outr,outg,outb)
  20.         end
  21.         if (getValue(1,0,0,1) == 1) then
  22.             outr, outg, outb = getValue(0,x,y,1)
  23.             setPixel(0,y,tileSize-x,outr,outg,outb)
  24.         end
  25.         if (getValue(1,0,0,1) == 2) then
  26.             outr, outg, outb = getValue(0,x,y,1)
  27.             setPixel(0,tileSize-x,tileSize-y,outr,outg,outb)
  28.         end
  29.         if (getValue(1,0,0,1) == 3) then
  30.             outr, outg, outb = getValue(0,x,y,1)
  31.             setPixel(0,tileSize-y,x,outr,outg,outb)
  32.         end
  33.     end
  34. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×