varying vec2 texCoord;
varying vec4 flatvpos;
varying vec4 vpos;

uniform sampler2D colorMap;
uniform sampler2D depthMap;
uniform float testvalue;

varying vec4 glColor;

void main(void)
{
    

	float rdepth=texture2D(depthMap, vec2(flatvpos.x/1920.0f,flatvpos.y/1080.0f)).r;
	float gdepth=texture2D(depthMap, vec2(flatvpos.x/1920.0f,flatvpos.y/1080.0f)).g;
	float bdepth=texture2D(depthMap, vec2(flatvpos.x/1920.0f,flatvpos.y/1080.0f)).b;
	
    float scenedepth=rdepth*0.32/0.57;


    float f5depth=flatvpos.z;

    if (scenedepth>f5depth&&vpos.z<0.0f)
        gl_FragColor = vec4(glColor.rgb,0.75/2.7/1.2/2.4)*texture2D(colorMap, texCoord);
        
        
        
        
    else
        
        discard;
}
