struct C2E2f_Output { 
	float3 color: COLOR;
};



C2E2f_Output main (    float2 oPosition : TEXCOORD0,
	uniform sampler2D decal,			   
	uniform sampler2D decal2,
    uniform sampler2D decal3,
    uniform sampler1D bigray 
	) 
{


	C2E2f_Output OUT;


	float4 cl;

float4 cl2=tex2D (decal3,oPosition);
float dist2=(cl2.x+cl2.y*0.00390625f);
float dist=(cl2.x+cl2.y*0.00390625f)*2*tex1D (bigray,dist2);

cl2=tex2D (decal2,oPosition);
float th=(cl2.x+cl2.y*0.00390625f)*2*3.1415926535;


float2 oPosition3=float2 (dist*cos(th),dist*sin(th))+float2 (0.5f,0.5f);



OUT.color=tex2D (decal,oPosition3);
//OUT.color.x=oPosition3.x;
//OUT.color.y=oPosition3.y;
/*
OUT.color.y=dist;
OUT.color.x=dist;
OUT.color.z=dist;
*/
  /*
  OUT.color.x=1;
OUT.color.y=0;
OUT.color.z=0;*/
  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;




}
*/