// 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 _color1;
struct output_dummy {
    vec4 _color1;
};
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
};
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     vec4 _color;
struct output_dummy {
    vec4 _color;
};
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
};
vec3 _TMP3;
vec3 _TMP9;
float _TMP7;
float _TMP6;
float _TMP5;
vec2 _TMP8;
vec4 _TMP0;
uniform sampler2D Texture;
input_dummy _IN1;
vec2 _x0024;
vec2 _TMP25;
vec2 _x0026;
vec2 _TMP31;
vec2 _x0032;
vec3 _a0040;
vec3 _b0040;
vec3 _TMP49;
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()
{
    vec3 _E;
    vec2 _fp;
    vec2 _ps;
    vec2 _f;
    float _max_coord;
    vec3 _res;
    output_dummy _OUT;
    _TMP0 = COMPAT_TEXTURE(Texture, TEX0.xy);
    _TMP5 = pow(_TMP0.x, 2.40000010E+00);
    _TMP6 = pow(_TMP0.y, 2.40000010E+00);
    _TMP7 = pow(_TMP0.z, 2.40000010E+00);
    _E = vec3(_TMP5, _TMP6, _TMP7);
    _x0024 = TEX0.xy*TextureSize;
    _fp = fract(_x0024);
    _ps = InputSize/OutputSize;
    _x0026 = _fp + 5.00000000E-01*_ps;
    _TMP8 = min(vec2( 1.00000000E+00, 1.00000000E+00), _x0026);
    _TMP25 = max(vec2( 0.00000000E+00, 0.00000000E+00), _TMP8);
    _x0032 = _TMP25 - 8.39999974E-01;
    _TMP8 = min(_ps.xx, _x0032);
    _TMP31 = max(vec2( 0.00000000E+00, 0.00000000E+00), _TMP8);
    _f = _TMP31/_ps;
    _max_coord = max(_f.x, _f.y);
    _a0040 = _E*(1.03999996E+00 + _fp.x*_fp.y);
    _b0040 = _E*3.60000014E-01;
    _res = _a0040 + _max_coord*(_b0040 - _a0040);
    _TMP5 = pow(_res.x, 4.54545438E-01);
    _TMP6 = pow(_res.y, 4.54545438E-01);
    _TMP7 = pow(_res.z, 4.54545438E-01);
    _TMP3 = vec3(_TMP5, _TMP6, _TMP7);
    _TMP9 = min(vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _TMP3);
    _TMP49 = max(vec3( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP9);
    _OUT._color = vec4(_TMP49.x, _TMP49.y, _TMP49.z, 1.00000000E+00);
    FragColor = _OUT._color;
    return;
} 
#endif
