// 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 _t7;
COMPAT_VARYING     vec4 _t6;
COMPAT_VARYING     vec4 _t5;
COMPAT_VARYING     vec4 _t4;
COMPAT_VARYING     vec4 _t3;
COMPAT_VARYING     vec4 _t2;
COMPAT_VARYING     vec4 _t1;
COMPAT_VARYING     vec2 _texCoord2;
COMPAT_VARYING     vec4 _color1;
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;
    vec4 _color1;
    vec2 _texCoord2;
    vec4 _t1;
    vec4 _t2;
    vec4 _t3;
    vec4 _t4;
    vec4 _t5;
    vec4 _t6;
    vec4 _t7;
};
out_vertex _ret_0;
input_dummy _IN1;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 COLOR;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 COL0;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec4 TEX2;
COMPAT_VARYING vec4 TEX3;
COMPAT_VARYING vec4 TEX4;
COMPAT_VARYING vec4 TEX5;
COMPAT_VARYING vec4 TEX6;
COMPAT_VARYING vec4 TEX7;
 
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()
{
    out_vertex _OUT;
    vec2 _ps;
    vec2 _texCoord;
    _r0006 = VertexCoord.x*MVPMatrix[0];
    _r0006 = _r0006 + VertexCoord.y*MVPMatrix[1];
    _r0006 = _r0006 + VertexCoord.z*MVPMatrix[2];
    _r0006 = _r0006 + VertexCoord.w*MVPMatrix[3];
    _ps = vec2(1.00000000E+00/TextureSize.x, 1.00000000E+00/TextureSize.y);
    _texCoord = TexCoord.xy + vec2( 1.00000001E-07, 1.00000001E-07);
    _OUT._t1 = _texCoord.xxxy + vec4(-_ps.x, 0.00000000E+00, _ps.x, -2.00000000E+00*_ps.y);
    _OUT._t2 = _texCoord.xxxy + vec4(-_ps.x, 0.00000000E+00, _ps.x, -_ps.y);
    _OUT._t3 = _texCoord.xxxy + vec4(-_ps.x, 0.00000000E+00, _ps.x, 0.00000000E+00);
    _OUT._t4 = _texCoord.xxxy + vec4(-_ps.x, 0.00000000E+00, _ps.x, _ps.y);
    _OUT._t5 = _texCoord.xxxy + vec4(-_ps.x, 0.00000000E+00, _ps.x, 2.00000000E+00*_ps.y);
    _OUT._t6 = _texCoord.xyyy + vec4(-2.00000000E+00*_ps.x, -_ps.y, 0.00000000E+00, _ps.y);
    _OUT._t7 = _texCoord.xyyy + vec4(2.00000000E+00*_ps.x, -_ps.y, 0.00000000E+00, _ps.y);
    _ret_0._position1 = _r0006;
    _ret_0._color1 = COLOR;
    _ret_0._texCoord2 = _texCoord;
    _ret_0._t1 = _OUT._t1;
    _ret_0._t2 = _OUT._t2;
    _ret_0._t3 = _OUT._t3;
    _ret_0._t4 = _OUT._t4;
    _ret_0._t5 = _OUT._t5;
    _ret_0._t6 = _OUT._t6;
    _ret_0._t7 = _OUT._t7;
    gl_Position = _r0006;
    COL0 = COLOR;
    TEX0.xy = _texCoord;
    TEX1 = _OUT._t1;
    TEX2 = _OUT._t2;
    TEX3 = _OUT._t3;
    TEX4 = _OUT._t4;
    TEX5 = _OUT._t5;
    TEX6 = _OUT._t6;
    TEX7 = _OUT._t7;
    return;
    COL0 = _ret_0._color1;
    TEX0.xy = _ret_0._texCoord2;
    TEX1 = _ret_0._t1;
    TEX2 = _ret_0._t2;
    TEX3 = _ret_0._t3;
    TEX4 = _ret_0._t4;
    TEX5 = _ret_0._t5;
    TEX6 = _ret_0._t6;
    TEX7 = _ret_0._t7;
} 
#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 _t7;
COMPAT_VARYING     vec4 _t6;
COMPAT_VARYING     vec4 _t5;
COMPAT_VARYING     vec4 _t4;
COMPAT_VARYING     vec4 _t3;
COMPAT_VARYING     vec4 _t21;
COMPAT_VARYING     vec4 _t11;
COMPAT_VARYING     vec2 _texCoord;
COMPAT_VARYING     vec4 _color;
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 _color;
    vec2 _texCoord;
    vec4 _t11;
    vec4 _t21;
    vec4 _t3;
    vec4 _t4;
    vec4 _t5;
    vec4 _t6;
    vec4 _t7;
};
vec4 _ret_0;
vec3 _TMP14;
vec3 _TMP13;
vec3 _TMP12;
vec3 _TMP11;
vec3 _TMP10;
vec4 _TMP9;
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 _x0023;
vec3 _TMP190043[4];
vec3 _m0043;
vec3 _t0043;
vec3 _TMP52;
vec3 _a0053;
vec3 _TMP190059[4];
vec3 _m0059;
vec3 _t0059;
vec3 _TMP68;
vec3 _a0069;
vec3 _x0075;
vec3 _TMP76;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec4 TEX2;
COMPAT_VARYING vec4 TEX3;
COMPAT_VARYING vec4 TEX4;
COMPAT_VARYING vec4 TEX5;
COMPAT_VARYING vec4 TEX6;
COMPAT_VARYING vec4 TEX7;
 
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    vec2 _fp;
    _x0023 = TEX0.xy*TextureSize;
    _TMP0 = fract(_x0023);
    _fp = 2.00000000E+00*_TMP0 - 1.00000000E+00;
    _TMP1 = COMPAT_TEXTURE(Texture, TEX1.yw);
    _TMP2 = COMPAT_TEXTURE(Texture, TEX2.yw);
    _TMP3 = COMPAT_TEXTURE(Texture, TEX3.xw);
    _TMP4 = COMPAT_TEXTURE(Texture, TEX3.yw);
    _TMP5 = COMPAT_TEXTURE(Texture, TEX3.zw);
    _TMP6 = COMPAT_TEXTURE(Texture, TEX4.yw);
    _TMP7 = COMPAT_TEXTURE(Texture, TEX5.yw);
    _TMP8 = COMPAT_TEXTURE(Texture, TEX6.xz);
    _TMP9 = COMPAT_TEXTURE(Texture, TEX7.xz);
    _TMP190043[0] = _TMP2.xyz - _TMP1.xyz;
    _TMP190043[1] = _TMP4.xyz - _TMP2.xyz;
    _TMP190043[2] = _TMP6.xyz - _TMP4.xyz;
    _TMP190043[3] = _TMP7.xyz - _TMP6.xyz;
    _m0043 = vec3(_TMP4.x < 5.00000000E-01 ? _TMP4.x : (1.00000000E+00 - _TMP4.xyz).x, _TMP4.y < 5.00000000E-01 ? _TMP4.y : (1.00000000E+00 - _TMP4.xyz).y, _TMP4.z < 5.00000000E-01 ? _TMP4.z : (1.00000000E+00 - _TMP4.xyz).z);
    _TMP10 = abs(_TMP190043[1]);
    _TMP11 = abs(_TMP190043[2]);
    _TMP12 = min(_TMP10, _TMP11);
    _TMP13 = min(_m0043, _TMP12);
    _m0043 = 2.00000000E+00*_TMP13;
    _t0043 = (7.00000000E+00*(_TMP190043[1] + _TMP190043[2]) - 3.00000000E+00*(_TMP190043[0] + _TMP190043[3]))/1.60000000E+01;
    _a0053 = -_m0043;
    _TMP14 = min(_m0043, _t0043);
    _TMP52 = max(_a0053, _TMP14);
    _TMP190059[0] = _TMP3.xyz - _TMP8.xyz;
    _TMP190059[1] = _TMP4.xyz - _TMP3.xyz;
    _TMP190059[2] = _TMP5.xyz - _TMP4.xyz;
    _TMP190059[3] = _TMP9.xyz - _TMP5.xyz;
    _m0059 = vec3(_TMP4.x < 5.00000000E-01 ? _TMP4.x : (1.00000000E+00 - _TMP4.xyz).x, _TMP4.y < 5.00000000E-01 ? _TMP4.y : (1.00000000E+00 - _TMP4.xyz).y, _TMP4.z < 5.00000000E-01 ? _TMP4.z : (1.00000000E+00 - _TMP4.xyz).z);
    _TMP10 = abs(_TMP190059[1]);
    _TMP11 = abs(_TMP190059[2]);
    _TMP12 = min(_TMP10, _TMP11);
    _TMP13 = min(_m0059, _TMP12);
    _m0059 = 2.00000000E+00*_TMP13;
    _t0059 = (7.00000000E+00*(_TMP190059[1] + _TMP190059[2]) - 3.00000000E+00*(_TMP190059[0] + _TMP190059[3]))/1.60000000E+01;
    _a0069 = -_m0059;
    _TMP14 = min(_m0059, _t0059);
    _TMP68 = max(_a0069, _TMP14);
    _x0075 = _TMP4.xyz + _fp.y*_TMP52 + _fp.x*_TMP68;
    _TMP14 = min(vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0075);
    _TMP76 = max(vec3( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP14);
    _ret_0 = vec4(_TMP76.x, _TMP76.y, _TMP76.z, 1.00000000E+00);
    FragColor = _ret_0;
    return;
} 
#endif
