界面美化/死亡动画/自定义序列编辑器

This commit is contained in:
MrZ_26
2020-07-15 23:22:44 +08:00
parent 3d22f5d8ca
commit 882b841d3f
35 changed files with 1054 additions and 812 deletions

View File

@@ -0,0 +1,4 @@
extern float a;
vec4 effect(vec4 color,Image text,vec2 pos,vec2 scr_pos){
return vec4(1.,1.,1.,sign(Texel(text,pos).a)*a);
}

View File

@@ -0,0 +1,42 @@
#define PI 3.1415926535897932384626
extern float w,h;
extern float t;
vec4 effect(vec4 color,Image text,vec2 pos,vec2 scr_pos){
float x=scr_pos.x/w;
float y=scr_pos.y/h;
float dx,dy;
vec3 V=vec3(0.);
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,1.);
}

View File

@@ -0,0 +1,5 @@
extern float X,Y,W,H;
vec4 effect(vec4 C,Image Tx,vec2 pos,vec2 scr_pos){
C[3]=min((scr_pos.x-X)/W*0.3+(scr_pos.y-Y)/H*0.1,0.3)+0.5;
return C;
}

View File

@@ -0,0 +1,29 @@
#define PI 3.14159
extern float xresolution;
//sample from 1D vis-depth map
float samp(vec2 coord,float r,Image u_texture){
return step(r,Texel(u_texture,coord).r);
}
vec4 effect(vec4 color,Image texture,vec2 texture_coords,vec2 screen_coords){
//cartesian to polar, y of 1D sample is always 0
vec2 norm=texture_coords.st*2.-1.;
vec2 tc=vec2((atan(norm.y,norm.x)+PI)/(2.*PI),0.);
float r=length(norm);
//enlarge blur parameter by distance, light scattering simulation
float blur=(1./xresolution)*smoothstep(0.3,1.,r);
//Simple Gaussian blur
float sum=//brightness(0~1)
samp(vec2(tc.x-3.*blur,tc.y),r,texture)*0.1
+samp(vec2(tc.x-2.*blur,tc.y),r,texture)*0.13
+samp(vec2(tc.x-1.*blur,tc.y),r,texture)*0.17
+samp(tc,r,texture)*0.2//The center tex coord,which gives us hard shadows.
+samp(vec2(tc.x+1.*blur,tc.y),r,texture)*0.17
+samp(vec2(tc.x+2.*blur,tc.y),r,texture)*0.13
+samp(vec2(tc.x+3.*blur,tc.y),r,texture)*0.1;
//Multiply the distance to get a soft fading
return vec4(vec3(1.),sum*smoothstep(1.,0.,r));
}

View File

@@ -0,0 +1,15 @@
#define PI 3.14159265
extern float w,h;
extern float t;
vec4 effect(vec4 color,Image text,vec2 pos,vec2 scr_pos){
float x=scr_pos.x-w/2.;
float y=scr_pos.y-h/2.;
float a=(step(0.,x)*2.-1.)*PI+atan(y,x)+PI*0.5+t*0.626;
return vec4(
color.r*(sin(a+PI*0./3.)*0.3+0.5),
color.g*(sin(a+PI*2./3.)*0.3+0.5),
color.b*(sin(a+PI*4./3.)*0.3+0.5),
1.
);
}

View File

@@ -0,0 +1,21 @@
#define PI 3.14
extern float yresolution;
vec4 effect(vec4 color,Image texture,vec2 texture_coords,vec2 screen_coords){
//Iterate through the occluder map's y-axis.
for(float y=0.;y<yresolution;y++){
//cartesian to polar
// y/yresolution=distance to light source(0~1)
vec2 norm=vec2(texture_coords.s,y/yresolution)*2.-1.;
float theta=PI*1.5+norm.x*PI;
float r=(1.+norm.y)*0.5;
//sample from solid
if(
Texel(texture,(
vec2(-r*sin(theta),-r*cos(theta))*0.5+0.5//coord of solid sampling
))
.a>0.1
)return vec4(vec3(y/yresolution),1.);//collision check, alpha>0.1 means transparent
}
return vec4(1.,1.,1.,1.);//return max distance 1
}

View File

@@ -0,0 +1,11 @@
#define PI 3.14159265
extern float t;
vec4 effect(vec4 color,Image text,vec2 pos,vec2 scr_pos){
float x=scr_pos.x/262.+t;
return vec4(
color.r*(sin(x+PI*0./3.)*0.3+0.5),
color.g*(sin(x+PI*2./3.)*0.3+0.5),
color.b*(sin(x+PI*4./3.)*0.3+0.5),
1.
);
}

View File

@@ -0,0 +1,8 @@
extern float w,h;
extern float level;
vec4 effect(vec4 color,Image text,vec2 pos,vec2 scr_pos){
float dx=abs(scr_pos.x/w-0.5);
float dy=abs(scr_pos.y/h-0.5);
float a=(max(dx,dy)*2.-.626)*level;
return vec4(1.,0.,0.,a);
}