//------------------------------------
struct vertexOutput {
    float4 HPosition : POSITION;
    float2 UV	: TEXCOORD0;
    float2 Depth	: TEXCOORD1;
};


//------------------------------------
float4 PS_Depth(vertexOutput IN) : COLOR0
{
	float4 outDepth;
	outDepth.a = 1.0f;
	outDepth.x = floor(IN.Depth.x*127)/127;
	outDepth.y = floor((IN.Depth.x-outDepth.x)*127*127)/127;
	outDepth.z = 0;

    return IN.Depth.x;//outDepth;
}


//-----------------------------------
technique ShowTexture
{
    pass p0 
    {		
		VertexShader = NULL;
		PixelShader = compile ps_2_0 PS_Depth();
		
		// Just use the color
		ColorArg1[0] = Diffuse;
		AlphaArg1[0] = Diffuse;
		ColorOp[0] = SelectArg1;
		AlphaOp[1] = SelectArg1;
		
		CullMode = None;
		ZEnable = true;
		ZFunc = GREATEREQUAL;
		ZWriteEnable = false;
    }
}