//
//  Shader.fsh
//  NeoGeo
//
//  Created by dotemu on 30/01/12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#if GL_ES
precision highp float;
#endif

varying vec4 texCoordVarying;
varying vec2 screenPos;

uniform vec2 textureSize;
uniform vec2 sourceSize;
uniform vec2 screenSize;

uniform sampler2D sampler;

uniform sampler2D scanline_sampler;

void main(void) {
    vec4 source_pixel = texture2D(sampler, texCoordVarying.xy);
    vec2 scanline_xy = mod(screenPos, vec2(3.0, 6.0));

    vec4 scanline_pixel = texture2D(scanline_sampler, scanline_xy * vec2(1.0 / 8.0, 1.0 / 8.0));
    
    gl_FragColor = mix(source_pixel, scanline_pixel, scanline_pixel.a);
}
