// 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 _t1;
COMPAT_VARYING     vec2 _texCoord11;
COMPAT_VARYING     vec4 _color1;
COMPAT_VARYING     vec4 _position1;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
};
struct out_vertex {
    vec4 _position1;
    vec4 _color1;
    vec2 _texCoord11;
    vec4 _t1;
};
out_vertex _ret_0;
input_dummy _IN1;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 COLOR;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 COL0;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
 
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()
{
    out_vertex _OUT;
    vec2 _ps;
    vec2 _texCoord;
    _r0006 = VertexCoord.x*MVPMatrix[0];
    _r0006 = _r0006 + VertexCoord.y*MVPMatrix[1];
    _r0006 = _r0006 + VertexCoord.z*MVPMatrix[2];
    _r0006 = _r0006 + VertexCoord.w*MVPMatrix[3];
    _ps = vec2(1.00000000E+00/TextureSize.x, 1.00000000E+00/TextureSize.y);
    _texCoord = TexCoord.xy + vec2( 1.00000001E-07, 1.00000001E-07);
    _OUT._t1 = _texCoord.xyyy + vec4(0.00000000E+00, -_ps.y, 0.00000000E+00, _ps.y);
    _ret_0._position1 = _r0006;
    _ret_0._color1 = COLOR;
    _ret_0._texCoord11 = _texCoord;
    _ret_0._t1 = _OUT._t1;
    gl_Position = _r0006;
    COL0 = COLOR;
    TEX0.xy = _texCoord;
    TEX1 = _OUT._t1;
    return;
    COL0 = _ret_0._color1;
    TEX0.xy = _ret_0._texCoord11;
    TEX1 = _ret_0._t1;
} 
#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 _t1;
COMPAT_VARYING     vec2 _texCoord1;
COMPAT_VARYING     vec4 _color;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
};
struct out_vertex {
    vec4 _color;
    vec2 _texCoord1;
    vec4 _t1;
};
vec4 _ret_0;
bvec3 _TMP7;
bvec3 _TMP5;
bvec3 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
uniform sampler2D Texture;
vec3 _TMP21;
vec3 _a0024;
vec3 _TMP25;
vec3 _a0028;
vec3 _TMP31;
vec3 _a0034;
vec3 _TMP35;
vec3 _a0038;
vec3 _TMP41;
vec3 _a0044;
COMPAT_VARYING vec4 TEX1;
 
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    vec3 _res;
    _TMP0 = COMPAT_TEXTURE(Texture, TEX1.xy);
    _TMP1 = COMPAT_TEXTURE(Texture, TEX1.xz);
    _TMP2 = COMPAT_TEXTURE(Texture, TEX1.xw);
    _a0024 = _TMP0.xyz - _TMP2.xyz;
    _TMP21 = abs(_a0024);
    _TMP3 = bvec3(_TMP21.x <= 9.99999978E-03, _TMP21.y <= 9.99999978E-03, _TMP21.z <= 9.99999978E-03);
    _a0028 = _TMP1.xyz - _TMP2.xyz;
    _TMP25 = abs(_a0028);
    _a0034 = _TMP0.xyz - _TMP1.xyz;
    _TMP31 = abs(_a0034);
    _TMP5 = bvec3(_TMP31.x <= 9.99999978E-03, _TMP31.y <= 9.99999978E-03, _TMP31.z <= 9.99999978E-03);
    _a0038 = _TMP0.xyz - _TMP1.xyz;
    _TMP35 = abs(_a0038);
    _a0044 = _TMP1.xyz - _TMP2.xyz;
    _TMP41 = abs(_a0044);
    _TMP7 = bvec3(_TMP41.x <= 9.99999978E-03, _TMP41.y <= 9.99999978E-03, _TMP41.z <= 9.99999978E-03);
    _res = vec3(!_TMP3.x && (_TMP25.x <= 5.99999987E-02 && _TMP5.x || _TMP35.x <= 5.99999987E-02 && _TMP7.x) ? (5.00000000E-01*(_TMP0.xyz + _TMP2.xyz)).x : _TMP1.x, !_TMP3.y && (_TMP25.y <= 5.99999987E-02 && _TMP5.y || _TMP35.y <= 5.99999987E-02 && _TMP7.y) ? (5.00000000E-01*(_TMP0.xyz + _TMP2.xyz)).y : _TMP1.y, !_TMP3.z && (_TMP25.z <= 5.99999987E-02 && _TMP5.z || _TMP35.z <= 5.99999987E-02 && _TMP7.z) ? (5.00000000E-01*(_TMP0.xyz + _TMP2.xyz)).z : _TMP1.z);
    _ret_0 = vec4(_res.x, _res.y, _res.z, 1.00000000E+00);
    FragColor = _ret_0;
    return;
} 
#endif
