diff options
Diffstat (limited to 'assets/shaders/Water.frag.glsl')
-rw-r--r-- | assets/shaders/Water.frag.glsl | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/assets/shaders/Water.frag.glsl b/assets/shaders/Water.frag.glsl deleted file mode 100644 index 5b71a658..00000000 --- a/assets/shaders/Water.frag.glsl +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | #ifdef GL_ES | ||
2 | precision highp float; | ||
3 | #endif | ||
4 | |||
5 | uniform sampler2D u_tex0; | ||
6 | uniform float u_time; | ||
7 | uniform vec2 u_resolution; | ||
8 | |||
9 | const float speedx = 1./ 0.1; | ||
10 | const float speedy = 1./ .01; | ||
11 | const float speedr = 1./ 0.01; | ||
12 | const float delta = 20.; | ||
13 | const float intence = 10.; | ||
14 | const int dif = 7; | ||
15 | |||
16 | float col(vec2 coord) | ||
17 | { | ||
18 | float delta_theta = 3.1415926535897932 / float(dif); | ||
19 | float col = 0.; | ||
20 | float theta = 0.; | ||
21 | theta = u_time/200.; | ||
22 | |||
23 | coord.x += u_time/speedx; | ||
24 | coord.y += u_time/speedy; | ||
25 | for (int i = 0; i < dif; i++) | ||
26 | { | ||
27 | coord.x += u_time/speedr; | ||
28 | theta = theta + delta_theta; | ||
29 | col = col + cos( (coord.x*cos(theta) - coord.y*sin(theta))*20. ); | ||
30 | } | ||
31 | |||
32 | return cos(col); | ||
33 | } | ||
34 | |||
35 | void main(void) | ||
36 | { | ||
37 | vec2 p = (gl_FragCoord.xy) / u_resolution.xy; | ||
38 | |||
39 | vec2 c1 = p; | ||
40 | vec2 c2 = p; | ||
41 | |||
42 | c2.x = c2.x+u_resolution.x/delta; | ||
43 | float dx = (col(c1)-col(c2))/delta; | ||
44 | |||
45 | c2 = p; | ||
46 | c2.y = c2.y + u_resolution.y/delta; | ||
47 | float dy = (col(c1)-col(c2))/delta; | ||
48 | |||
49 | c1.x = c1.x+dx; | ||
50 | c1.y = -(c1.y+dy); | ||
51 | |||
52 | float alpha = 1.+dot(dx,dy)*intence; | ||
53 | if (alpha < 0.7) alpha = 0.7; | ||
54 | gl_FragColor = texture2D(u_tex0,c1)*(alpha); | ||
55 | } | ||