// 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     float _frame_rotation;
COMPAT_VARYING     vec4 _color1;
struct output_dummy {
    vec4 _color1;
};
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
vec4 _oPosition1;
vec4 _r0007;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 COLOR;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 COL0;
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()
{
    vec4 _oColor;
    vec2 _otexCoord;
    _r0007 = VertexCoord.x*MVPMatrix[0];
    _r0007 = _r0007 + VertexCoord.y*MVPMatrix[1];
    _r0007 = _r0007 + VertexCoord.z*MVPMatrix[2];
    _r0007 = _r0007 + VertexCoord.w*MVPMatrix[3];
    _oPosition1 = _r0007;
    _oColor = COLOR;
    _otexCoord = TexCoord.xy;
    gl_Position = _r0007;
    COL0 = COLOR;
    TEX0.xy = TexCoord.xy;
} 
#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     float _frame_rotation;
COMPAT_VARYING     vec4 _color;
struct output_dummy {
    vec4 _color;
};
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
vec4 _TMP11;
vec4 _TMP10;
vec4 _TMP9;
vec4 _TMP8;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
float _TMP13;
float _TMP12;
input_dummy _IN1;
uniform sampler2D Texture;
float _TMP21;
float _x0022;
float _a0024;
float _a0026;
float _TMP27;
float _a0030;
float _a0032;
float _TMP33;
float _x0034;
float _a0036;
float _a0038;
float _TMP39;
float _x0040;
float _a0042;
float _a0044;
float _TMP45;
float _x0046;
float _a0048;
float _a0050;
float _TMP51;
float _a0054;
float _a0056;
float _TMP57;
float _x0058;
float _a0060;
float _a0062;
float _TMP63;
float _x0064;
float _a0066;
float _a0068;
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()
{
    vec2 _ps;
    vec2 _crd[16];
    vec3 _pix[16];
    vec2 _dx;
    vec2 _dy;
    vec2 _pixcoord;
    vec2 _fract;
    vec2 _coord0;
    output_dummy _OUT;
    vec3 _TMP18;
    _ps = vec2(9.99000013E-01/TextureSize.x, 9.99000013E-01/TextureSize.y);
    _dx = vec2(_ps.x, 0.00000000E+00);
    _dy = vec2(0.00000000E+00, _ps.y);
    _pixcoord = TEX0.xy/_ps;
    _fract = fract(_pixcoord);
    _coord0 = TEX0.xy - _fract*_ps;
    _crd[(4*0 + 0)] = _coord0 - _ps;
    _crd[(4*1 + 0)] = _crd[(4*0 + 0)] + _dx;
    _crd[(4*2 + 0)] = _crd[(4*1 + 0)] + _dx;
    _crd[(4*0 + 1)] = _crd[(4*0 + 0)] + _dy;
    _crd[(4*1 + 1)] = _crd[(4*0 + 1)] + _dx;
    _crd[(4*2 + 1)] = _crd[(4*1 + 1)] + _dx;
    _crd[(4*3 + 1)] = _crd[(4*2 + 1)] + _dx;
    _crd[(4*0 + 2)] = _crd[(4*0 + 1)] + _dy;
    _crd[(4*1 + 2)] = _crd[(4*0 + 2)] + _dx;
    _crd[(4*2 + 2)] = _crd[(4*1 + 2)] + _dx;
    _crd[(4*3 + 2)] = _crd[(4*2 + 2)] + _dx;
    _crd[(4*0 + 3)] = _crd[(4*0 + 2)] + _dy;
    _crd[(4*1 + 3)] = _crd[(4*0 + 3)] + _dx;
    _crd[(4*2 + 3)] = _crd[(4*1 + 3)] + _dx;
    _x0022 = 1.00000000E+00 + _fract.x;
    if (_x0022 == 0.00000000E+00) { 
        _TMP21 = 4.93480253E+00;
    } else {
        _a0024 = _x0022*1.57079637E+00;
        _TMP12 = sin(_a0024);
        _a0026 = _x0022*3.14159274E+00;
        _TMP13 = sin(_a0026);
        _TMP21 = (_TMP12*_TMP13)/(_x0022*_x0022);
    } 
    if (_fract.x == 0.00000000E+00) { 
        _TMP27 = 4.93480253E+00;
    } else {
        _a0030 = _fract.x*1.57079637E+00;
        _TMP12 = sin(_a0030);
        _a0032 = _fract.x*3.14159274E+00;
        _TMP13 = sin(_a0032);
        _TMP27 = (_TMP12*_TMP13)/(_fract.x*_fract.x);
    } 
    _x0034 = 1.00000000E+00 - _fract.x;
    if (_x0034 == 0.00000000E+00) { 
        _TMP33 = 4.93480253E+00;
    } else {
        _a0036 = _x0034*1.57079637E+00;
        _TMP12 = sin(_a0036);
        _a0038 = _x0034*3.14159274E+00;
        _TMP13 = sin(_a0038);
        _TMP33 = (_TMP12*_TMP13)/(_x0034*_x0034);
    } 
    _x0040 = 2.00000000E+00 - _fract.x;
    if (_x0040 == 0.00000000E+00) { 
        _TMP39 = 4.93480253E+00;
    } else {
        _a0042 = _x0040*1.57079637E+00;
        _TMP12 = sin(_a0042);
        _a0044 = _x0040*3.14159274E+00;
        _TMP13 = sin(_a0044);
        _TMP39 = (_TMP12*_TMP13)/(_x0040*_x0040);
    } 
    _x0046 = 1.00000000E+00 + _fract.y;
    if (_x0046 == 0.00000000E+00) { 
        _TMP45 = 4.93480253E+00;
    } else {
        _a0048 = _x0046*1.57079637E+00;
        _TMP12 = sin(_a0048);
        _a0050 = _x0046*3.14159274E+00;
        _TMP13 = sin(_a0050);
        _TMP45 = (_TMP12*_TMP13)/(_x0046*_x0046);
    } 
    if (_fract.y == 0.00000000E+00) { 
        _TMP51 = 4.93480253E+00;
    } else {
        _a0054 = _fract.y*1.57079637E+00;
        _TMP12 = sin(_a0054);
        _a0056 = _fract.y*3.14159274E+00;
        _TMP13 = sin(_a0056);
        _TMP51 = (_TMP12*_TMP13)/(_fract.y*_fract.y);
    } 
    _x0058 = 1.00000000E+00 - _fract.y;
    if (_x0058 == 0.00000000E+00) { 
        _TMP57 = 4.93480253E+00;
    } else {
        _a0060 = _x0058*1.57079637E+00;
        _TMP12 = sin(_a0060);
        _a0062 = _x0058*3.14159274E+00;
        _TMP13 = sin(_a0062);
        _TMP57 = (_TMP12*_TMP13)/(_x0058*_x0058);
    } 
    _x0064 = 2.00000000E+00 - _fract.y;
    if (_x0064 == 0.00000000E+00) { 
        _TMP63 = 4.93480253E+00;
    } else {
        _a0066 = _x0064*1.57079637E+00;
        _TMP12 = sin(_a0066);
        _a0068 = _x0064*3.14159274E+00;
        _TMP13 = sin(_a0068);
        _TMP63 = (_TMP12*_TMP13)/(_x0064*_x0064);
    } 
    _TMP0 = COMPAT_TEXTURE(Texture, _crd[(4*1 + 0)]);
    _TMP1 = COMPAT_TEXTURE(Texture, _crd[(4*2 + 0)]);
    _TMP2 = COMPAT_TEXTURE(Texture, _crd[(4*0 + 1)]);
    _TMP3 = COMPAT_TEXTURE(Texture, _crd[(4*1 + 1)]);
    _TMP4 = COMPAT_TEXTURE(Texture, _crd[(4*2 + 1)]);
    _TMP5 = COMPAT_TEXTURE(Texture, _crd[(4*3 + 1)]);
    _TMP6 = COMPAT_TEXTURE(Texture, _crd[(4*0 + 2)]);
    _TMP7 = COMPAT_TEXTURE(Texture, _crd[(4*1 + 2)]);
    _TMP8 = COMPAT_TEXTURE(Texture, _crd[(4*2 + 2)]);
    _TMP9 = COMPAT_TEXTURE(Texture, _crd[(4*3 + 2)]);
    _TMP10 = COMPAT_TEXTURE(Texture, _crd[(4*1 + 3)]);
    _TMP11 = COMPAT_TEXTURE(Texture, _crd[(4*2 + 3)]);
    _pix[(4*1 + 0)] = (_TMP0.xyz*_TMP27 + _TMP1.xyz*_TMP33)*_TMP45;
    _pix[(4*0 + 1)] = (_TMP2.xyz*_TMP21 + _TMP3.xyz*_TMP27 + _TMP4.xyz*_TMP33 + _TMP5.xyz*_TMP39)*_TMP51;
    _pix[(4*0 + 2)] = (_TMP6.xyz*_TMP21 + _TMP7.xyz*_TMP27 + _TMP8.xyz*_TMP33 + _TMP9.xyz*_TMP39)*_TMP57;
    _pix[(4*1 + 3)] = (_TMP10.xyz*_TMP27 + _TMP11.xyz*_TMP33)*_TMP63;
    _TMP18 = (_pix[(4*1 + 0)] + _pix[(4*0 + 1)] + _pix[(4*0 + 2)] + _pix[(4*1 + 3)])/((_TMP21 + _TMP27 + _TMP33 + _TMP39)*(_TMP45 + _TMP51 + _TMP57 + _TMP63) - (_TMP21 + _TMP39)*(_TMP45 + _TMP63));
    _OUT._color = vec4(_TMP18.x, _TMP18.y, _TMP18.z, 1.00000000E+00);
    FragColor = _OUT._color;
    return;
} 
#endif
