No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

40 líneas
850 B

  1. #version 100
  2. precision mediump float;
  3. varying vec2 fragTexCoord;
  4. uniform sampler2D texture0;
  5. uniform vec4 tintColor;
  6. // NOTE: Add here your custom variables
  7. const float renderWidth = 1280;
  8. const float renderHeight = 720;
  9. float radius = 250.0;
  10. float angle = 0.8;
  11. uniform vec2 center = vec2(200, 200);
  12. void main (void)
  13. {
  14. vec2 texSize = vec2(renderWidth, renderHeight);
  15. vec2 tc = fragTexCoord*texSize;
  16. tc -= center;
  17. float dist = length(tc);
  18. if (dist < radius)
  19. {
  20. float percent = (radius - dist)/radius;
  21. float theta = percent*percent*angle*8.0;
  22. float s = sin(theta);
  23. float c = cos(theta);
  24. tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c)));
  25. }
  26. tc += center;
  27. vec3 color = texture2D(texture0, tc/texSize).rgb;
  28. gl_FragColor = vec4(color, 1.0);;
  29. }