// 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     vec4 _t4;
COMPAT_VARYING     vec4 _t3;
COMPAT_VARYING     vec4 _t2;
COMPAT_VARYING     vec4 _t1;
COMPAT_VARYING     vec2 _texCoord;
COMPAT_VARYING     vec4 _position1;
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 {
    vec4 _position1;
    vec2 _texCoord;
    vec4 _t1;
    vec4 _t2;
    vec4 _t3;
    vec4 _t4;
};
out_vertex _ret_0;
input_dummy _IN1;
vec4 _r0023;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec4 TEX2;
COMPAT_VARYING vec4 TEX3;
COMPAT_VARYING vec4 TEX4;
 
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()
{
    float _x;
    float _y;
    vec2 _dg1;
    vec2 _dg2;
    vec2 _dx;
    vec2 _dy;
    vec2 _TMP11;
    vec2 _TMP12;
    vec2 _TMP13;
    vec2 _TMP14;
    vec2 _TMP15;
    vec2 _TMP16;
    vec2 _TMP17;
    vec2 _TMP18;
    out_vertex _TMP19;
    _x = 5.00000000E-01*(1.00000000E+00/TextureSize.x);
    _y = 5.00000000E-01*(1.00000000E+00/TextureSize.y);
    _dg1 = vec2(_x, _y);
    _dg2 = vec2(-_x, _y);
    _dx = vec2(_x, 0.00000000E+00);
    _dy = vec2(0.00000000E+00, _y);
    _r0023 = VertexCoord.x*MVPMatrix[0];
    _r0023 = _r0023 + VertexCoord.y*MVPMatrix[1];
    _r0023 = _r0023 + VertexCoord.z*MVPMatrix[2];
    _r0023 = _r0023 + VertexCoord.w*MVPMatrix[3];
    _TMP17 = TexCoord.xy - _dg1;
    _TMP18 = TexCoord.xy - _dy;
    _TMP19._t1 = vec4(_TMP17.x, _TMP17.y, _TMP18.x, _TMP18.y);
    _TMP15 = TexCoord.xy - _dg2;
    _TMP16 = TexCoord.xy + _dx;
    _TMP19._t2 = vec4(_TMP15.x, _TMP15.y, _TMP16.x, _TMP16.y);
    _TMP13 = TexCoord.xy + _dg1;
    _TMP14 = TexCoord.xy + _dy;
    _TMP19._t3 = vec4(_TMP13.x, _TMP13.y, _TMP14.x, _TMP14.y);
    _TMP11 = TexCoord.xy + _dg2;
    _TMP12 = TexCoord.xy - _dx;
    _TMP19._t4 = vec4(_TMP11.x, _TMP11.y, _TMP12.x, _TMP12.y);
    _ret_0._position1 = _r0023;
    _ret_0._texCoord = TexCoord.xy;
    _ret_0._t1 = _TMP19._t1;
    _ret_0._t2 = _TMP19._t2;
    _ret_0._t3 = _TMP19._t3;
    _ret_0._t4 = _TMP19._t4;
    gl_Position = vec4(float(_r0023.x), float(_r0023.y), float(_r0023.z), float(_r0023.w));
    TEX0.xy = TexCoord.xy;
    TEX1 = _TMP19._t1;
    TEX2 = _TMP19._t2;
    TEX3 = _TMP19._t3;
    TEX4 = _TMP19._t4;
    return;
    TEX0.xy = _ret_0._texCoord;
    TEX1 = _ret_0._t1;
    TEX2 = _ret_0._t2;
    TEX3 = _ret_0._t3;
    TEX4 = _ret_0._t4;
} 
#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     vec4 _t4;
COMPAT_VARYING     vec4 _t3;
COMPAT_VARYING     vec4 _t21;
COMPAT_VARYING     vec4 _t11;
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 _t11;
    vec4 _t21;
    vec4 _t3;
    vec4 _t4;
};
vec4 _ret_0;
float _TMP29;
float _TMP33;
float _TMP32;
float _TMP34;
vec3 _TMP28;
float _TMP31;
vec3 _TMP30;
float _TMP27;
vec3 _TMP26;
float _TMP25;
vec3 _TMP24;
float _TMP23;
vec3 _TMP22;
float _TMP21;
float _TMP20;
float _TMP19;
float _TMP18;
vec3 _TMP17;
float _TMP16;
vec3 _TMP15;
float _TMP14;
vec3 _TMP13;
float _TMP12;
vec3 _TMP11;
vec3 _TMP10;
vec3 _TMP9;
vec4 _TMP8;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
uniform sampler2D Texture;
vec2 _c0045;
vec2 _c0047;
vec2 _c0049;
vec2 _c0051;
vec2 _c0053;
vec2 _c0055;
vec2 _c0057;
vec2 _c0059;
vec2 _c0061;
vec3 _a0063;
vec3 _a0067;
vec3 _a0071;
vec3 _a0075;
vec3 _a0079;
vec3 _a0083;
vec3 _a0089;
vec3 _a0091;
vec3 _a0093;
float _TMP96;
float _x0097;
vec3 _a0103;
float _TMP106;
float _x0107;
vec3 _a0113;
float _TMP116;
float _x0117;
vec3 _a0123;
float _TMP126;
float _x0127;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec4 TEX2;
COMPAT_VARYING vec4 TEX3;
COMPAT_VARYING vec4 TEX4;
 
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    vec3 _c00;
    vec3 _c10;
    vec3 _c20;
    vec3 _c01;
    vec3 _c11;
    vec3 _c21;
    vec3 _c02;
    vec3 _c12;
    vec3 _c22;
    float _md1;
    float _md2;
    float _w1;
    float _w2;
    float _w3;
    float _w4;
    float _t1;
    float _t2;
    float _ww;
    float _lc1;
    float _lc2;
    vec3 _TMP43;
    _c0045 = vec2(float(TEX1.x), float(TEX1.y));
    _TMP0 = COMPAT_TEXTURE(Texture, _c0045);
    _c00 = vec3(float(_TMP0.x), float(_TMP0.y), float(_TMP0.z));
    _c0047 = vec2(float(TEX1.z), float(TEX1.w));
    _TMP1 = COMPAT_TEXTURE(Texture, _c0047);
    _c10 = vec3(float(_TMP1.x), float(_TMP1.y), float(_TMP1.z));
    _c0049 = vec2(float(TEX2.x), float(TEX2.y));
    _TMP2 = COMPAT_TEXTURE(Texture, _c0049);
    _c20 = vec3(float(_TMP2.x), float(_TMP2.y), float(_TMP2.z));
    _c0051 = vec2(float(TEX4.z), float(TEX4.w));
    _TMP3 = COMPAT_TEXTURE(Texture, _c0051);
    _c01 = vec3(float(_TMP3.x), float(_TMP3.y), float(_TMP3.z));
    _c0053 = vec2(float(TEX0.x), float(TEX0.y));
    _TMP4 = COMPAT_TEXTURE(Texture, _c0053);
    _c11 = vec3(float(_TMP4.x), float(_TMP4.y), float(_TMP4.z));
    _c0055 = vec2(float(TEX2.z), float(TEX2.w));
    _TMP5 = COMPAT_TEXTURE(Texture, _c0055);
    _c21 = vec3(float(_TMP5.x), float(_TMP5.y), float(_TMP5.z));
    _c0057 = vec2(float(TEX4.x), float(TEX4.y));
    _TMP6 = COMPAT_TEXTURE(Texture, _c0057);
    _c02 = vec3(float(_TMP6.x), float(_TMP6.y), float(_TMP6.z));
    _c0059 = vec2(float(TEX3.z), float(TEX3.w));
    _TMP7 = COMPAT_TEXTURE(Texture, _c0059);
    _c12 = vec3(float(_TMP7.x), float(_TMP7.y), float(_TMP7.z));
    _c0061 = vec2(float(TEX3.x), float(TEX3.y));
    _TMP8 = COMPAT_TEXTURE(Texture, _c0061);
    _c22 = vec3(float(_TMP8.x), float(_TMP8.y), float(_TMP8.z));
    _a0063 = _c00 - _c22;
    _TMP30 = abs(vec3(float(_a0063.x), float(_a0063.y), float(_a0063.z)));
    _TMP9 = vec3(float(_TMP30.x), float(_TMP30.y), float(_TMP30.z));
    _TMP31 = dot(vec3(float(_TMP9.x), float(_TMP9.y), float(_TMP9.z)), vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _md1 = float(_TMP31);
    _a0067 = _c02 - _c20;
    _TMP30 = abs(vec3(float(_a0067.x), float(_a0067.y), float(_a0067.z)));
    _TMP10 = vec3(float(_TMP30.x), float(_TMP30.y), float(_TMP30.z));
    _TMP31 = dot(vec3(float(_TMP10.x), float(_TMP10.y), float(_TMP10.z)), vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _md2 = float(_TMP31);
    _a0071 = _c22 - _c11;
    _TMP30 = abs(vec3(float(_a0071.x), float(_a0071.y), float(_a0071.z)));
    _TMP11 = vec3(float(_TMP30.x), float(_TMP30.y), float(_TMP30.z));
    _TMP31 = dot(vec3(float(_TMP11.x), float(_TMP11.y), float(_TMP11.z)), vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _TMP12 = float(_TMP31);
    _w1 = _TMP12*_md2;
    _a0075 = _c02 - _c11;
    _TMP30 = abs(vec3(float(_a0075.x), float(_a0075.y), float(_a0075.z)));
    _TMP13 = vec3(float(_TMP30.x), float(_TMP30.y), float(_TMP30.z));
    _TMP31 = dot(vec3(float(_TMP13.x), float(_TMP13.y), float(_TMP13.z)), vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _TMP14 = float(_TMP31);
    _w2 = _TMP14*_md1;
    _a0079 = _c00 - _c11;
    _TMP30 = abs(vec3(float(_a0079.x), float(_a0079.y), float(_a0079.z)));
    _TMP15 = vec3(float(_TMP30.x), float(_TMP30.y), float(_TMP30.z));
    _TMP31 = dot(vec3(float(_TMP15.x), float(_TMP15.y), float(_TMP15.z)), vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _TMP16 = float(_TMP31);
    _w3 = _TMP16*_md2;
    _a0083 = _c20 - _c11;
    _TMP30 = abs(vec3(float(_a0083.x), float(_a0083.y), float(_a0083.z)));
    _TMP17 = vec3(float(_TMP30.x), float(_TMP30.y), float(_TMP30.z));
    _TMP31 = dot(vec3(float(_TMP17.x), float(_TMP17.y), float(_TMP17.z)), vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _TMP18 = float(_TMP31);
    _w4 = _TMP18*_md1;
    _t1 = _w1 + _w3;
    _t2 = _w2 + _w4;
    _TMP32 = max(float(_t1), float(_t2));
    _TMP19 = float(_TMP32);
    _ww = _TMP19 + 1.00016594E-04;
    _c11 = (_w1*_c00 + _w2*_c20 + _w3*_c22 + _w4*_c02 + _ww*_c11)/(_t1 + _t2 + _ww);
    _a0089 = _c10 + _c12 + _c11;
    _TMP31 = dot(vec3(float(_a0089.x), float(_a0089.y), float(_a0089.z)), vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _TMP20 = float(_TMP31);
    _lc1 = -2.50000000E-01/(1.19995117E-01*_TMP20 + 2.50000000E-01);
    _a0091 = _c01 + _c21 + _c11;
    _TMP31 = dot(vec3(float(_a0091.x), float(_a0091.y), float(_a0091.z)), vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _TMP21 = float(_TMP31);
    _lc2 = -2.50000000E-01/(1.19995117E-01*_TMP21 + 2.50000000E-01);
    _a0093 = _c11 - _c10;
    _TMP30 = abs(vec3(float(_a0093.x), float(_a0093.y), float(_a0093.z)));
    _TMP22 = vec3(float(_TMP30.x), float(_TMP30.y), float(_TMP30.z));
    _TMP31 = dot(vec3(float(_TMP22.x), float(_TMP22.y), float(_TMP22.z)), vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _TMP23 = float(_TMP31);
    _x0097 = _lc1*_TMP23 + 3.24951172E-01;
    _TMP34 = min(2.50000000E-01, float(_x0097));
    _TMP33 = float(_TMP34);
    _TMP32 = max(-4.99877930E-02, float(_TMP33));
    _TMP96 = float(_TMP32);
    _a0103 = _c11 - _c21;
    _TMP30 = abs(vec3(float(_a0103.x), float(_a0103.y), float(_a0103.z)));
    _TMP24 = vec3(float(_TMP30.x), float(_TMP30.y), float(_TMP30.z));
    _TMP31 = dot(vec3(float(_TMP24.x), float(_TMP24.y), float(_TMP24.z)), vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _TMP25 = float(_TMP31);
    _x0107 = _lc2*_TMP25 + 3.24951172E-01;
    _TMP34 = min(2.50000000E-01, float(_x0107));
    _TMP33 = float(_TMP34);
    _TMP32 = max(-4.99877930E-02, float(_TMP33));
    _TMP106 = float(_TMP32);
    _a0113 = _c11 - _c12;
    _TMP30 = abs(vec3(float(_a0113.x), float(_a0113.y), float(_a0113.z)));
    _TMP26 = vec3(float(_TMP30.x), float(_TMP30.y), float(_TMP30.z));
    _TMP31 = dot(vec3(float(_TMP26.x), float(_TMP26.y), float(_TMP26.z)), vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _TMP27 = float(_TMP31);
    _x0117 = _lc1*_TMP27 + 3.24951172E-01;
    _TMP34 = min(2.50000000E-01, float(_x0117));
    _TMP33 = float(_TMP34);
    _TMP32 = max(-4.99877930E-02, float(_TMP33));
    _TMP116 = float(_TMP32);
    _a0123 = _c11 - _c01;
    _TMP30 = abs(vec3(float(_a0123.x), float(_a0123.y), float(_a0123.z)));
    _TMP28 = vec3(float(_TMP30.x), float(_TMP30.y), float(_TMP30.z));
    _TMP31 = dot(vec3(float(_TMP28.x), float(_TMP28.y), float(_TMP28.z)), vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _TMP29 = float(_TMP31);
    _x0127 = _lc2*_TMP29 + 3.24951172E-01;
    _TMP34 = min(2.50000000E-01, float(_x0127));
    _TMP33 = float(_TMP34);
    _TMP32 = max(-4.99877930E-02, float(_TMP33));
    _TMP126 = float(_TMP32);
    _TMP43 = _TMP96*_c10 + _TMP106*_c21 + _TMP116*_c12 + _TMP126*_c01 + ((((1.00000000E+00 - _TMP96) - _TMP106) - _TMP116) - _TMP126)*_c11;
    _ret_0 = vec4(_TMP43.x, _TMP43.y, _TMP43.z, 1.00000000E+00);
    FragColor = vec4(float(_ret_0.x), float(_ret_0.y), float(_ret_0.z), float(_ret_0.w));
    return;
} 
#endif
