您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

53 行
985 B

  1. [vert.glsl]
  2. #version 130
  3. in vec2 in_position;
  4. out vec2 pass_position;
  5. void main()
  6. {
  7. pass_position = in_position;
  8. gl_Position = vec4(in_position, 0.0, 1.0);
  9. }
  10. [frag.glsl]
  11. #version 130
  12. #if defined GL_ES
  13. precision highp float;
  14. #endif
  15. in vec2 pass_position;
  16. uniform sampler2D u_texture;
  17. uniform float u_flag;
  18. uniform vec3 u_point;
  19. uniform vec3 u_color;
  20. void main(void)
  21. {
  22. if (u_flag == 0.0)
  23. {
  24. float tc = 0.0, ta = 0.0;
  25. {
  26. float s = 3.0 + 2.0 * u_point.z;
  27. vec2 p = pass_position - u_point.xy * 0.9;
  28. float t = clamp(1.2 - dot(s * p, s * p), 0.0, 1.0);
  29. float u = t * t * t * t;
  30. tc += 3.0 * t * t - 2.0 * t * t * t;
  31. ta += 3.0 * u * u - 2.0 * u * u * u;
  32. }
  33. gl_FragColor = vec4(tc * u_color, ta + 0.1);
  34. }
  35. else
  36. {
  37. vec2 texcoords = pass_position * 0.5 + vec2(0.5, 0.5);
  38. gl_FragColor = vec4(texture2D(u_texture, texcoords).xyz, 1.0);
  39. }
  40. }