// 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 _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 _texCoord;
    vec4 _t1;
    vec4 _t2;
    vec4 _t3;
    vec4 _t4;
};
out_vertex _ret_0;
input_dummy _IN1;
vec4 _r0008;
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;
 
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()
{
    vec2 _ps;
    vec2 _tex;
    out_vertex _TMP4;
    _ps = 1.00000000E+00/TextureSize;
    _tex = TexCoord.xy + vec2( 1.00000001E-07, 1.00000001E-07);
    _r0008 = VertexCoord.x*MVPMatrix[0];
    _r0008 = _r0008 + VertexCoord.y*MVPMatrix[1];
    _r0008 = _r0008 + VertexCoord.z*MVPMatrix[2];
    _r0008 = _r0008 + VertexCoord.w*MVPMatrix[3];
    _TMP4._t1 = _tex.xxyy + vec4(-_ps.x, 0.00000000E+00, -_ps.y, 0.00000000E+00);
    _TMP4._t2 = _tex.xxyy + vec4(_ps.x, 2.00000000E+00*_ps.x, -_ps.y, 0.00000000E+00);
    _TMP4._t3 = _tex.xxyy + vec4(-_ps.x, 0.00000000E+00, _ps.y, 2.00000000E+00*_ps.y);
    _TMP4._t4 = _tex.xxyy + vec4(_ps.x, 2.00000000E+00*_ps.x, _ps.y, 2.00000000E+00*_ps.y);
    _ret_0._position1 = _r0008;
    _ret_0._color1 = COLOR;
    _ret_0._texCoord = _tex;
    _ret_0._t1 = _TMP4._t1;
    _ret_0._t2 = _TMP4._t2;
    _ret_0._t3 = _TMP4._t3;
    _ret_0._t4 = _TMP4._t4;
    gl_Position = _r0008;
    COL0 = COLOR;
    TEX0.xy = _tex;
    TEX1 = _TMP4._t1;
    TEX2 = _TMP4._t2;
    TEX3 = _TMP4._t3;
    TEX4 = _TMP4._t4;
    return;
    COL0 = _ret_0._color1;
    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 _t2;
COMPAT_VARYING     vec4 _t1;
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 _t1;
    vec4 _t2;
    vec4 _t3;
    vec4 _t4;
};
vec4 _ret_0;
float _TMP18;
float _TMP17;
vec4 _TMP15;
vec4 _TMP14;
vec4 _TMP13;
vec4 _TMP12;
vec4 _TMP11;
vec4 _TMP10;
vec4 _TMP9;
vec4 _TMP8;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
vec4 _TMP20;
vec4 _TMP19;
float _TMP24;
float _TMP23;
float _TMP22;
float _TMP21;
uniform sampler2D Texture;
input_dummy _IN1;
vec2 _x0034;
vec4 _x0036;
vec4 _res0036;
vec4 _x0038;
vec4 _x0048;
vec4 _x0058;
vec4 _res0058;
vec4 _x0060;
vec4 _x0070;
vec3 _r0112;
vec3 _r0114;
vec3 _r0116;
vec3 _r0118;
vec3 _r0120;
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()
{
    vec2 _fract;
    vec3 _TMP28;
    vec3 _TMP29[4];
    vec3 _TMP32[4];
    _x0034 = TEX0.xy*TextureSize;
    _fract = fract(_x0034);
    _x0036 = vec4(1.00000000E+00 + _fract.x, _fract.x, 1.00000000E+00 - _fract.x, 2.00000000E+00 - _fract.x);
    _x0038 = _x0036*1.57079637E+00;
    _TMP21 = sin(_x0038.x);
    _TMP22 = sin(_x0038.y);
    _TMP23 = sin(_x0038.z);
    _TMP24 = sin(_x0038.w);
    _TMP19 = vec4(_TMP21, _TMP22, _TMP23, _TMP24);
    _x0048 = _x0036*3.14159274E+00;
    _TMP21 = sin(_x0048.x);
    _TMP22 = sin(_x0048.y);
    _TMP23 = sin(_x0048.z);
    _TMP24 = sin(_x0048.w);
    _TMP20 = vec4(_TMP21, _TMP22, _TMP23, _TMP24);
    _res0036 = vec4(_x0036.x == 0.00000000E+00 ? 4.93480253E+00 : ((_TMP19*_TMP20)/(_x0036*_x0036)).x, _x0036.y == 0.00000000E+00 ? 4.93480253E+00 : ((_TMP19*_TMP20)/(_x0036*_x0036)).y, _x0036.z == 0.00000000E+00 ? 4.93480253E+00 : ((_TMP19*_TMP20)/(_x0036*_x0036)).z, _x0036.w == 0.00000000E+00 ? 4.93480253E+00 : ((_TMP19*_TMP20)/(_x0036*_x0036)).w);
    _x0058 = vec4(1.00000000E+00 + _fract.y, _fract.y, 1.00000000E+00 - _fract.y, 2.00000000E+00 - _fract.y);
    _x0060 = _x0058*1.57079637E+00;
    _TMP21 = sin(_x0060.x);
    _TMP22 = sin(_x0060.y);
    _TMP23 = sin(_x0060.z);
    _TMP24 = sin(_x0060.w);
    _TMP19 = vec4(_TMP21, _TMP22, _TMP23, _TMP24);
    _x0070 = _x0058*3.14159274E+00;
    _TMP21 = sin(_x0070.x);
    _TMP22 = sin(_x0070.y);
    _TMP23 = sin(_x0070.z);
    _TMP24 = sin(_x0070.w);
    _TMP20 = vec4(_TMP21, _TMP22, _TMP23, _TMP24);
    _res0058 = vec4(_x0058.x == 0.00000000E+00 ? 4.93480253E+00 : ((_TMP19*_TMP20)/(_x0058*_x0058)).x, _x0058.y == 0.00000000E+00 ? 4.93480253E+00 : ((_TMP19*_TMP20)/(_x0058*_x0058)).y, _x0058.z == 0.00000000E+00 ? 4.93480253E+00 : ((_TMP19*_TMP20)/(_x0058*_x0058)).z, _x0058.w == 0.00000000E+00 ? 4.93480253E+00 : ((_TMP19*_TMP20)/(_x0058*_x0058)).w);
    _TMP0 = COMPAT_TEXTURE(Texture, TEX1.xz);
    _TMP1 = COMPAT_TEXTURE(Texture, TEX1.yz);
    _TMP2 = COMPAT_TEXTURE(Texture, TEX2.xz);
    _TMP3 = COMPAT_TEXTURE(Texture, TEX2.yz);
    _TMP4 = COMPAT_TEXTURE(Texture, TEX1.xw);
    _TMP5 = COMPAT_TEXTURE(Texture, TEX0.xy);
    _TMP6 = COMPAT_TEXTURE(Texture, TEX2.xw);
    _TMP7 = COMPAT_TEXTURE(Texture, TEX2.yw);
    _TMP8 = COMPAT_TEXTURE(Texture, TEX3.xz);
    _TMP9 = COMPAT_TEXTURE(Texture, TEX3.yz);
    _TMP10 = COMPAT_TEXTURE(Texture, TEX4.xz);
    _TMP11 = COMPAT_TEXTURE(Texture, TEX4.yz);
    _TMP12 = COMPAT_TEXTURE(Texture, TEX3.xw);
    _TMP13 = COMPAT_TEXTURE(Texture, TEX3.yw);
    _TMP14 = COMPAT_TEXTURE(Texture, TEX4.xw);
    _TMP15 = COMPAT_TEXTURE(Texture, TEX4.yw);
    _TMP32[0] = -_TMP0.xyz;
    _TMP32[3] = -_TMP3.xyz;
    _r0112 = _res0036.x*_TMP32[0];
    _r0112 = _r0112 + _res0036.y*_TMP1.xyz;
    _r0112 = _r0112 + _res0036.z*_TMP2.xyz;
    _r0112 = _r0112 + _res0036.w*_TMP32[3];
    _r0114 = _res0036.x*_TMP4.xyz;
    _r0114 = _r0114 + _res0036.y*_TMP5.xyz;
    _r0114 = _r0114 + _res0036.z*_TMP6.xyz;
    _r0114 = _r0114 + _res0036.w*_TMP7.xyz;
    _r0116 = _res0036.x*_TMP8.xyz;
    _r0116 = _r0116 + _res0036.y*_TMP9.xyz;
    _r0116 = _r0116 + _res0036.z*_TMP10.xyz;
    _r0116 = _r0116 + _res0036.w*_TMP11.xyz;
    _TMP29[0] = -_TMP12.xyz;
    _TMP29[3] = -_TMP15.xyz;
    _r0118 = _res0036.x*_TMP29[0];
    _r0118 = _r0118 + _res0036.y*_TMP13.xyz;
    _r0118 = _r0118 + _res0036.z*_TMP14.xyz;
    _r0118 = _r0118 + _res0036.w*_TMP29[3];
    _r0120 = _res0058.x*_r0112;
    _r0120 = _r0120 + _res0058.y*_r0114;
    _r0120 = _r0120 + _res0058.z*_r0116;
    _r0120 = _r0120 + _res0058.w*_r0118;
    _TMP17 = dot(_res0036, vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _TMP18 = dot(_res0058, vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _TMP28 = _r0120/(_TMP17*_TMP18 - 2.00000000E+00*(_res0036.x + _res0036.w)*(_res0058.x + _res0058.w));
    _ret_0 = vec4(_TMP28.x, _TMP28.y, _TMP28.z, 1.00000000E+00);
    FragColor = _ret_0;
    return;
} 
#endif
