You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

79 rivejä
1.8 KiB

  1. [vert.glsl]
  2. #version 120
  3. attribute vec2 in_position;
  4. varying 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 120
  12. #if defined GL_ES
  13. precision highp float;
  14. #endif
  15. uniform sampler2D in_texture;
  16. varying vec2 pass_position;
  17. void main(void)
  18. {
  19. vec2 texcoords = pass_position * 0.5 + vec2(0.5, 0.5);
  20. vec4 src_color = texture2D(in_texture, texcoords);
  21. float newg = src_color.z;
  22. float newb = 0.0;
  23. if (newg > 0.0)
  24. newb = 1.0;
  25. gl_FragColor = vec4(0.0, newg, 0.0, 1.0);
  26. }
  27. [vert.hlsl]
  28. void main(float2 in_Position : POSITION,
  29. out float2 pass_Position : TEXCOORD0,
  30. out float4 out_Position : POSITION)
  31. {
  32. pass_Position = in_Position;
  33. out_Position = float4(in_Position, 0.0, 1.0);
  34. }
  35. [frag.hlsl]
  36. void main(in float2 pass_Position : TEXCOORD0,
  37. uniform sampler2D in_Texture,
  38. uniform float in_Flag,
  39. uniform float3 in_Point,
  40. uniform float3 in_Color,
  41. out float4 out_FragColor : COLOR)
  42. {
  43. if (in_Flag == 0.0)
  44. {
  45. float tc = 0.0, ta = 0.0;
  46. {
  47. float s = 3.0 + 2.0 * in_Point.z;
  48. float2 p = pass_Position - in_Point.xy * 0.9;
  49. float t = clamp(1.2 - dot(s * p, s * p), 0.0, 1.0);
  50. float u = t * t * t * t;
  51. tc += 3.0 * t * t - 2.0 * t * t * t;
  52. ta += 3.0 * u * u - 2.0 * u * u * u;
  53. }
  54. out_FragColor = float4(tc * in_Color, ta + 0.1);
  55. }
  56. else
  57. {
  58. float2 texcoords = pass_Position * float2(0.5, -0.5) + float2(0.5, 0.5);
  59. /* FIXME: this should be passed as a uniform or something */
  60. texcoords += float2(0.5 / 800.0, 0.5 / 600.0);
  61. out_FragColor = float4(tex2D(in_Texture, texcoords).xyz, 1.0);
  62. }
  63. }