// 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 _r0005;
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;
    _r0005 = VertexCoord.x*MVPMatrix[0];
    _r0005 = _r0005 + VertexCoord.y*MVPMatrix[1];
    _r0005 = _r0005 + VertexCoord.z*MVPMatrix[2];
    _r0005 = _r0005 + VertexCoord.w*MVPMatrix[3];
    _oPosition1 = _r0005;
    _oColor = COLOR;
    _otexCoord = TexCoord.xy;
    gl_Position = _r0005;
    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 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
uniform sampler2D Texture;
input_dummy _IN1;
vec2 _c0008;
vec2 _c0010;
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;
    vec2 _pixel;
    float _blendy;
    float _blenda;
    vec3 _pixel1;
    vec3 _pixel2;
    vec3 _pixel0;
    vec3 _pixelblend;
    float _gary1;
    float _gary2;
    float _mean;
    _OUT._color = COMPAT_TEXTURE(Texture, TEX0.xy);
    _pixel.x = 1.00000000E+00/InputSize.x;
    _c0008 = TEX0.xy + vec2(_pixel.x*1.50000006E-01, 0.00000000E+00);
    _TMP0 = COMPAT_TEXTURE(Texture, _c0008);
    _c0010 = TEX0.xy + vec2(-_pixel.x*2.19999999E-01, 0.00000000E+00);
    _TMP1 = COMPAT_TEXTURE(Texture, _c0010);
    _TMP2 = COMPAT_TEXTURE(Texture, TEX0.xy);
    _gary1 = dot(_TMP0.xyz, vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _gary2 = dot(_TMP1.xyz, vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _mean = _gary1 - _gary2;
    if (_mean < 0.00000000E+00) { 
        _mean = -_mean;
    } 
    if (_mean > 1.00000000E+00) { 
        _mean = 1.00000000E+00;
    } 
    _mean = pow(_mean, 6.89999998E-01);
    if (_mean > 1.00000000E+00) { 
        _mean = 1.00000000E+00;
    } 
    _blendy = 1.00000000E+00 - _mean;
    _blenda = 1.00000000E+00 - _blendy;
    _pixel0 = _TMP2.xyz/3.00000000E+00;
    _pixel1 = _TMP0.xyz/3.00000000E+00;
    _pixel2 = _TMP1.xyz/3.00000000E+00;
    _pixelblend.xyz = _pixel0 + _pixel1 + _pixel2;
    _OUT._color.xyz = _pixelblend.xyz*_blendy + _OUT._color.xyz*_blenda;
    FragColor = _OUT._color;
    return;
} 
#endif
