// 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 _texCoord2;
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;
    vec2 _texCoord2;
    vec4 _t1;
};
out_vertex _ret_0;
input_dummy _IN1;
vec4 _r0008;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
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;
    _r0008 = VertexCoord.x*MVPMatrix[0];
    _r0008 = _r0008 + VertexCoord.y*MVPMatrix[1];
    _r0008 = _r0008 + VertexCoord.z*MVPMatrix[2];
    _r0008 = _r0008 + 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.xy = vec2(0.00000000E+00, -_ps.y);
    _OUT._t1.zw = vec2(-_ps.x, 0.00000000E+00);
    _ret_0._position1 = _r0008;
    _ret_0._texCoord2 = _texCoord;
    _ret_0._t1 = _OUT._t1;
    gl_Position = _r0008;
    TEX0.xy = _texCoord;
    TEX1 = _OUT._t1;
    return;
    TEX0.xy = _ret_0._texCoord2;
    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 _texCoord;
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 {
    vec2 _texCoord;
    vec4 _t1;
};
vec4 _ret_0;
vec3 _TMP29;
vec3 _TMP30;
float _TMP26;
float _TMP25;
bool _TMP24;
bool _TMP23;
bool _TMP22;
bool _TMP21;
bool _TMP20;
bool _TMP19;
bool _TMP18;
bool _TMP17;
bool _TMP16;
bool _TMP15;
bool _TMP14;
float _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;
vec2 _TMP0;
uniform sampler2D Texture;
input_dummy _IN1;
vec2 _x0043;
vec2 _val0045;
vec2 _c0047;
vec2 _c0049;
vec2 _c0051;
vec2 _c0055;
vec2 _c0057;
vec2 _c0059;
vec2 _c0061;
vec2 _c0063;
vec2 _c0065;
vec2 _c0067;
vec2 _c0069;
float _TMP70;
float _TMP74;
float _TMP78;
float _TMP82;
float _TMP86;
float _TMP90;
float _TMP94;
float _TMP98;
float _TMP102;
float _TMP106;
float _TMP110;
float _TMP114;
float _TMP122;
float _a0125;
float _TMP128;
float _a0131;
float _TMP134;
float _a0137;
float _TMP140;
float _a0143;
float _TMP146;
float _a0149;
float _TMP152;
float _a0155;
float _TMP158;
float _a0161;
float _TMP164;
float _a0167;
float _TMP170;
float _a0173;
float _TMP176;
float _a0179;
float _TMP182;
float _a0185;
float _TMP188;
float _a0191;
float _TMP192;
float _a0195;
float _TMP196;
float _a0199;
float _TMP200;
float _a0203;
float _TMP204;
float _a0207;
float _TMP210;
float _a0213;
float _TMP214;
float _a0217;
float _TMP218;
float _a0221;
float _TMP222;
float _a0225;
float _TMP226;
float _a0229;
float _TMP230;
float _a0233;
float _TMP234;
float _a0237;
COMPAT_VARYING vec4 TEX0;
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()
{
    bool _edr;
    bool _px;
    bool _interp_restriction_lv1;
    bool _nc;
    bool _fx;
    vec2 _pos;
    vec2 _dir;
    vec2 _g1;
    vec2 _g2;
    _x0043 = TEX0.xy*TextureSize;
    _TMP0 = fract(_x0043);
    _pos = _TMP0 - vec2( 5.00000000E-01, 5.00000000E-01);
    _val0045 = vec2(float((_pos.x > 0.00000000E+00)), float((_pos.y > 0.00000000E+00)));
    _dir = _val0045 - vec2(float((_pos.x < 0.00000000E+00)), float((_pos.y < 0.00000000E+00)));
    _g1 = _dir*TEX1.xy;
    _g2 = _dir*TEX1.zw;
    _c0047 = TEX0.xy + _g1;
    _TMP1 = COMPAT_TEXTURE(Texture, _c0047);
    _c0049 = (TEX0.xy + _g1) - _g2;
    _TMP2 = COMPAT_TEXTURE(Texture, _c0049);
    _c0051 = TEX0.xy + _g2;
    _TMP3 = COMPAT_TEXTURE(Texture, _c0051);
    _TMP4 = COMPAT_TEXTURE(Texture, TEX0.xy);
    _c0055 = TEX0.xy - _g2;
    _TMP5 = COMPAT_TEXTURE(Texture, _c0055);
    _c0057 = (TEX0.xy - _g1) + _g2;
    _TMP6 = COMPAT_TEXTURE(Texture, _c0057);
    _c0059 = TEX0.xy - _g1;
    _TMP7 = COMPAT_TEXTURE(Texture, _c0059);
    _c0061 = (TEX0.xy - _g1) - _g2;
    _TMP8 = COMPAT_TEXTURE(Texture, _c0061);
    _c0063 = TEX0.xy - 2.00000000E+00*_g2;
    _TMP9 = COMPAT_TEXTURE(Texture, _c0063);
    _c0065 = (TEX0.xy - _g1) - 2.00000000E+00*_g2;
    _TMP10 = COMPAT_TEXTURE(Texture, _c0065);
    _c0067 = TEX0.xy - 2.00000000E+00*_g1;
    _TMP11 = COMPAT_TEXTURE(Texture, _c0067);
    _c0069 = (TEX0.xy - 2.00000000E+00*_g1) - _g2;
    _TMP12 = COMPAT_TEXTURE(Texture, _c0069);
    _TMP70 = dot(_TMP1.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP74 = dot(_TMP2.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP78 = dot(_TMP3.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP82 = dot(_TMP4.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP86 = dot(_TMP5.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP90 = dot(_TMP6.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP94 = dot(_TMP7.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP98 = dot(_TMP8.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP102 = dot(_TMP10.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP106 = dot(_TMP12.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP110 = dot(_TMP11.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP114 = dot(_TMP9.xyz, vec3( 1.43519993E+01, 2.81760006E+01, 5.47200012E+00));
    _TMP13 = dot(_dir, _pos);
    _fx = _TMP13 > 5.00000000E-01;
    _a0125 = _TMP86 - _TMP70;
    _TMP122 = abs(_a0125);
    _TMP14 = _TMP122 < 1.50000000E+01;
    _a0131 = _TMP86 - _TMP74;
    _TMP128 = abs(_a0131);
    _TMP15 = _TMP128 < 1.50000000E+01;
    _a0137 = _TMP94 - _TMP78;
    _TMP134 = abs(_a0137);
    _TMP16 = _TMP134 < 1.50000000E+01;
    _a0143 = _TMP94 - _TMP90;
    _TMP140 = abs(_a0143);
    _TMP17 = _TMP140 < 1.50000000E+01;
    _a0149 = _TMP82 - _TMP98;
    _TMP146 = abs(_a0149);
    _TMP18 = _TMP146 < 1.50000000E+01;
    _a0155 = _TMP86 - _TMP114;
    _TMP152 = abs(_a0155);
    _TMP19 = _TMP152 < 1.50000000E+01;
    _a0161 = _TMP86 - _TMP102;
    _TMP158 = abs(_a0161);
    _TMP20 = _TMP158 < 1.50000000E+01;
    _a0167 = _TMP94 - _TMP110;
    _TMP164 = abs(_a0167);
    _TMP21 = _TMP164 < 1.50000000E+01;
    _a0173 = _TMP94 - _TMP106;
    _TMP170 = abs(_a0173);
    _TMP22 = _TMP170 < 1.50000000E+01;
    _a0179 = _TMP82 - _TMP90;
    _TMP176 = abs(_a0179);
    _TMP23 = _TMP176 < 1.50000000E+01;
    _a0185 = _TMP82 - _TMP74;
    _TMP182 = abs(_a0185);
    _TMP24 = _TMP182 < 1.50000000E+01;
    _interp_restriction_lv1 = _TMP82 != _TMP86 && _TMP82 != _TMP94 && (!_TMP14 && !_TMP15 || !_TMP16 && !_TMP17 || _TMP18 && (!_TMP19 && !_TMP20 || !_TMP21 && !_TMP22) || _TMP23 || _TMP24);
    _a0191 = _TMP82 - _TMP74;
    _TMP188 = abs(_a0191);
    _a0195 = _TMP82 - _TMP90;
    _TMP192 = abs(_a0195);
    _a0199 = _TMP98 - _TMP110;
    _TMP196 = abs(_a0199);
    _a0203 = _TMP98 - _TMP114;
    _TMP200 = abs(_a0203);
    _a0207 = _TMP94 - _TMP86;
    _TMP204 = abs(_a0207);
    _TMP25 = _TMP188 + _TMP192 + _TMP196 + _TMP200 + 4.00000000E+00*_TMP204;
    _a0213 = _TMP94 - _TMP78;
    _TMP210 = abs(_a0213);
    _a0217 = _TMP94 - _TMP106;
    _TMP214 = abs(_a0217);
    _a0221 = _TMP86 - _TMP102;
    _TMP218 = abs(_a0221);
    _a0225 = _TMP86 - _TMP70;
    _TMP222 = abs(_a0225);
    _a0229 = _TMP82 - _TMP98;
    _TMP226 = abs(_a0229);
    _TMP26 = _TMP210 + _TMP214 + _TMP218 + _TMP222 + 4.00000000E+00*_TMP226;
    _edr = _TMP25 < _TMP26 && _interp_restriction_lv1;
    _nc = _edr && _fx;
    _a0233 = _TMP82 - _TMP86;
    _TMP230 = abs(_a0233);
    _a0237 = _TMP82 - _TMP94;
    _TMP234 = abs(_a0237);
    _px = _TMP230 <= _TMP234;
    if (_nc) { 
        if (_px) { 
            _TMP30 = _TMP5.xyz;
        } else {
            _TMP30 = _TMP7.xyz;
        } 
        _TMP29 = _TMP30;
    } else {
        _TMP29 = _TMP4.xyz;
    } 
    _ret_0 = vec4(_TMP29.x, _TMP29.y, _TMP29.z, 1.00000000E+00);
    FragColor = _ret_0;
    return;
} 
#endif
