struct C2E2f_Output { 
	float3 color: COLOR;
};



C2E2f_Output main (    float2 oPosition : TEXCOORD0,
	uniform sampler2D decal,			   
	uniform sampler2D decal2,			   

	
	uniform float alpha
 ) 
{


	C2E2f_Output OUT;

	
//float SAMPLES=8	
	
float2 velocity=tex2D(decal2,oPosition).xy*2;
float4 outcol=float4 (0,0,0,0);

if (length (velocity)>0.001) { 

velocity-=float2 (1,1);
//OUT.color=velocity.xyxy;	
float4 sm=float4 (0,0,0,0);
for (int t=0;t<12;t++) { 
float x=-0.1*float (t)/11.0f;
//x-=sm*34.1;
sm=tex2D(decal,oPosition+velocity*x)*(1.0f/11.0f);
outcol+=sm;

};




} else
outcol=tex2D(decal,oPosition);


OUT.color=outcol;

//OUT.color=tex2D(decal2,oPosition)*float4 (1,1,1,1);
//OUT.color+=tex2D(decal,oPosition)*float4 (0,1,0,1);
//OUT.color=float4 (1,0,1,1);

return OUT;




}









































/* 


  FRAGMENT ENV MAP 



  struct C2E2f_Output { 
	float4 color: COLOR;
};


C2E2f_Output main (    float2 oPosition : TEXCOORD0,
    float2 oPosition2 : TEXCOORD1,
	uniform sampler2D decal,			   
	uniform sampler2D decal2					   
				   ) 
{



	C2E2f_Output OUT;

//float fc=1;
//fc=position.x;
	//float2 norm;
	//norm.x=oNormal.x;
	//norm.y=oNormal.y;

OUT.color=tex2D (decal2,oPosition);

float dx=ddx(OUT.color.x);
float dy=ddx(OUT.color.x);

oPosition2.x+=dx*1;
oPosition2.y+=dy*1;


  OUT.color=tex2D (decal,oPosition2);




  
  
  //OUT.color.y=0;
//OUT.color.z=0;
//  OUT.color-=tex2D (decal,oPosition2);


	return OUT;




}
*/