// 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 _tex_300;
COMPAT_VARYING     vec2 _tex_240;
COMPAT_VARYING     vec2 _tex_180;
COMPAT_VARYING     vec2 _tex_120;
COMPAT_VARYING     vec2 _tex_60;
COMPAT_VARYING     vec2 _tex_0;
COMPAT_VARYING     vec2 _tex_direct;
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 vert_out {
    vec2 _tex_direct;
    vec2 _tex_0;
    vec2 _tex_60;
    vec2 _tex_120;
    vec2 _tex_180;
    vec2 _tex_240;
    vec2 _tex_300;
};
vec4 _oPosition1;
float _TMP6;
float _TMP5;
float _TMP4;
float _TMP3;
float _TMP2;
input_dummy _TMP14;
input_dummy _IN1;
vec4 _r0019;
float _a0021;
vec2 _r0031;
vec2 _r0037;
vec2 _r0043;
vec2 _r0049;
vec2 _r0055;
vec2 _r0061;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
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()
{
    vert_out _verts;
    vec2 _one;
    float _scale;
    vec2 _TMP15[2];
    _r0019 = VertexCoord.x*MVPMatrix[0];
    _r0019 = _r0019 + VertexCoord.y*MVPMatrix[1];
    _r0019 = _r0019 + VertexCoord.z*MVPMatrix[2];
    _r0019 = _r0019 + VertexCoord.w*MVPMatrix[3];
    _oPosition1 = _r0019;
    _one = 1.00000000E+00/TextureSize;
    _TMP14._frame_count = float(FrameCount)/2.00000000E+01;
    _a0021 = 5.00000000E-01*_TMP14._frame_count;
    _TMP2 = sin(_a0021);
    _scale = 1.00000000E+00 + 2.00000003E-01*_TMP2;
    _TMP3 = cos(_TMP14._frame_count);
    _TMP4 = sin(_TMP14._frame_count);
    _TMP5 = sin(_TMP14._frame_count);
    _TMP6 = cos(_TMP14._frame_count);
    _TMP15[0] = _scale*vec2(_TMP3, _TMP4);
    _TMP15[1] = _scale*vec2(-_TMP5, _TMP6);
    _verts._tex_direct = TexCoord.xy;
    _r0031.x = dot(_TMP15[0], vec2( 1.00000000E+00, 0.00000000E+00));
    _r0031.y = dot(_TMP15[1], vec2( 1.00000000E+00, 0.00000000E+00));
    _verts._tex_0 = TexCoord.xy + _one*_r0031;
    _r0037.x = dot(_TMP15[0], vec2( 5.00000000E-01, 6.99999988E-01));
    _r0037.y = dot(_TMP15[1], vec2( 5.00000000E-01, 6.99999988E-01));
    _verts._tex_60 = TexCoord.xy + _one*_r0037;
    _r0043.x = dot(_TMP15[0], vec2( -5.00000000E-01, 6.99999988E-01));
    _r0043.y = dot(_TMP15[1], vec2( -5.00000000E-01, 6.99999988E-01));
    _verts._tex_120 = TexCoord.xy + _one*_r0043;
    _r0049.x = dot(_TMP15[0], vec2( -1.00000000E+00, 0.00000000E+00));
    _r0049.y = dot(_TMP15[1], vec2( -1.00000000E+00, 0.00000000E+00));
    _verts._tex_180 = TexCoord.xy + _one*_r0049;
    _r0055.x = dot(_TMP15[0], vec2( -5.00000000E-01, -6.99999988E-01));
    _r0055.y = dot(_TMP15[1], vec2( -5.00000000E-01, -6.99999988E-01));
    _verts._tex_240 = TexCoord.xy + _one*_r0055;
    _r0061.x = dot(_TMP15[0], vec2( 5.00000000E-01, -6.99999988E-01));
    _r0061.y = dot(_TMP15[1], vec2( 5.00000000E-01, -6.99999988E-01));
    _verts._tex_300 = TexCoord.xy + _one*_r0061;
    gl_Position = _r0019;
    TEX1.xy = TexCoord.xy;
    TEX2.xy = _verts._tex_0;
    TEX3.xy = _verts._tex_60;
    TEX4.xy = _verts._tex_120;
    TEX5.xy = _verts._tex_180;
    TEX6.xy = _verts._tex_240;
    TEX7.xy = _verts._tex_300;
} 
#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 _tex_300;
COMPAT_VARYING     vec2 _tex_240;
COMPAT_VARYING     vec2 _tex_180;
COMPAT_VARYING     vec2 _tex_120;
COMPAT_VARYING     vec2 _tex_60;
COMPAT_VARYING     vec2 _tex_0;
COMPAT_VARYING     vec2 _tex_direct;
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 vert_out {
    vec2 _tex_direct;
    vec2 _tex_0;
    vec2 _tex_60;
    vec2 _tex_120;
    vec2 _tex_180;
    vec2 _tex_240;
    vec2 _tex_300;
};
vec4 _ret_0;
float _TMP12;
float _TMP11;
float _TMP10;
float _TMP9;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
uniform sampler2D Texture;
vec4 _TMP48;
vec4 _x0049;
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()
{
    vec4 _tex_mid;
    vec4 _tex0;
    vec4 _tex60;
    vec4 _tex120;
    vec4 _tex180;
    vec4 _tex240;
    vec4 _tex300;
    vec4 _minimum;
    vec4 _maximum;
    vec4 _diff;
    _tex_mid = COMPAT_TEXTURE(Texture, TEX1.xy);
    _tex0 = COMPAT_TEXTURE(Texture, TEX2.xy);
    _tex60 = COMPAT_TEXTURE(Texture, TEX3.xy);
    _tex120 = COMPAT_TEXTURE(Texture, TEX4.xy);
    _tex180 = COMPAT_TEXTURE(Texture, TEX5.xy);
    _tex240 = COMPAT_TEXTURE(Texture, TEX6.xy);
    _tex300 = COMPAT_TEXTURE(Texture, TEX7.xy);
    _TMP0 = min(_tex0, _tex60);
    _TMP1 = min(_tex120, _tex180);
    _TMP2 = min(_TMP0, _TMP1);
    _TMP3 = min(_tex240, _tex300);
    _minimum = min(_TMP2, _TMP3);
    _TMP4 = max(_tex0, _tex60);
    _TMP5 = max(_tex120, _tex180);
    _TMP6 = max(_TMP4, _TMP5);
    _TMP7 = max(_tex240, _tex300);
    _maximum = max(_TMP6, _TMP7);
    _x0049 = -(_maximum - _minimum);
    _TMP9 = pow(2.71828198E+00, _x0049.x);
    _TMP10 = pow(2.71828198E+00, _x0049.y);
    _TMP11 = pow(2.71828198E+00, _x0049.z);
    _TMP12 = pow(2.71828198E+00, _x0049.w);
    _TMP48 = vec4(_TMP9, _TMP10, _TMP11, _TMP12);
    _diff = 1.00000000E+00 - _TMP48;
    _ret_0 = _tex_mid + 8.99999976E-01*(_diff - _tex_mid);
    FragColor = _ret_0;
    return;
} 
#endif
