Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. // Fragment shader
  2. precision highp float;
  3.  
  4. #define PI 3.14159265359
  5. #define PI2 6.28318530718
  6.  
  7. varying vec2 UV;
  8. varying vec3 v_position;
  9. uniform float time;
  10. uniform float ratio;
  11. uniform vec2 mouse;
  12.  
  13. float func(float x){
  14. return 0.4 * cos(x * PI + time * PI2);
  15. }
  16.  
  17. void main(void){
  18. float x = UV.x * ratio;
  19. float y = 2.0 * UV.y - 1.0;
  20.  
  21. vec4 col = vec4(0.0);
  22.  
  23. for(int i = 0; i < 10; i++){
  24. if(distance(func(x + float(i)/10.0 + float(i) * x * 0.0),y) < 0.01){
  25. col.rgb += 1.0;
  26. }
  27. }
  28. col.a = 1.0;
  29.  
  30. gl_FragColor = col;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement