-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from TheWing/main
added g33kou for 2024-10-28
- Loading branch information
Showing
1 changed file
with
160 additions
and
1 deletion.
There are no files selected for viewing
161 changes: 160 additions & 1 deletion
161
public/shader_file_sources/2024_10_28_byte_jam_monday_night_bytes/g33kou.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,160 @@ | ||
-- missing for now, this is a placeholder | ||
sin=math.sin | ||
cos=math.cos | ||
abs=math.abs | ||
rnd=math.random | ||
|
||
p1={ | ||
2,4,1,5,0,5, 3, | ||
2,4,0,5,-1,4, 3, | ||
2,4,-1,4,-2,2, 3, | ||
2,4,-2,2,1,2, 3, | ||
1,2,-2,2,-2,-2, 3, | ||
1,2,-2,-2,1,-2, 3, | ||
2,-4,1,-2,-2,-2, 3, | ||
2,-4,-2,-2,-1,-4, 3, | ||
2,-4,-1,-4,0,-5, 3, | ||
2,-4,0,-5,1,-5, 3, | ||
} | ||
|
||
p2={ | ||
-2,2,-1,4,0,4, 3, | ||
-2,2,0,4,2,2, 3, | ||
-2,2,2,2,2,-2, 3, | ||
-2,2,-2,-2,2,-2, 3, | ||
0,4,2,2,1,4, 3, | ||
-1,-4,-2,-2,0,-2, 3, | ||
-1,-4,0,-2,1,-4, 3, | ||
-1,-4,1,-4,0,-5, 3, | ||
0,-2,2,-2,1,-4, 3, | ||
0,4,0,6,1,6, 6, | ||
} | ||
|
||
p3={ | ||
-3,1,-2,0,-2,-1, 4, | ||
-2,-1,-2,0,-1,1, 4, | ||
-2,-1,-1,1,-1,0, 4, | ||
-1,0,-1,1,0,-1, 4, | ||
0,-1,0,0,-1,1, 4, | ||
0,0,1,1,0,-1, 4, | ||
0,-1,1,1,1,0, 4, | ||
1,0,1,1,2,-1, 4, | ||
2,-1,1,1,2,0, 4, | ||
2,-1,2,0,3,1, 4, | ||
} | ||
|
||
p4={ | ||
0,0,-2,1,-3,0, 4, | ||
0,0,-3,0,0,-1, 4, | ||
0,-1,-.5,0,-1.5,0, 0, | ||
0,1,-1,2,-2,2, 4, | ||
} | ||
|
||
function mtri(x,y,p,i,s,fl) | ||
x1=p[i]*s | ||
y1=p[i+1]*s | ||
x2=p[i+2]*s | ||
y2=p[i+3]*s | ||
x3=p[i+4]*s | ||
y3=p[i+5]*s | ||
if fl&1==1 then | ||
x1=x-x1 | ||
x2=x-x2 | ||
x3=x-x3 | ||
else | ||
x1=x+x1 | ||
x2=x+x2 | ||
x3=x+x3 | ||
end | ||
if fl&2==2 then | ||
y1=y+y1 | ||
y2=y+y2 | ||
y3=y+y3 | ||
else | ||
y1=y-y1 | ||
y2=y-y2 | ||
y3=y-y3 | ||
end | ||
tri(x1,y1,x2,y2,x3,y3,p[i+6]) | ||
end | ||
|
||
function bump(t,d) | ||
return abs(sin(-t/10+d)*2) | ||
end | ||
|
||
web={ | ||
0,0,40,0, | ||
0,0,0,40, | ||
0,0,35,35, | ||
0,15,10,10, | ||
0,20,15,15, | ||
0,25,20,20, | ||
0,30,25,25, | ||
0,35,30,30, | ||
10,10,15,0, | ||
15,15,20,0, | ||
20,20,25,0, | ||
25,25,30,0, | ||
30,30,35,0, | ||
} | ||
|
||
spi={ | ||
20,60,15,55, | ||
15,55,10,60, | ||
20,63,15,58, | ||
15,58,10,63, | ||
20,66,15,61, | ||
15,61,10,66, | ||
20,60,25,55, | ||
25,55,30,60, | ||
20,63,25,58, | ||
25,58,30,63, | ||
20,66,25,61, | ||
25,61,30,66, | ||
} | ||
|
||
function mline(x,y,p) | ||
for i=1,#p,4 do | ||
line(x+p[i],y+p[i+1],x+p[i+2],y+p[i+3],1) | ||
end | ||
end | ||
|
||
t=0 | ||
function TIC() | ||
t=t+1 | ||
-- | ||
vbank(0) | ||
cls() | ||
for i=0,100 do | ||
pix(rnd()*240,rnd()*136,12) | ||
end | ||
-- | ||
vbank(1) | ||
cls() | ||
mline(0,0,web) | ||
y=fft(0,40) | ||
line(20,20,20,y+60,1) | ||
elli(20,y+60,3,6,1) | ||
pix(19,y+64,2) | ||
pix(21,y+64,2) | ||
mline(0,y,spi) | ||
-- | ||
s=.2*fft(0,40) --sin(t)/10) | ||
x=cos(t/50)*20 | ||
y=sin(t/50)*20 | ||
for i=1,#p1,7 do | ||
mtri(x+120-19-s*3,y+68+bump(t,.5),p1,i,6+s,0) | ||
mtri(x+120-38-s*6,y+68+bump(t,1),p1,i,6+s,0) | ||
mtri(x+120+19+s*3,y+68+bump(t,.5),p1,i,6+s,1) | ||
mtri(x+120+38+s*6,y+68+bump(t,1),p1,i,6+s,1) | ||
end | ||
for i=1,#p2,7 do | ||
mtri(x+120,y+68+bump(t,0),p2,i,6+s,0) | ||
end | ||
for i=1,#p3,7 do | ||
mtri(x+120,y+80+bump(t,0),p3,i,sin(t/100)*8,0) | ||
end | ||
for i=1,#p4,7 do | ||
mtri(x+120-10,y+60+bump(t,0),p4,i,6+s,0) | ||
mtri(x+120+10,y+60+bump(t,0),p4,i,6+s,1) | ||
end | ||
end |