sampler colorMap;
float texelWeights[7];
float2 tapOffsets[3];
float invSumTexelWeight;

float4 Main(float2 tap0 : TEXCOORD0,
			float2 tap1 : TEXCOORD1,
			float2 tap2 : TEXCOORD2,
			float2 tap3 : TEXCOORD3,
			float2 tapNeg1 : TEXCOORD4,
			float2 tapNeg2 : TEXCOORD5,
			float2 tapNeg3 : TEXCOORD6) : COLOR
{			
	float4 color[7];
	
	color[0] = tex2D(colorMap, tap0);
	color[1] = tex2D(colorMap, tap1);
	color[2] = tex2D(colorMap, tap2);
	color[3] = tex2D(colorMap, tap3);
	color[4] = tex2D(colorMap, tapNeg1);
	color[5] = tex2D(colorMap, tapNeg2);
	color[6] = tex2D(colorMap, tapNeg3);
	
	float4 colorSum = 0.0f;
	
	colorSum = color[0] * texelWeights[0];
	colorSum += color[1] * texelWeights[1];
	colorSum += color[2] * texelWeights[2];
	colorSum += color[3] * texelWeights[3];
	colorSum += color[4] * texelWeights[1];
	colorSum += color[5] * texelWeights[2];
	colorSum += color[6] * texelWeights[3];
	
	float2 tap4 = tap0 + tapOffsets[0];
	float2 tap5 = tap0 + tapOffsets[1];
	float2 tap6 = tap0 + tapOffsets[2];
	float2 tapNeg4 = tap0 - tapOffsets[0];
	float2 tapNeg5 = tap0 - tapOffsets[1];
	float2 tapNeg6 = tap0 - tapOffsets[2];
	
	color[0] = tex2D(colorMap, tap4);
	color[1] = tex2D(colorMap, tap5);
	color[2] = tex2D(colorMap, tap6);
	color[3] = tex2D(colorMap, tapNeg4);
	color[4] = tex2D(colorMap, tapNeg5);
	color[5] = tex2D(colorMap, tapNeg6);
	
	colorSum += color[0] * texelWeights[4];
	colorSum += color[1] * texelWeights[5];
	colorSum += color[2] * texelWeights[6];
	colorSum += color[3] * texelWeights[4];
	colorSum += color[4] * texelWeights[5];
	colorSum += color[5] * texelWeights[6];
					
	colorSum *= invSumTexelWeight;
	
	return colorSum;
		
}
