// GLSL shader autogenerated by cg2glsl.py.
#if defined(VERTEX)

#if __VERSION__ >= 130
#define COMPAT_VARYING out
#define COMPAT_ATTRIBUTE in
#define COMPAT_TEXTURE texture
#else
#define COMPAT_VARYING varying
#define COMPAT_ATTRIBUTE attribute
#define COMPAT_TEXTURE texture2D
#endif

#ifdef GL_ES
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
COMPAT_VARYING     vec2 VARone;
COMPAT_VARYING     vec2 VARpix_no;
COMPAT_VARYING     vec2 VARtex;
struct data {
    vec2 VARtex;
    vec2 VARpix_no;
    vec2 VARone;
};
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
};
vec4 _oPosition1;
data _oData1;
input_dummy _IN1;
vec4 _r0008;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
 
uniform mat4 MVPMatrix;
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    _r0008 = VertexCoord.x*MVPMatrix[0];
    _r0008 = _r0008 + VertexCoord.y*MVPMatrix[1];
    _r0008 = _r0008 + VertexCoord.z*MVPMatrix[2];
    _r0008 = _r0008 + VertexCoord.w*MVPMatrix[3];
    _oPosition1 = _r0008;
    VARtex = TexCoord.xy;
    VARpix_no = TexCoord.xy*TextureSize;
    VARone = 1.00000000E+00/TextureSize;
    gl_Position = _r0008;
} 
#elif defined(FRAGMENT)

#if __VERSION__ >= 130
#define COMPAT_VARYING in
#define COMPAT_TEXTURE texture
out vec4 FragColor;
#else
#define COMPAT_VARYING varying
#define FragColor gl_FragColor
#define COMPAT_TEXTURE texture2D
#endif

#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
COMPAT_VARYING     vec2 VARone;
COMPAT_VARYING     vec2 VARpix_no;
COMPAT_VARYING     vec2 VARtex;
struct data {
    vec2 VARtex;
    vec2 VARpix_no;
    vec2 VARone;
};
struct input_dummy {
    vec2 _video_size;
    vec2 VARtexture_size;
    vec2 _output_dummy_size;
    float _frame_count;
};
vec4 _ret_0;
vec3 _TMP11;
float _TMP14;
float _TMP13;
float _TMP12;
float _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
data _vertex1;
uniform sampler2D Texture;
vec2 _c0022;
vec2 _c0032;
vec2 _c0052;
vec2 _c0062;
float _TMP73;
float _x0074;
float _TMP77;
float _x0078;
float _TMP81;
float _x0082;
float _TMP85;
float _x0086;
float _TMP89;
float _x0090;
vec3 _a0094;
vec3 _b0094;
uniform float _NTSC_CRT_GAMMA;
uniform float _NTSC_DISPLAY_GAMMA;
 
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    vec3 _frame0;
    vec3 _frame1;
    vec3 _frame2;
    vec3 _frame3;
    vec3 _frame4;
    float _offset_dist;
    float _dist0;
    float _dist1;
    float _dist3;
    float _dist4;
    vec3 _scanline;
    _c0022 = VARtex + vec2(0.00000000E+00, -2.00000000E+00*VARone.y);
    _TMP0 = COMPAT_TEXTURE(Texture, _c0022);
    _TMP12 = pow(_TMP0.x, _NTSC_CRT_GAMMA);
    _TMP13 = pow(_TMP0.y, _NTSC_CRT_GAMMA);
    _TMP14 = pow(_TMP0.z, _NTSC_CRT_GAMMA);
    _frame0 = vec3(_TMP12, _TMP13, _TMP14);
    _c0032 = VARtex + vec2(0.00000000E+00, -VARone.y);
    _TMP1 = COMPAT_TEXTURE(Texture, _c0032);
    _TMP12 = pow(_TMP1.x, _NTSC_CRT_GAMMA);
    _TMP13 = pow(_TMP1.y, _NTSC_CRT_GAMMA);
    _TMP14 = pow(_TMP1.z, _NTSC_CRT_GAMMA);
    _frame1 = vec3(_TMP12, _TMP13, _TMP14);
    _TMP2 = COMPAT_TEXTURE(Texture, VARtex);
    _TMP12 = pow(_TMP2.x, _NTSC_CRT_GAMMA);
    _TMP13 = pow(_TMP2.y, _NTSC_CRT_GAMMA);
    _TMP14 = pow(_TMP2.z, _NTSC_CRT_GAMMA);
    _frame2 = vec3(_TMP12, _TMP13, _TMP14);
    _c0052 = VARtex + vec2(0.00000000E+00, VARone.y);
    _TMP3 = COMPAT_TEXTURE(Texture, _c0052);
    _TMP12 = pow(_TMP3.x, _NTSC_CRT_GAMMA);
    _TMP13 = pow(_TMP3.y, _NTSC_CRT_GAMMA);
    _TMP14 = pow(_TMP3.z, _NTSC_CRT_GAMMA);
    _frame3 = vec3(_TMP12, _TMP13, _TMP14);
    _c0062 = VARtex + vec2(0.00000000E+00, 2.00000000E+00*VARone.y);
    _TMP4 = COMPAT_TEXTURE(Texture, _c0062);
    _TMP12 = pow(_TMP4.x, _NTSC_CRT_GAMMA);
    _TMP13 = pow(_TMP4.y, _NTSC_CRT_GAMMA);
    _TMP14 = pow(_TMP4.z, _NTSC_CRT_GAMMA);
    _frame4 = vec3(_TMP12, _TMP13, _TMP14);
    _TMP5 = fract(VARpix_no.y);
    _offset_dist = _TMP5 - 5.00000000E-01;
    _dist0 = 2.00000000E+00 + _offset_dist;
    _dist1 = 1.00000000E+00 + _offset_dist;
    _dist3 = -1.00000000E+00 + _offset_dist;
    _dist4 = -2.00000000E+00 + _offset_dist;
    _x0074 = -5.00000000E+00*_dist0*_dist0;
    _TMP73 = pow(2.71828198E+00, _x0074);
    _scanline = _frame0*_TMP73;
    _x0078 = -5.00000000E+00*_dist1*_dist1;
    _TMP77 = pow(2.71828198E+00, _x0078);
    _scanline = _scanline + _frame1*_TMP77;
    _x0082 = -5.00000000E+00*_offset_dist*_offset_dist;
    _TMP81 = pow(2.71828198E+00, _x0082);
    _scanline = _scanline + _frame2*_TMP81;
    _x0086 = -5.00000000E+00*_dist3*_dist3;
    _TMP85 = pow(2.71828198E+00, _x0086);
    _scanline = _scanline + _frame3*_TMP85;
    _x0090 = -5.00000000E+00*_dist4*_dist4;
    _TMP89 = pow(2.71828198E+00, _x0090);
    _scanline = _scanline + _frame4*_TMP89;
    _a0094 = 1.14999998E+00*_scanline;
    _b0094 = vec3(1.00000000E+00/_NTSC_DISPLAY_GAMMA, 1.00000000E+00/_NTSC_DISPLAY_GAMMA, 1.00000000E+00/_NTSC_DISPLAY_GAMMA);
    _TMP12 = pow(_a0094.x, _b0094.x);
    _TMP13 = pow(_a0094.y, _b0094.y);
    _TMP14 = pow(_a0094.z, _b0094.z);
    _TMP11 = vec3(_TMP12, _TMP13, _TMP14);
    _ret_0 = vec4(_TMP11.x, _TMP11.y, _TMP11.z, 1.00000000E+00);
    FragColor = _ret_0;
    return;
} 
#endif
