// 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 _texCoord1;
COMPAT_VARYING     float _frame_rotation;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
struct out_vertex {
    vec2 _texCoord1;
};
vec4 _oPosition1;
out_vertex _ret_0;
vec4 _r0008;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 TEX0;
 
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;
    _ret_0._texCoord1 = TexCoord.xy;
    gl_Position = _r0008;
    TEX0.xy = TexCoord.xy;
    return;
    TEX0.xy = _ret_0._texCoord1;
} 
#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 _texCoord;
COMPAT_VARYING     float _frame_rotation;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
struct out_vertex {
    vec2 _texCoord;
};
vec4 _ret_0;
vec3 _TMP9;
float _TMP12;
float _TMP11;
float _TMP10;
vec4 _TMP8;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec2 _TMP0;
uniform sampler2D Texture;
input_dummy _IN1;
vec2 _c0026;
vec2 _c0028;
vec2 _c0030;
vec2 _c0032;
vec2 _c0034;
vec2 _c0038;
vec2 _c0040;
vec4 _r0042;
vec4 _v0042;
vec3 _r0052;
vec3 _r0054;
vec3 _TMP59;
vec3 _x0060;
vec3 _TMP65;
vec3 _x0066;
vec3 _TMP71;
vec3 _x0072;
vec3 _TMP81;
vec3 _x0082;
vec3 _TMP91;
vec3 _x0092;
COMPAT_VARYING vec4 TEX0;
 
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    vec3 _color;
    vec2 _dx;
    vec2 _dy;
    vec2 _pix_coord;
    vec2 _tc;
    vec2 _fp;
    float _pos1;
    vec3 _lum0;
    vec3 _lum1;
    _dx = vec2(1.00000000E+00/TextureSize.x, 0.00000000E+00);
    _dy = vec2(0.00000000E+00, 1.00000000E+00/TextureSize.y);
    _pix_coord = TEX0.xy*TextureSize + vec2( -5.00000000E-01, 5.00000000E-01);
    _TMP0 = floor(_pix_coord);
    _tc = (_TMP0 + vec2( 5.00000000E-01, 5.00000000E-01))/TextureSize;
    _fp = fract(_pix_coord);
    _c0026 = (_tc - _dx) - _dy;
    _TMP1 = COMPAT_TEXTURE(Texture, _c0026);
    _c0028 = _tc - _dy;
    _TMP2 = COMPAT_TEXTURE(Texture, _c0028);
    _c0030 = (_tc + _dx) - _dy;
    _TMP3 = COMPAT_TEXTURE(Texture, _c0030);
    _c0032 = (_tc + 2.00000000E+00*_dx) - _dy;
    _TMP4 = COMPAT_TEXTURE(Texture, _c0032);
    _c0034 = _tc - _dx;
    _TMP5 = COMPAT_TEXTURE(Texture, _c0034);
    _TMP6 = COMPAT_TEXTURE(Texture, _tc);
    _c0038 = _tc + _dx;
    _TMP7 = COMPAT_TEXTURE(Texture, _c0038);
    _c0040 = _tc + 2.00000000E+00*_dx;
    _TMP8 = COMPAT_TEXTURE(Texture, _c0040);
    _v0042 = vec4(_fp.x*_fp.x*_fp.x, _fp.x*_fp.x, _fp.x, 1.00000000E+00);
    _r0042.x = dot(vec4( -5.00000000E-01, 1.00000000E+00, -5.00000000E-01, 0.00000000E+00), _v0042);
    _r0042.y = dot(vec4( 1.50000000E+00, -2.50000000E+00, 0.00000000E+00, 1.00000000E+00), _v0042);
    _r0042.z = dot(vec4( -1.50000000E+00, 2.00000000E+00, 5.00000000E-01, 0.00000000E+00), _v0042);
    _r0042.w = dot(vec4( 5.00000000E-01, -5.00000000E-01, 0.00000000E+00, 0.00000000E+00), _v0042);
    _r0052 = _r0042.x*_TMP1.xyz;
    _r0052 = _r0052 + _r0042.y*_TMP2.xyz;
    _r0052 = _r0052 + _r0042.z*_TMP3.xyz;
    _r0052 = _r0052 + _r0042.w*_TMP4.xyz;
    _r0054 = _r0042.x*_TMP5.xyz;
    _r0054 = _r0054 + _r0042.y*_TMP6.xyz;
    _r0054 = _r0054 + _r0042.z*_TMP7.xyz;
    _r0054 = _r0054 + _r0042.w*_TMP8.xyz;
    _pos1 = 1.00000000E+00 - _fp.y;
    _lum0 = vec3( 8.60000014E-01, 8.60000014E-01, 8.60000014E-01) + _r0052*vec3( 1.39999986E-01, 1.39999986E-01, 1.39999986E-01);
    _lum1 = vec3( 8.60000014E-01, 8.60000014E-01, 8.60000014E-01) + _r0054*vec3( 1.39999986E-01, 1.39999986E-01, 1.39999986E-01);
    _x0060 = _fp.y/(_lum0 + 1.00000001E-07);
    _TMP9 = min(vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0060);
    _TMP59 = max(vec3( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP9);
    _x0066 = _pos1/(_lum1 + 1.00000001E-07);
    _TMP9 = min(vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0066);
    _TMP65 = max(vec3( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP9);
    _x0072 = (-7.20000029E+00*_TMP59)*_TMP59;
    _TMP10 = pow(2.71828198E+00, _x0072.x);
    _TMP11 = pow(2.71828198E+00, _x0072.y);
    _TMP12 = pow(2.71828198E+00, _x0072.z);
    _TMP71 = vec3(_TMP10, _TMP11, _TMP12);
    _x0082 = (-7.20000029E+00*_TMP65)*_TMP65;
    _TMP10 = pow(2.71828198E+00, _x0082.x);
    _TMP11 = pow(2.71828198E+00, _x0082.y);
    _TMP12 = pow(2.71828198E+00, _x0082.z);
    _TMP81 = vec3(_TMP10, _TMP11, _TMP12);
    _x0092 = _r0052*_TMP71 + _r0054*_TMP81;
    _TMP9 = min(vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0092);
    _TMP91 = max(vec3( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP9);
    _color = _TMP91*1.39999998E+00;
    _ret_0 = vec4(_color.x, _color.y, _color.z, 1.00000000E+00);
    FragColor = _ret_0;
    return;
} 
#endif
