
texture g_txSrcColor;
sampler2D g_samSrcColor;

float rnum=1;

float sinslow=0.01;
float timeraslow=0;
float waterline=0.6;

float4 Down( float2 Tex : TEXCOORD0 ) : COLOR0
{
    float4 Color;
        
    if (Tex.y>waterline)
    {
   	
   		// reflect underneath - but fade it out to black
   		
   		
    	Tex.y = (waterline - ((Tex.y-waterline)*1.2));
    				  			
    	Color = tex2D(g_samSrcColor, Tex);
    	// 4 samples to give it a blurred look	       
    	//Color += tex2D(g_samSrcColor, float2(Tex.x, Tex.y-0.002f)); 
    	//Color += tex2D(g_samSrcColor, float2(Tex.x, Tex.y-0.001f)); 	
    	//Color += tex2D(g_samSrcColor, float2(Tex.x, Tex.y+0.001f));
    	//Color += tex2D(g_samSrcColor, float2(Tex.x, Tex.y+0.002f)); 
    	
    	//Color = Color / 4.0f;
    	
    	Color = (Color * (Color+0.7f) * 1.5f);
    	
    	Color.r = (((Color.r+Color.g+Color.b)/1.0f)+Color.r)/5.0f;
    	Color.g = (((Color.r+Color.g+Color.b)/1.0f)+Color.g)/5.0f;
    	Color.b = (((Color.r+Color.g+Color.b)/1.0f)+Color.b)/5.0f;
    	
        
        
        Color.rgb = Color.rgb + ((Tex.y-waterline)*0.4f);

		Color.b = Color.b - 0.0f;
   		Color.g = Color.g - 0.02f;
   		Color.r = Color.r - 0.05f;
   		Color = Color * 1.0f;
   		
    }
    else
    {
    	 Color = tex2D( g_samSrcColor, Tex.xy);
   	}
   	
   	Color = (Color - 0.075f)*1.1f;
   	
 

   	
	Color.a = 1.0f;
   

    return Color;
}


technique PostProcess
{
    pass p1
    {
        VertexShader = null;
        PixelShader = compile ps_2_0 Down();
        ZEnable = false;
    }

}