Advertisement
Guest User

sharp-scanline.glsl

a guest
Mar 7th, 2015
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.56 KB | None | 0 0
  1. // GLSL shader autogenerated by cg2glsl.py.
  2. #if defined(VERTEX)
  3.  
  4. #if __VERSION__ >= 130
  5. #define COMPAT_VARYING out
  6. #define COMPAT_ATTRIBUTE in
  7. #define COMPAT_TEXTURE texture
  8. #else
  9. #define COMPAT_VARYING varying
  10. #define COMPAT_ATTRIBUTE attribute
  11. #define COMPAT_TEXTURE texture2D
  12. #endif
  13.  
  14. #ifdef GL_ES
  15. #define COMPAT_PRECISION mediump
  16. #else
  17. #define COMPAT_PRECISION
  18. #endif
  19. COMPAT_VARYING float _frame_rotation;
  20.  
  21. COMPAT_VARYING vec2 _omega;
  22.  
  23. COMPAT_VARYING vec2 _offset;
  24.  
  25. COMPAT_VARYING vec2 _texel;
  26.  
  27.  
  28.  
  29.  
  30.  
  31. struct sine_coord {
  32.  
  33. vec2 _texel;
  34.  
  35. vec2 _offset;
  36.  
  37. vec2 _omega;
  38.  
  39. };
  40.  
  41.  
  42.  
  43. struct input_dummy {
  44.  
  45. vec2 _video_size;
  46.  
  47. vec2 _texture_size;
  48.  
  49. vec2 _output_dummy_size;
  50.  
  51. float _frame_count;
  52.  
  53. float _frame_direction;
  54.  
  55. float _frame_rotation;
  56.  
  57. };
  58.  
  59.  
  60.  
  61. vec4 _oPosition1;
  62.  
  63.  
  64.  
  65. input_dummy _IN1;
  66.  
  67. vec4 _r0006;
  68.  
  69. COMPAT_ATTRIBUTE vec4 VertexCoord;
  70.  
  71. COMPAT_ATTRIBUTE vec4 COLOR;
  72.  
  73. COMPAT_VARYING vec4 COL0;
  74.  
  75. COMPAT_ATTRIBUTE vec4 TexCoord;
  76.  
  77. COMPAT_VARYING vec4 TEX0;
  78.  
  79. COMPAT_VARYING vec4 TEX2;
  80.  
  81. COMPAT_VARYING vec4 TEX3;
  82.  
  83. COMPAT_VARYING vec4 TEX4;
  84.  
  85.  
  86.  
  87.  
  88. uniform mat4 MVPMatrix;
  89. uniform int FrameDirection;
  90. uniform int FrameCount;
  91. uniform COMPAT_PRECISION vec2 OutputSize;
  92. uniform COMPAT_PRECISION vec2 TextureSize;
  93. uniform COMPAT_PRECISION vec2 InputSize;
  94. void main()
  95.  
  96. {
  97.  
  98.  
  99.  
  100. vec4 _oColor;
  101.  
  102. vec2 _oTex;
  103.  
  104. sine_coord _coords;
  105.  
  106.  
  107.  
  108. _r0006 = VertexCoord.x*MVPMatrix[0];
  109.  
  110. _r0006 = _r0006 + VertexCoord.y*MVPMatrix[1];
  111.  
  112. _r0006 = _r0006 + VertexCoord.z*MVPMatrix[2];
  113.  
  114. _r0006 = _r0006 + VertexCoord.w*MVPMatrix[3];
  115.  
  116. _oPosition1 = _r0006;
  117.  
  118. _oColor = COLOR;
  119.  
  120. _oTex = TexCoord.xy;
  121.  
  122. _coords._texel = TexCoord.xy*TextureSize;
  123.  
  124. _coords._offset = TexCoord.xy - vec2(0.00000000E+000, 2.50000000E-001/TextureSize.y);
  125.  
  126. _coords._omega = vec2((3.14150000E+000*OutputSize.x*TextureSize.x)/InputSize.x, 6.28299999E+000*TextureSize.y);
  127.  
  128. gl_Position = _r0006;
  129.  
  130. COL0 = COLOR;
  131.  
  132. TEX0.xy = TexCoord.xy;
  133.  
  134. TEX2.xy = _coords._texel;
  135.  
  136. TEX3.xy = _coords._offset;
  137.  
  138. TEX4.xy = _coords._omega;
  139.  
  140. }
  141. #elif defined(FRAGMENT)
  142.  
  143. #if __VERSION__ >= 130
  144. #define COMPAT_VARYING in
  145. #define COMPAT_TEXTURE texture
  146. out vec4 FragColor;
  147. #else
  148. #define COMPAT_VARYING varying
  149. #define FragColor gl_FragColor
  150. #define COMPAT_TEXTURE texture2D
  151. #endif
  152.  
  153. #ifdef GL_ES
  154. #ifdef GL_FRAGMENT_PRECISION_HIGH
  155. precision highp float;
  156. #else
  157. precision mediump float;
  158. #endif
  159. #define COMPAT_PRECISION mediump
  160. #else
  161. #define COMPAT_PRECISION
  162. #endif
  163. COMPAT_VARYING float _frame_rotation;
  164.  
  165. COMPAT_VARYING vec2 _omega;
  166.  
  167. COMPAT_VARYING vec2 _offset;
  168.  
  169. COMPAT_VARYING vec2 _texel;
  170.  
  171.  
  172.  
  173.  
  174.  
  175. struct sine_coord {
  176.  
  177. vec2 _texel;
  178.  
  179. vec2 _offset;
  180.  
  181. vec2 _omega;
  182.  
  183. };
  184.  
  185.  
  186.  
  187. struct input_dummy {
  188.  
  189. vec2 _video_size;
  190.  
  191. vec2 _texture_size;
  192.  
  193. vec2 _output_dummy_size;
  194.  
  195. float _frame_count;
  196.  
  197. float _frame_direction;
  198.  
  199. float _frame_rotation;
  200.  
  201. };
  202.  
  203.  
  204.  
  205. vec4 _ret_0;
  206.  
  207. float _TMP3;
  208.  
  209. vec2 _TMP2;
  210.  
  211. float _TMP6;
  212.  
  213. float _TMP5;
  214.  
  215. vec4 _TMP1;
  216.  
  217. vec2 _TMP4;
  218.  
  219. uniform sampler2D Texture;
  220.  
  221. input_dummy _IN1;
  222.  
  223. vec2 _TMP12;
  224.  
  225. vec2 _TMP16;
  226.  
  227. vec2 _c0023;
  228.  
  229. vec2 _x0025;
  230.  
  231. vec2 _a0031;
  232.  
  233. COMPAT_VARYING vec4 TEX2;
  234.  
  235. COMPAT_VARYING vec4 TEX3;
  236.  
  237. COMPAT_VARYING vec4 TEX4;
  238.  
  239.  
  240.  
  241.  
  242. uniform int FrameDirection;
  243. uniform int FrameCount;
  244. uniform COMPAT_PRECISION vec2 OutputSize;
  245. uniform COMPAT_PRECISION vec2 TextureSize;
  246. uniform COMPAT_PRECISION vec2 InputSize;
  247. void main()
  248.  
  249. {
  250.  
  251.  
  252.  
  253. vec2 _texel_floored;
  254.  
  255. vec2 _center_dist;
  256.  
  257. vec2 _f;
  258.  
  259. vec2 _mod_texel;
  260.  
  261. vec3 _scanline;
  262.  
  263.  
  264.  
  265. _texel_floored = floor(TEX2.xy);
  266.  
  267. _TMP12 = fract(TEX2.xy);
  268.  
  269. _center_dist = _TMP12 - 5.00000000E-001;
  270.  
  271. _TMP4 = min(vec2( 9.99999940E-002, 9.99999940E-002), _center_dist);
  272.  
  273. _TMP16 = max(vec2( -9.99999940E-002, -9.99999940E-002), _TMP4);
  274.  
  275. _f = (_center_dist - _TMP16)*1.25000000E+000 + 5.00000000E-001;
  276.  
  277. _mod_texel = _texel_floored + _f;
  278.  
  279. _c0023 = _mod_texel/TextureSize;
  280.  
  281. _TMP1 = COMPAT_TEXTURE(Texture, _c0023);
  282.  
  283. _x0025 = TEX3.xy*TEX4.xy;
  284.  
  285. _TMP5 = sin(_x0025.x);
  286.  
  287. _TMP6 = sin(_x0025.y);
  288.  
  289. _TMP2 = vec2(_TMP5, _TMP6);
  290.  
  291. _a0031 = vec2( 1.00000001E-001, 1.50000006E-001)*_TMP2;
  292.  
  293. _TMP3 = dot(_a0031, vec2( 1.00000000E+000, 1.00000000E+000));
  294.  
  295. _scanline = _TMP1.xyz*(1.00000000E+000 + _TMP3);
  296.  
  297. _ret_0 = vec4(_scanline.x, _scanline.y, _scanline.z, 1.00000000E+000);
  298.  
  299. FragColor = _ret_0;
  300.  
  301. return;
  302.  
  303. }
  304. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement