////////////////////////////////////////////////
//
// movie encoding
//
////////////////////////////////////////////////

lazyshader 0 "moviergb" [
    in vec4 vvertex;
    @(screentexcoord 0)
    out vec2 texcoord0;
    void main(void)
    {
        gl_Position = vvertex;
        texcoord0 = vtexcoord0; 
    }
] [
    uniform sampler2DRect tex0;
    in vec2 texcoord0;
    layout(location = 0) out vec4 fragcolor;
    void main(void)
    {
        fragcolor = texture2DRect(tex0, texcoord0);
    }
]

lazyshader 0 "movieyuv" [
    in vec4 vvertex;
    @(screentexcoord 0)
    out vec2 texcoord0;
    void main(void)
    {
        gl_Position = vvertex;
        texcoord0 = vtexcoord0; 
    }
] [
    uniform sampler2DRect tex0;
    in vec2 texcoord0;
    layout(location = 0) out vec4 fragcolor;
    void main(void)
    {
        vec3 color = texture2DRect(tex0, texcoord0).rgb;
        fragcolor = vec4(dot(color, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
                         dot(color, vec3(-0.148224, -0.290992, 0.439216)) + 0.501961,
                         dot(color, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
                         0.0);
    }
]

lazyshader 0 "moviey" [
    in vec4 vvertex;
    @(screentexcoord 0)
    out vec2 texcoord0;
    void main(void)
    {
        gl_Position = vvertex;
        texcoord0 = vtexcoord0 + vec2(0.5, 0.0);
    }
] [
    uniform sampler2DRect tex0;
    in vec2 texcoord0;
    layout(location = 0) out vec4 fragcolor;
    void main(void)
    {
        vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2( -2, 0)).rgb;
        vec3 color2 = texture2DRectOffset(tex0, texcoord0, ivec2( -1, 0)).rgb;
        vec3 color3 = texture2DRect(tex0, texcoord0).rgb;
        vec3 color4 = texture2DRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb;
        fragcolor = vec4(dot(color3, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
                         dot(color2, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
                         dot(color1, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
                         dot(color4, vec3(0.256788, 0.504125, 0.097905)) + 0.062745);
    }
]

lazyshader 0 "movieu" [
    in vec4 vvertex;
    @(screentexcoord 0)
    out vec2 texcoord0;
    void main(void)
    {
        gl_Position = vvertex;
        texcoord0 = vtexcoord0;
    }
] [
    uniform sampler2DRect tex0;
    in vec2 texcoord0;
    layout(location = 0) out vec4 fragcolor;
    void main(void)
    {
        vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2(-3, 0)).rgb;
        vec3 color2 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb;
        vec3 color3 = texture2DRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb;
        vec3 color4 = texture2DRectOffset(tex0, texcoord0, ivec2( 3, 0)).rgb;
        fragcolor = vec4(dot(color3, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
                         dot(color2, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
                         dot(color1, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
                         dot(color4, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961);
    }
]

lazyshader 0 "moviev" [
    in vec4 vvertex;
    @(screentexcoord 0)
    out vec2 texcoord0;
    void main(void)
    {
        gl_Position = vvertex;
        texcoord0 = vtexcoord0;
    }
] [
    uniform sampler2DRect tex0;
    in vec2 texcoord0;
    layout(location = 0) out vec4 fragcolor;
    void main(void)
    {
        vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2(-3, 0)).rgb;
        vec3 color2 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb;
        vec3 color3 = texture2DRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb;
        vec3 color4 = texture2DRectOffset(tex0, texcoord0, ivec2( 3, 0)).rgb;
        fragcolor = vec4(dot(color3, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
                         dot(color2, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
                         dot(color1, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
                         dot(color4, vec3(0.439216, -0.367788, -0.071427)) + 0.501961);
    }
]

