float4x4 matAll;
float FogStart;
float FogEnd;

struct VS_INPUT
{
  	float4 position  : POSITION;
   	float2 tex0 : TEXCOORD0;
};

struct VS_OUTPUT
{
     	float4 position: POSITION;
   	float2 tex0 : 	 TEXCOORD0;
	float fog: 	 TEXCOORD1;
};

VS_OUTPUT main( VS_INPUT IN )
{
	VS_OUTPUT OUT;
	OUT.position = mul( IN.position, matAll );
	OUT.tex0 = IN.tex0;
		float fogy=(OUT.position.z-FogStart)/(FogEnd-FogStart);
		if (fogy>1) {fogy=1;}
		OUT.fog=fogy;
  	return OUT;
}
