// 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 _color;
COMPAT_VARYING     vec2 _texCoord1;
COMPAT_VARYING     vec4 _vpos1;
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 VERTEX_OUTPUT {
    vec4 _position1;
    vec4 _vpos1;
    vec2 _texCoord1;
};
struct output_dummy {
    vec4 _color;
};
VERTEX_OUTPUT _ret_0;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 TEX1;
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()
{
    _r0006 = VertexCoord.x*MVPMatrix[0];
    _r0006 = _r0006 + VertexCoord.y*MVPMatrix[1];
    _r0006 = _r0006 + VertexCoord.z*MVPMatrix[2];
    _r0006 = _r0006 + VertexCoord.w*MVPMatrix[3];
    _ret_0._position1 = _r0006;
    _ret_0._vpos1 = _r0006;
    _ret_0._texCoord1 = TexCoord.xy;
    gl_Position = _r0006;
    TEX1 = _r0006;
    TEX0.xy = TexCoord.xy;
    return;
    TEX1 = _ret_0._vpos1;
    TEX0.xy = _ret_0._texCoord1;
} 
#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 _color;
COMPAT_VARYING     vec2 _texCoord;
COMPAT_VARYING     vec4 _vpos;
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 VERTEX_OUTPUT {
    vec4 _vpos;
    vec2 _texCoord;
};
struct output_dummy {
    vec4 _color;
};
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
float _TMP4;
float _TMP1;
float _TMP3;
float _TMP2;
float _TMP0;
VERTEX_OUTPUT _TMP8;
uniform sampler2D Texture;
input_dummy _IN1;
float _TMP13;
float _x0014;
float _frame_cnt0020;
vec2 _constant10020;
float _constant20020;
float _x0028;
float _TMP29;
float _x0030;
vec2 _c0038;
vec2 _c0042;
COMPAT_VARYING vec4 TEX1;
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()
{
    output_dummy _OUT;
    float _f;
    vec4 _distortion2;
    _TMP8._vpos = TEX1/TEX1.w;
    _f = (1.00000000E+00 - _TMP8._vpos.x*_TMP8._vpos.x)*(1.00000000E+00 - _TMP8._vpos.y*_TMP8._vpos.y);
    _TMP0 = pow(_f, 4.39999998E-01);
    _x0014 = 8.00000012E-01*(_TMP0 - 1.59999996E-01);
    _TMP1 = min(1.00000000E+00, _x0014);
    _TMP13 = max(0.00000000E+00, _TMP1);
    _frame_cnt0020 = cos(float(FrameCount));
    _constant10020 = _frame_cnt0020*vec2( 1.29090910E+01, 7.82307663E+01);
    _constant20020 = (_frame_cnt0020*4.81344000E+05)/1.10000000E+01;
    _TMP2 = dot(TEX0.xy, _constant10020);
    _TMP3 = sin(_TMP2);
    _x0028 = _TMP3*_constant20020;
    _TMP4 = fract(_x0028);
    _x0030 = _TMP4 + 2.00000003E-01;
    _TMP1 = min(1.00000000E+00, _x0030);
    _TMP29 = max(0.00000000E+00, _TMP1);
    _c0038 = TEX0.xy + 1.95312500E-03;
    _TMP5 = COMPAT_TEXTURE(Texture, _c0038);
    _TMP6 = COMPAT_TEXTURE(Texture, TEX0.xy);
    _c0042 = TEX0.xy - 1.95312500E-03;
    _TMP7 = COMPAT_TEXTURE(Texture, _c0042);
    _distortion2 = vec4(_TMP5.x, _TMP6.y, _TMP7.z, 1.00000000E+00);
    _OUT._color = _TMP13*(_distortion2*_TMP29);
    FragColor = _OUT._color;
    return;
} 
#endif
