着色器技术飞跃
框架跟进
This commit is contained in:
Submodule Zframework updated: 559a8a46a7...e18b4003c7
@@ -10,8 +10,6 @@ Powered by LÖVE, © 2006–2022 LÖVE Development Team.
|
||||
|
||||
Lua is free software distributed under the terms of the MIT license. Copyright © 1994–2022 by Lua.org, PUC-Rio.
|
||||
|
||||
SIMPLE LOVE LIGHTS is under a MIT License. Created by Dylan Hunn.
|
||||
|
||||
json.lua is copyrighted by rxi. © 2022 rxi.
|
||||
|
||||
IBM Plex is copyrighted by the International Business Machines Corporation. IBM and IBM Plex are trademarks of IBM Corp, registered in many jurisdictions worldwide. IBM Plex is licensed under the SIL Open Font License, Version 1.1.
|
||||
|
||||
3
main.lua
3
main.lua
@@ -190,9 +190,6 @@ Z.setDebugInfo{
|
||||
{"Voices",VOC.getQueueCount},
|
||||
{"Audios",love.audio.getSourceCount},
|
||||
}
|
||||
Z.setOnResize(function(w,_)
|
||||
SHADER.warning:send('w',w*SCR.dpi)
|
||||
end)
|
||||
do--Z.setOnFocus
|
||||
local function task_autoSoundOff()
|
||||
while true do
|
||||
|
||||
@@ -8,16 +8,12 @@ function back.init()
|
||||
t=math.random()*260
|
||||
BG.resize(SCR.w,SCR.h)
|
||||
end
|
||||
function back.resize(_,h)
|
||||
shader:send('w',SCR.W)
|
||||
shader:send('h',h*SCR.dpi)
|
||||
end
|
||||
function back.update(dt)
|
||||
t=(t+dt)%2600
|
||||
end
|
||||
function back.draw()
|
||||
gc.clear(.08,.08,.084)
|
||||
shader:send('t',t)
|
||||
shader:send('phase',t)
|
||||
gc.setShader(shader)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
|
||||
@@ -6,17 +6,13 @@ local shader=SHADER.grad1
|
||||
local t
|
||||
function back.init()
|
||||
t=math.random()*260
|
||||
back.resize()
|
||||
end
|
||||
function back.resize()
|
||||
shader:send('w',SCR.W)
|
||||
end
|
||||
function back.update(dt)
|
||||
t=(t+dt)%2600
|
||||
end
|
||||
function back.draw()
|
||||
gc.clear(.08,.08,.084)
|
||||
shader:send('t',t)
|
||||
shader:send('phase',t)
|
||||
gc.setShader(shader)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
|
||||
@@ -8,15 +8,12 @@ function back.init()
|
||||
t=math.random()*260
|
||||
BG.resize(nil,SCR.h)
|
||||
end
|
||||
function back.resize(_,h)
|
||||
shader:send('h',h*SCR.dpi)
|
||||
end
|
||||
function back.update(dt)
|
||||
t=(t+dt)%2600
|
||||
end
|
||||
function back.draw()
|
||||
gc.clear(.08,.08,.084)
|
||||
shader:send('t',t)
|
||||
shader:send('phase',t)
|
||||
gc.setShader(shader)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
|
||||
@@ -8,16 +8,12 @@ function back.init()
|
||||
t=math.random()*260
|
||||
BG.resize(SCR.w,SCR.h)
|
||||
end
|
||||
function back.resize(_,h)
|
||||
shader:send('w',SCR.W)
|
||||
shader:send('h',h*SCR.dpi)
|
||||
end
|
||||
function back.update(dt)
|
||||
t=(t+dt)%2600
|
||||
end
|
||||
function back.draw()
|
||||
gc.clear(.08,.08,.084)
|
||||
shader:send('t',t)
|
||||
shader:send('phase',t)
|
||||
gc.setShader(shader)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
|
||||
@@ -8,16 +8,12 @@ function back.init()
|
||||
t=math.random()*260
|
||||
BG.resize(SCR.w,SCR.h)
|
||||
end
|
||||
function back.resize(_,h)
|
||||
shader:send('w',SCR.W)
|
||||
shader:send('h',h*SCR.dpi)
|
||||
end
|
||||
function back.update(dt)
|
||||
t=(t+dt)%2600
|
||||
end
|
||||
function back.draw()
|
||||
gc.clear(.08,.08,.084)
|
||||
shader:send('t',t)
|
||||
shader:send('phase',t)
|
||||
gc.setShader(shader)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
|
||||
@@ -315,7 +315,6 @@ return{
|
||||
Cold_Clear [MinusKelvin]
|
||||
json.lua [rxi]
|
||||
profile.lua [itraykov]
|
||||
simple-love-lights [dylhunn]
|
||||
]],
|
||||
support="Support the author",
|
||||
WidgetText={
|
||||
|
||||
@@ -186,7 +186,6 @@ return{
|
||||
Cold_Clear [MinusKelvin]
|
||||
json.lua [rxi]
|
||||
profile.lua [itraykov]
|
||||
simple-love-lights [dylhunn]
|
||||
]],
|
||||
support="Apoyen al Autor",
|
||||
WidgetText={
|
||||
|
||||
@@ -282,7 +282,6 @@ return{
|
||||
Cold_Clear [MinusKelvin]
|
||||
json.lua [rxi]
|
||||
profile.lua [itraykov]
|
||||
simple-love-lights [dylhunn]
|
||||
]],
|
||||
support="Aider le créateur",
|
||||
WidgetText={
|
||||
|
||||
@@ -317,7 +317,6 @@ return{
|
||||
Cold_Clear [MinusKelvin]
|
||||
json.lua [rxi]
|
||||
profile.lua [itraykov]
|
||||
simple-love-lights [dylhunn]
|
||||
]],
|
||||
support="Dukung pencipta",
|
||||
WidgetText={
|
||||
|
||||
@@ -317,7 +317,6 @@ return{
|
||||
Cold_Clear [MinusKelvin]
|
||||
json.lua [rxi]
|
||||
profile.lua [itraykov]
|
||||
simple-love-lights [dylhunn]
|
||||
]],
|
||||
support="Support the Author",
|
||||
WidgetText={
|
||||
|
||||
@@ -304,7 +304,6 @@ return{
|
||||
Cold_Clear [MinusKelvin]
|
||||
json.lua [rxi]
|
||||
profile.lua [itraykov]
|
||||
simple-love-lights [dylhunn]
|
||||
]],
|
||||
support="Support author",
|
||||
WidgetText={
|
||||
|
||||
@@ -316,7 +316,6 @@ return{
|
||||
Cold_Clear [MinusKelvin]
|
||||
json.lua [rxi]
|
||||
profile.lua [itraykov]
|
||||
simple-love-lights [dylhunn]
|
||||
]],
|
||||
support="支持作者",
|
||||
WidgetText={
|
||||
|
||||
@@ -314,7 +314,6 @@ return{
|
||||
Cold_Clear [MinusKelvin]
|
||||
json.lua [rxi]
|
||||
profile.lua [itraykov]
|
||||
simple-love-lights [dylhunn]
|
||||
]],
|
||||
support="供养作者!",
|
||||
WidgetText={
|
||||
|
||||
@@ -316,7 +316,6 @@ return{
|
||||
Cold_Clear [MinusKelvin]
|
||||
json.lua [rxi]
|
||||
profile.lua [itraykov]
|
||||
simple-love-lights [dylhunn]
|
||||
]],
|
||||
support="支持作者",
|
||||
WidgetText={
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
extern float a;
|
||||
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
|
||||
return vec4(1.,1.,1.,sign(Texel(tex,tex_coords).a)*a);
|
||||
uniform float a;
|
||||
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
|
||||
return vec4(1.,1.,1.,sign(texture2D(tex,texCoord).a)*a);
|
||||
}
|
||||
|
||||
@@ -1,42 +1,14 @@
|
||||
#define PI 3.1415926535897932384626
|
||||
extern float w,h;
|
||||
extern float t;
|
||||
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
|
||||
float x=scr_coords.x/w;
|
||||
float y=scr_coords.y/h;
|
||||
float dx,dy;
|
||||
uniform float phase;
|
||||
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
|
||||
float x=scrCoord.x/love_ScreenSize.x;
|
||||
float y=scrCoord.y/love_ScreenSize.y;
|
||||
vec3 V=vec3(0.);
|
||||
V.r=V.r+smoothstep(1.26,0.,length(vec2(0.5+cos(phase*3.*0.26)*0.4-x,0.5-sin(phase*3.*0.62)*0.4-y)));
|
||||
V.g=V.g+smoothstep(1.26,0.,length(vec2((0.5+cos(phase*3.*0.32)*0.4)-x,(0.5-sin(phase*3.*0.80)*0.4)-y)));
|
||||
V.b=V.b+smoothstep(1.26,0.,length(vec2((0.5-cos(phase*3.*0.49)*0.4)-x,(0.5+sin(phase*3.*0.18)*0.4)-y)));
|
||||
V.rg+=vec2(smoothstep(0.626,0.,length(vec2((0.5+cos(phase*0.53)*0.4)-x,(0.5-sin(phase*0.46)*0.4)-y))));
|
||||
V.rb+=vec2(smoothstep(0.626,0.,length(vec2((0.5+cos(phase*0.98)*0.4)-x,(0.5+sin(phase*0.57)*0.4)-y))));
|
||||
V.gb+=vec2(smoothstep(0.626,0.,length(vec2((0.5-cos(phase*0.86)*0.4)-x,(0.5-sin(phase*0.32)*0.4)-y))));
|
||||
|
||||
dx=0.5+cos(t*3.*0.26)*0.4-x;
|
||||
dy=0.5-sin(t*3.*0.62)*0.4-y;
|
||||
dx=sqrt(dx*dx+dy*dy);
|
||||
V.r=V.r+smoothstep(1.26,0.,dx);
|
||||
|
||||
dx=(0.5+cos(t*3.*0.32)*0.4)-x;
|
||||
dy=(0.5-sin(t*3.*0.80)*0.4)-y;
|
||||
dx=sqrt(dx*dx+dy*dy);
|
||||
V.g=V.g+smoothstep(1.26,0.,dx);
|
||||
|
||||
dx=(0.5-cos(t*3.*0.49)*0.4)-x;
|
||||
dy=(0.5+sin(t*3.*0.18)*0.4)-y;
|
||||
dx=sqrt(dx*dx+dy*dy);
|
||||
V.b=V.b+smoothstep(1.26,0.,dx);
|
||||
|
||||
dx=(0.5+cos(t*0.53)*0.4)-x;
|
||||
dy=(0.5-sin(t*0.46)*0.4)-y;
|
||||
dx=sqrt(dx*dx+dy*dy);
|
||||
V.rg+=vec2(smoothstep(0.626,0.,dx));
|
||||
|
||||
dx=(0.5+cos(t*0.98)*0.4)-x;
|
||||
dy=(0.5+sin(t*0.57)*0.4)-y;
|
||||
dx=sqrt(dx*dx+dy*dy);
|
||||
V.rb+=vec2(smoothstep(0.626,0.,dx));
|
||||
|
||||
dx=(0.5-cos(t*0.86)*0.4)-x;
|
||||
dy=(0.5-sin(t*0.32)*0.4)-y;
|
||||
dx=sqrt(dx*dx+dy*dy);
|
||||
V.gb+=vec2(smoothstep(0.626,0.,dx));
|
||||
|
||||
dx=1.626*max(max(V.r,V.g),V.b);
|
||||
return vec4(V/dx,0.4);
|
||||
return vec4(V/max(max(V.r,V.g),V.b)/1.626,0.4);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
extern float k,b;
|
||||
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
|
||||
vec4 texcolor=Texel(tex,tex_coords);
|
||||
uniform float k,b;
|
||||
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
|
||||
vec4 texcolor=texture2D(tex,texCoord);
|
||||
return vec4(
|
||||
(b+texcolor.r*k)*color.r,
|
||||
(b+texcolor.g*k)*color.g,
|
||||
(b+texcolor.b*k)*color.b,
|
||||
(texcolor.r*k+b)*color.r,
|
||||
(texcolor.g*k+b)*color.g,
|
||||
(texcolor.b*k+b)*color.b,
|
||||
texcolor.a*color.a
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
extern float k,b;
|
||||
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
|
||||
vec4 texcolor=Texel(tex,tex_coords);
|
||||
uniform float k,b;
|
||||
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
|
||||
vec4 texcolor=texture2D(tex,texCoord);
|
||||
return vec4(
|
||||
(b+texcolor.r*k)*color.r,
|
||||
(b+texcolor.g*k)*color.g,
|
||||
(b+texcolor.b*k)*color.b,
|
||||
(texcolor.r*k+b)*color.r,
|
||||
(texcolor.g*k+b)*color.g,
|
||||
(texcolor.b*k+b)*color.b,
|
||||
texcolor.a*color.a
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
extern float t,w;
|
||||
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
|
||||
float x=scr_coords.x/w;
|
||||
uniform float phase;
|
||||
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
|
||||
float x=scrCoord.x/love_ScreenSize.x;
|
||||
return vec4(
|
||||
.8-x*.6,
|
||||
.3+.2*sin(t),
|
||||
.3+.2*sin(phase),
|
||||
.15+x*.7,
|
||||
.4
|
||||
);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
extern float t,h;
|
||||
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
|
||||
float y=scr_coords.y/h;
|
||||
uniform float phase;
|
||||
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
|
||||
float y=scrCoord.y/love_ScreenSize.y;
|
||||
return vec4(
|
||||
.8-y*.6,
|
||||
.2+y*.4,
|
||||
.3+.1*sin(t),
|
||||
.3+.1*sin(phase),
|
||||
.4
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
|
||||
vec4 texcolor=Texel(tex,tex_coords);
|
||||
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
|
||||
vec4 texcolor=texture2D(tex,texCoord);
|
||||
return vec4(
|
||||
pow(texcolor.r+.26,.7023),
|
||||
pow(texcolor.g+.26,.7023),
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
extern float t,w,h;
|
||||
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
|
||||
float x=scr_coords.x/w;
|
||||
float y=scr_coords.y/h;
|
||||
uniform float phase;
|
||||
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
|
||||
float x=scrCoord.x/love_ScreenSize.x;
|
||||
float y=scrCoord.y/love_ScreenSize.y;
|
||||
return vec4(
|
||||
.8-y*.7+.2*sin(t/6.26),
|
||||
.2+y*.5+.15*sin(t/4.),
|
||||
.2+x*.6-.1*sin(t/2.83),
|
||||
.8-y*.7+.2*sin(phase/6.26),
|
||||
.2+y*.5+.15*sin(phase/4.),
|
||||
.2+x*.6-.1*sin(phase/2.83),
|
||||
.4
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
extern float t,w,h;
|
||||
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
|
||||
float x=scr_coords.x/w;
|
||||
float y=scr_coords.y/h;
|
||||
uniform float phase;
|
||||
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
|
||||
float x=scrCoord.x/love_ScreenSize.x;
|
||||
float y=scrCoord.y/love_ScreenSize.y;
|
||||
return vec4(
|
||||
.8-y*.8-.1*sin(t/6.26),
|
||||
.4+.1*sin(t/4.)*(y+2.)/(y+5.),
|
||||
abs(.7-x*1.4+y*.5*sin(t/16.)),
|
||||
.8-y*.8-.1*sin(phase/6.26),
|
||||
.4+.1*sin(phase/4.)*(y+2.)/(y+5.),
|
||||
abs(.7-x*1.4+y*.5*sin(phase/16.)),
|
||||
.4
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
extern float w,level;
|
||||
vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
|
||||
float dx=abs(scr_coords.x/w-0.5);
|
||||
uniform float level;
|
||||
vec4 effect(vec4 color,sampler2D tex,vec2 texCoord,vec2 scrCoord){
|
||||
float dx=abs(scrCoord.x/love_ScreenSize.x-0.5);
|
||||
float a=(dx*2.6-.626)*level;
|
||||
return vec4(1.,0.,0.,a);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user