12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #version 120
- uniform sampler2D leavingSlideTexture;
- uniform sampler2D enteringSlideTexture;
- uniform sampler2D permTexture;
- uniform float time;
- varying vec2 v_texturePosition;
- float snoise(vec2 P) {
- return texture2D(permTexture, P).r;
- }
- #define PART 0.5
- #define START 0.4
- #define END 0.9
- void main() {
- float sn = snoise(10.0*v_texturePosition+time*0.07);
- if( time < PART ) {
- float sn1 = snoise(vec2(time*15.0, 20.0*v_texturePosition.y));
- float sn2 = snoise(v_texturePosition);
- if (sn1 > 1.0 - time*time && sn2 < 2.0*time+0.1)
- gl_FragColor = vec4(sn, sn, sn, 1.0);
- else if (time > START )
- gl_FragColor = ((time-START)/(PART - START))*vec4(sn, sn, sn, 1.0) + (1.0 - (time - START)/(PART - START))*texture2D(leavingSlideTexture, v_texturePosition);
- else
- gl_FragColor = texture2D(leavingSlideTexture, v_texturePosition);
- } else if ( time > END ) {
- gl_FragColor = ((1.0 - time)/(1.0 - END))*vec4(sn, sn, sn, 1.0) + ((time - END)/(1.0 - END))*texture2D(enteringSlideTexture, v_texturePosition);
- } else
- gl_FragColor = vec4(sn, sn, sn, 1.0);
- }
|