7layout(set = 0, binding = 1, std140) uniform SpriteExtended {
13 vec4 custom_uniforms[16];
17#define iResolution ext.u0.zw
18#define time_f ext.u2.y
21layout(location = 0) out vec4 color;
22layout(set = 0, binding = 0) uniform sampler2D samp;
32float pingPong(
float x,
float len){
float m=mod(x,len*2.0);
return m<=len?m:len*2.0-m;}
38float h(
float n){
return fract(sin(
n)*43758.5453123);}
44vec2
h2(
float n){
return vec2(
h(
n),
h(
n+1.23));}
53 float r=abs(t*6.0-3.0)-1.0;
54 float g=2.0-abs(t*6.0-2.0);
55 float b=2.0-abs(t*6.0-4.0);
56 return clamp(vec3(r,g,b),0.0,1.0);
70 vec2 p0=-0.5+
h2(seg)*1.0;
71 vec2 p1=-0.5+
h2(seg+1.0)*1.0;
73 vec2 swirlC=mix(p0,p1,a);
79 float theta=k*exp(-r*2.5)*(1.0+0.5*sin(
time_f*0.6));
82 vec2
rot=vec2(d.x*ct-d.y*st,d.x*st+d.y*ct)+swirlC;
84 float angle=atan(uv.y,uv.x)+
time_f*20.0;
85 vec3 rain=
rainbow(angle/(2.0*3.1415926535));
87 float bulge_strength=0.2;
88 float distortion=pow(length(
rot),2.0)*bulge_strength;
89 vec2 distorted=
rot*(1.0+distortion);
91 vec2 tex=distorted*0.5+0.5;
92 vec4 base=texture(samp,tex);
93 vec3 blend=mix(base.rgb,rain,0.5);
95 color=vec4(sin(blend*
time_f),base.a);
layout(set=0, binding=1, std140) uniform SpriteExtended
void main(void)
Executes the fragment shader entry point.
float pingPong(float x, float length)
Evaluates pingPong for this shader effect.
vec2 h2(vec2 p)
Evaluates h2 for this shader effect.
vec2 rot(vec2 v, float a)
Evaluates rot for this shader effect.
vec3 rainbow(float t)
Evaluates rainbow for this shader effect.
float h(vec2 p)
Evaluates h for this shader effect.
float n(vec2 p)
Evaluates n for this shader effect.