// 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;
};
vec4 _oPosition1;
COMPAT_VARYING float _colorPhase1;
input_dummy _IN1;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
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()
{
    vec2 _oTex;
    vec2 _pos;
    _r0006 = VertexCoord.x*MVPMatrix[0];
    _r0006 = _r0006 + VertexCoord.y*MVPMatrix[1];
    _r0006 = _r0006 + VertexCoord.z*MVPMatrix[2];
    _r0006 = _r0006 + VertexCoord.w*MVPMatrix[3];
    _oPosition1 = _r0006;
    _oTex = TexCoord.xy;
    _pos = (TexCoord.xy*OutputSize.xy*TextureSize.xy)/InputSize.xy - 5.00000000E-01;
    _colorPhase1 = 8.00000000E+00 + _pos.x + _pos.y*4.00000000E+00 + float(FrameCount)*4.00000000E+00;
    gl_Position = _r0006;
    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;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
vec4 _ret_0;
vec4 _TMP2;
float _TMP1;
float _TMP6;
float _TMP5;
float _TMP4;
float _TMP3;
uniform sampler2D Texture;
uniform sampler2D nestable;
COMPAT_VARYING float _colorPhase1;
float _a0013;
float _c0013;
float _a0015;
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 _c;
    vec2 _pixmapCoord;
    _c = COMPAT_TEXTURE(Texture, TEX0.xy);
    _pixmapCoord.x = _c.x*2.34375000E-01 + _c.y*7.50000000E-01 + 7.81250000E-03;
    _a0013 = _colorPhase1 + 5.00000000E-01;
    _a0015 = _a0013/1.20000000E+01;
    _TMP3 = abs(_a0015);
    _TMP4 = fract(_TMP3);
    _TMP5 = abs(1.20000000E+01);
    _c0013 = _TMP4*_TMP5;
    if (_a0013 < 0.00000000E+00) { 
        _TMP6 = -_c0013;
    } else {
        _TMP6 = _c0013;
    } 
    _TMP1 = floor(_TMP6);
    _pixmapCoord.y = 1.00000000E+00 - (_TMP1/9.60000000E+01 + _c.z*8.75000000E-01 + 5.20833349E-03);
    _TMP2 = COMPAT_TEXTURE(nestable, _pixmapCoord.xy);
    _ret_0 = vec4(_TMP2.x*1.37963128E+00 - 3.58725756E-01, _TMP2.x*1.37963128E+00 - 3.58725756E-01, _TMP2.x*1.37963128E+00 - 3.58725756E-01, _TMP2.x*1.37963128E+00 - 3.58725756E-01);
    FragColor = _ret_0;
    return;
} 
#endif
