Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 100
- precision highp int;
- precision highp float;
- uniform float time;
- uniform float touchX;
- uniform float touchY;
- uniform float touchZ;
- uniform float line;
- varying float lightDiffuse;
- varying vec4 vertexPos;
- void main ()
- {
- float zrises;
- float dist;
- vec4 c;
- float diff = lightDiffuse;
- if ( diff <0.0)
- {
- diff = 0.6;
- }
- float light = (1.0 - diff);
- vec3 lightColor = vec3(1.0,1.0,1.0);
- vec3 diffuse = lightColor*light;
- //c = vec4(diffuse, 0.5);
- if ( line != 0.0 ) {
- dist = distance( vertexPos, vec4( touchX / 10.0, touchY / 10.0, touchZ / 10.0, 1.0 ) );
- float timeScaled = time * 4.5;
- zrises = abs( dist/15.0 - timeScaled ); // distance to animated z coordinate
- zrises = cos( zrises );
- float fading = abs( 1.0 - zrises );
- float fadingRatio = max( 1.0 - fading*20.0, 0.0 );
- //c += fadingRatio * vec3( 0.0, 1.0, 1.0 );
- }
- gl_FragColor = vec4( diffuse.r, diffuse.g, diffuse.b, diffuse.g );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement