Advertisement
Guest User

Untitled

a guest
Oct 21st, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #version 100
  2. precision highp int;
  3. precision highp float;
  4.  
  5. uniform float time;
  6. uniform float touchX;
  7. uniform float touchY;
  8. uniform float touchZ;
  9. uniform float line;
  10.  
  11. varying float lightDiffuse;
  12. varying vec4 vertexPos;
  13.  
  14. void main ()
  15. {
  16. float zrises;
  17. float dist;
  18. vec4 c;
  19.  
  20. float diff = lightDiffuse;
  21. if ( diff <0.0)
  22. {
  23. diff = 0.6;
  24. }
  25. float light = (1.0 - diff);
  26. vec3 lightColor = vec3(1.0,1.0,1.0);
  27. vec3 diffuse = lightColor*light;
  28.  
  29.  
  30.  
  31. //c = vec4(diffuse, 0.5);
  32.  
  33. if ( line != 0.0 ) {
  34.  
  35. dist = distance( vertexPos, vec4( touchX / 10.0, touchY / 10.0, touchZ / 10.0, 1.0 ) );
  36.  
  37. float timeScaled = time * 4.5;
  38. zrises = abs( dist/15.0 - timeScaled ); // distance to animated z coordinate
  39. zrises = cos( zrises );
  40. float fading = abs( 1.0 - zrises );
  41. float fadingRatio = max( 1.0 - fading*20.0, 0.0 );
  42.  
  43. //c += fadingRatio * vec3( 0.0, 1.0, 1.0 );
  44.  
  45.  
  46. }
  47. gl_FragColor = vec4( diffuse.r, diffuse.g, diffuse.b, diffuse.g );
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement