Script contest entries.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1296 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2010-02-02 16:14:46 +00:00
parent 47f8f8ffc4
commit 46ed0b5718
10 changed files with 157 additions and 0 deletions

64
scripts/Downbringer1.lua Normal file
View File

@ -0,0 +1,64 @@
-- Picture scene: Amigaball (by Richard Fhager, code adopted from Evalion)
w = 256
h = 256
setpicturesize(w,h)
-- Set Amiga Palette
colors = {}
for c = 0, 63, 1 do
colors[c+1] = {c*4,0,0}
end
for c = 0, 63, 1 do
colors[c+65] = {255,c*4,c*4}
end
for c = 0, 63, 1 do
colors[c+129] = {255-c*4,255-c*4,255-c*4}
end
for c = 1, #colors, 1 do
setcolor(c-1,colors[c][1],colors[c][2],colors[c][3])
end
-- Make Amiga ball
for y = 0, h - 1, 1 do
for x = 0, w - 1, 1 do
-- Fractionalize image dimensions
ox = x / w;
oy = y / h;
-- Ball
Xr = ox-0.5; Yr = oy-0.5;
W = (1 - 2*math.sqrt(Xr*Xr + Yr*Yr));
-- 'FishEye' distortion / Fake 3D
F = (math.cos((ox-0.5)*math.pi)*math.cos((oy-0.5)*math.pi))*0.65;
ox = ox - (ox-0.5)*F;
oy = oy - (oy-0.5)*F;
-- Checkers
V = ((math.floor(0.25+ox*10)+math.floor(1+oy*10)) % 2) * 255 * W;
-- Specularities
SPEC1 = math.max(0,(1-5*math.sqrt((ox-0.45)*(ox-0.45)+(oy-0.45)*(oy-0.45)))*112);
SPEC2 = math.max(0,(1-15*math.sqrt((ox-0.49)*(ox-0.49)+(oy-0.48)*(oy-0.48)))*255);
r = W * 255 + SPEC1 + SPEC2
g = V + SPEC1 + SPEC2
b = V + SPEC1 + SPEC2
c = matchcolor(math.max(0,math.min(255,r)),math.max(0,math.min(255,g)),math.max(0,math.min(255,b)))
putpicturepixel(x, y, c);
end
end

21
scripts/Downbringer2.lua Normal file
View File

@ -0,0 +1,21 @@
-- Picture distortion: Sine
w, h = getpicturesize()
frq = 2
amp = 0.3
for y = 0, h - 1, 1 do
for x = 0, w - 1, 1 do
ox = x / w;
oy = y / h;
ox = (1 + ox + math.sin(oy*math.pi*frq)*amp) % 1;
c = getbackuppixel(math.floor(ox*w),y);
--c = y % 16
putpicturepixel(x, y, c);
end
end

6
scripts/nitrofurano1.lua Normal file
View File

@ -0,0 +1,6 @@
-- x1palettetopicture.lua
w,h=getpicturesize();
for y1=0,7,1 do
for x1=0,31,1 do
putpicturepixel(x1,y1,y1+x1*8)
end;end

8
scripts/nitrofurano2.lua Normal file
View File

@ -0,0 +1,8 @@
-- x8palettetopicture.lua
w,h=getpicturesize();
for y1=0,7,1 do
for x1=0,31,1 do
for y2=0,7,1 do
for x2=0,7,1 do
putpicturepixel(x1*8+x2,y1*8+y2,y1+x1*8)
end;end;end;end

10
scripts/nitrofurano3.lua Normal file
View File

@ -0,0 +1,10 @@
-- drawgrid8x8.lua
w,h=getpicturesize();
for y=0,h-1,1 do
for x=0,w-1,8 do
putpicturepixel(x,y,1);
end;end
for y=0,h-1,8 do
for x=0,w-1,1 do
putpicturepixel(x,y,1);
end;end

11
scripts/nitrofurano4.lua Normal file
View File

@ -0,0 +1,11 @@
-- drawgrid8x8matchcolor.lua
w,h=getpicturesize();
c=matchcolor(0xFF,0x00,0x00)
for y=0,h-1,1 do
for x=0,w-1,8 do
putpicturepixel(x,y,c);
end;end
for y=0,h-1,8 do
for x=0,w-1,1 do
putpicturepixel(x,y,c);
end;end

10
scripts/nitrofurano5.lua Normal file
View File

@ -0,0 +1,10 @@
-- drawisometricgrid.lua
w,h=getpicturesize();
for y=0,h-1,8 do
for x=0,w-1,1 do
putpicturepixel(x,y+(x/2)%8,1);
end;end
for y=0,h-1,8 do
for x=0,w-1,1 do
putpicturepixel(x+3,y+7-((x/2)%8),1);
end;end

9
scripts/nitrofurano6.lua Normal file
View File

@ -0,0 +1,9 @@
-- 12bitcolourspacefrompalette.lua
w,h=getpicturesize();
for y1=0,3,1 do
for x1=0,3,1 do
for y2=0,15,1 do
for x2=0,15,1 do
putpicturepixel(x1*16+x2,y1*16+y2,matchcolor((y2*255)/15,
((y1*4+x1)*255)/15,(x2*255)/15))
end;end;end;end

9
scripts/nitrofurano7.lua Normal file
View File

@ -0,0 +1,9 @@
-- 15bitcolourspacefrompalette.lua
w,h=getpicturesize();
for y1=0,3,1 do
for x1=0,7,1 do
for y2=0,31,1 do
for x2=0,31,1 do
putpicturepixel(x1*32+x2,y1*32+y2,matchcolor((y2*255)/31,
((y1*8+x1)*255)/31,(x2*255)/31))
end;end;end;end

9
scripts/nitrofurano8.lua Normal file
View File

@ -0,0 +1,9 @@
-- 18bitcolourspacefrompalette.lua
w,h=getpicturesize();
for y1=0,7,1 do
for x1=0,7,1 do
for y2=0,63,1 do
for x2=0,63,1 do
putpicturepixel(x1*64+x2,y1*64+y2,matchcolor((y2*255)/64,
((y1*8+x1)*255)/64,(x2*255)/64))
end;end;end;end