1uniform mat4 u_Color;
2varying vec2 v_TexCoord;
3varying vec2 v_TexCoord2;
4varying vec2 v_TexCoord3;
5varying vec2 v_Position;
6uniform sampler2D u_Tex0;
7uniform sampler2D u_Tex1;
8uniform float u_Time;
9uniform vec2 u_Resolution;
10
11vec2 direction = vec2(0.9,0.3);
12float speed = 0.2;
13float pressure = 1.0;
14float zoom = 3.0;
15
16float r = 0.0;
17float g = 1.0;
18float b = 0.0;
19float mode = 1.0;
20
21void main()
22{
23 gl_FragColor = texture2D(u_Tex0, v_TexCoord);
24
25 vec2 offset = (v_TexCoord + (direction * u_Time * speed)) / zoom;
26 vec3 bgcol = texture2D(u_Tex0, v_TexCoord).xyz;
27 vec3 fogcol = texture2D(u_Tex1, offset).xyz;
28 vec3 col = bgcol + fogcol*pressure;
29 vec4 color = texture2D(u_Tex0, v_TexCoord);
30
31 vec4 texcolor2 = texture2D(u_Tex0, v_TexCoord3);
32 if(gl_FragColor.a < 0.01) {
33 if(texcolor2.a > 0.01) {
34 gl_FragColor = vec4(r, g, b, mode);
35 } else {
36 discard;
37 }
38 }
39
40
41 gl_FragColor = mix(gl_FragColor, vec4(col, color.a), 0.5);
42 vec4 texcolor = texture2D(u_Tex0, v_TexCoord2);
43 if(texcolor.r > 0.9) {
44 gl_FragColor *= texcolor.g > 0.9 ? u_Color[0] : u_Color[1];
45 } else if(texcolor.g > 0.9) {
46 gl_FragColor *= u_Color[2];
47 } else if(texcolor.b > 0.9) {
48 gl_FragColor *= u_Color[3];
49 }
50 if(gl_FragColor.a < 0.01) discard;
51}
52
53