// 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;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
float _placeholder26;
};
vec4 _oPosition1;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 gl_Vertex;
COMPAT_ATTRIBUTE vec4 COLOR;
COMPAT_VARYING vec4 COL0;
COMPAT_ATTRIBUTE vec4 gl_MultiTexCoord0;
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()
{
    vec4 _oColor;
    vec2 _oTexCoord;
    _r0006 = gl_Vertex.x*gl_ModelViewProjectionMatrix[0];
    _r0006 = _r0006 + gl_Vertex.y*gl_ModelViewProjectionMatrix[1];
    _r0006 = _r0006 + gl_Vertex.z*gl_ModelViewProjectionMatrix[2];
    _r0006 = _r0006 + gl_Vertex.w*gl_ModelViewProjectionMatrix[3];
    _oPosition1 = _r0006;
    _oColor = COLOR;
    _oTexCoord = gl_MultiTexCoord0.xy;
    gl_Position = _r0006;
    COL0 = COLOR;
    TEX0.xy = gl_MultiTexCoord0.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;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
float _placeholder27;
};
vec4 _ret_0;
vec2 _TMP3;
vec4 _TMP0;
input_dummy _IN1;
vec2 _x0026;
vec3 _mask0028;
vec2 _pos0028;
float _TMP29;
float _x0030;
COMPAT_VARYING vec4 TEX0;
 
uniform sampler2D Texture;
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, TEX0.xy);
    _x0026 = TEX0.xy*(TextureSize.xy/InputSize.xy)*OutputSize.xy;
    _TMP3 = floor(_x0026);
    _pos0028 = _TMP3 + vec2( 5.00000000E-01, 5.00000000E-01);
    _mask0028 = vec3( 5.00000000E-01, 5.00000000E-01, 5.00000000E-01);
    _pos0028.x = _pos0028.x + _pos0028.y*3.00000000E+00;
    _x0030 = _pos0028.x/6.00000000E+00;
    _TMP29 = fract(_x0030);
    if (_TMP29 < 3.33000004E-01) { 
        _mask0028.x = 1.50000000E+00;
    } else {
        if (_TMP29 < 6.66000009E-01) { 
            _mask0028.y = 1.50000000E+00;
        } else {
            _mask0028.z = 1.50000000E+00;
        } 
    } 
    _res = _TMP0.xyz*_mask0028;
    _ret_0 = vec4(_res.x, _res.y, _res.z, 1.00000000E+00);
    FragColor = _ret_0;
    return;
} 
#endif
