blob: 5b71a658b686de3a9642084a98f55d3c85622324 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D u_tex0;
uniform float u_time;
uniform vec2 u_resolution;
const float speedx = 1./ 0.1;
const float speedy = 1./ .01;
const float speedr = 1./ 0.01;
const float delta = 20.;
const float intence = 10.;
const int dif = 7;
float col(vec2 coord)
{
float delta_theta = 3.1415926535897932 / float(dif);
float col = 0.;
float theta = 0.;
theta = u_time/200.;
coord.x += u_time/speedx;
coord.y += u_time/speedy;
for (int i = 0; i < dif; i++)
{
coord.x += u_time/speedr;
theta = theta + delta_theta;
col = col + cos( (coord.x*cos(theta) - coord.y*sin(theta))*20. );
}
return cos(col);
}
void main(void)
{
vec2 p = (gl_FragCoord.xy) / u_resolution.xy;
vec2 c1 = p;
vec2 c2 = p;
c2.x = c2.x+u_resolution.x/delta;
float dx = (col(c1)-col(c2))/delta;
c2 = p;
c2.y = c2.y + u_resolution.y/delta;
float dy = (col(c1)-col(c2))/delta;
c1.x = c1.x+dx;
c1.y = -(c1.y+dy);
float alpha = 1.+dot(dx,dy)*intence;
if (alpha < 0.7) alpha = 0.7;
gl_FragColor = texture2D(u_tex0,c1)*(alpha);
}
|