Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

95 righe
2.2 KiB

  1. -- GLSL.Vert --
  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. -- GLSL.Frag --
  11. #version 120
  12. #if defined GL_ES
  13. precision highp float;
  14. #endif
  15. uniform sampler2D in_Texture;
  16. uniform float in_Flag;
  17. uniform vec3 in_Point;
  18. uniform vec3 in_Color;
  19. varying vec2 pass_Position;
  20. void main(void)
  21. {
  22. if (in_Flag == 0.0)
  23. {
  24. float tc = 0.0, ta = 0.0;
  25. {
  26. float s = 3.0 + 2.0 * in_Point.z;
  27. vec2 p = pass_Position - in_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 * in_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(in_Texture, texcoords).xyz, 1.0);
  39. }
  40. }
  41. -- HLSL.Vert --
  42. void main(float2 in_Position : POSITION,
  43. out float2 pass_Position : TEXCOORD0,
  44. out float4 out_Position : POSITION)
  45. {
  46. pass_Position = in_Position;
  47. out_Position = float4(in_Position, 0.0, 1.0);
  48. }
  49. -- HLSL.Frag --
  50. void main(in float2 pass_Position : TEXCOORD0,
  51. uniform sampler2D in_Texture,
  52. uniform float in_Flag,
  53. uniform float3 in_Point,
  54. uniform float3 in_Color,
  55. out float4 out_FragColor : COLOR)
  56. {
  57. if (in_Flag == 0.0)
  58. {
  59. float tc = 0.0, ta = 0.0;
  60. {
  61. float s = 3.0 + 2.0 * in_Point.z;
  62. float2 p = pass_Position - in_Point.xy * 0.9;
  63. float t = clamp(1.2 - dot(s * p, s * p), 0.0, 1.0);
  64. float u = t * t * t * t;
  65. tc += 3.0 * t * t - 2.0 * t * t * t;
  66. ta += 3.0 * u * u - 2.0 * u * u * u;
  67. }
  68. out_FragColor = float4(tc * in_Color, ta + 0.1);
  69. }
  70. else
  71. {
  72. float2 texcoords = pass_Position * float2(0.5, -0.5) + float2(0.5, 0.5);
  73. /* FIXME: this should be passed as a uniform or something */
  74. texcoords += float2(0.5 / 800.0, 0.5 / 600.0);
  75. out_FragColor = float4(tex2D(in_Texture, texcoords).xyz, 1.0);
  76. }
  77. }