//++++++++++++++++++++++++++++++++++++++++++++
// ENBSeries effect file
// visit http://enbdev.com for updates
// Copyright 2012-2013 © Vlad Loginoff 
//++++++++++++++++++++++++++++++++++++++++++++
struct VS_OUTPUT_POST
{
float4 vpos  : POSITION;
float2 txcoord0 : TEXCOORD0;
};
struct VS_INPUT_POST
{
float3 pos  : POSITION;
float2 txcoord0 : TEXCOORD0;
};

float4    _c44 : register(c44);		float4    _c66 : register(c66);
float4    _c72 : register(c72);		float4    _c73 : register(c73);
float4    _c74 : register(c74);		float4    _c75 : register(c75);
float4    _c76 : register(c76);		float4    _c77 : register(c77);

float4    _c78 : register(c78);		float4    _c79 : register(c79);
float4    _c80 : register(c80);		float4    _c81 : register(c81);
float4    _c82 : register(c82);		float4    _c83 : register(c83);
float4    _c84 : register(c84);		float4    _c85 : register(c85);

float	  maxi : register(c86);		float	  temp : register(c87);
texture2D texs0 : register(s0);		texture2D texs1 : register(s1);
texture2D texs2 : register(s2);		texture2D texs3 : register(s3);
texture2D texs4 : register(s4);		texture2D texs5 : register(s5);

texture2D texs6 : register(s6);		texture2D texs7 : register(s7);
texture2D texs13 : register(s13);	texture2D texs15 : register(s15);

sampler2D s2=sampler_state { Texture=<texs2>; };	sampler2D s6=sampler_state { Texture=<texs6>; };
sampler2D s4=sampler_state { Texture=<texs4>; };	sampler2D s7=sampler_state { Texture=<texs7>; };
sampler2D s5=sampler_state { Texture=<texs5>; };	sampler2D s15=sampler_state { Texture=<texs15>; };

sampler2D s0 = sampler_state
{
   Texture   = <texs0>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;
AddressU  = Clamp;
AddressV  = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D s1 = sampler_state
{
   Texture   = <texs1>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;
AddressU  = Clamp;
AddressV  = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D s3 = sampler_state
{
   Texture   = <texs3>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;
AddressU  = Clamp;
AddressV  = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D s13 = sampler_state
{
Texture   = <texs13>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;
AddressU  = Clamp;
AddressV  = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

float4 PS_C215BE6E(VS_OUTPUT_POST IN) : COLOR
{
	float4 _oC0=0.0; 
	float4 _c0=float4(0, 0.212500006, 0.715399981, 0.0720999986);
	float4 _c1=float4(0.25, 1, 256, 0);
	float4 _c2=float4(0, 2, 4, 8);
	float4 _c3=float4(58.1640015, 47.1300011, 0, 0);
	float4 _c4=float4(-0.5, -1.5, 1.5, 0.5);
	float4 _c5=float4(2, -1, 0.125, 0);
	float4 _c6=float4(256, 2, 4, 8);
	float4 _c7=float4(1.0, 0.1, 0.8, 1.0);
	float4 _c8=float4(0.0, 0.1, 0.8, 0.333);
	float4 _c9=float4(0.06, 0.1, 0.8, 0.1);
	float4 _c10=float4(0.01, 1.4, 0.0, 0.32);
	float4 _c11=float4(0.333333, 1.0, 0.0, 0.0);
	float4 _c12=float4(0.27, 0.67, 0.06, 0.0);
	float4 _c13=float4(0.0, 0.0, 0.0, 0.00001);
	float4 _c150=float4(0.55, 0.9, 0.85, 0.9);
	float4 _c195=float4(0.0, 0.0, 0.0, 0.07);
	
	float4 r0;		float4 r6;
	float4 r1;		float4 r7;
	float4 r2;		float4 r8;
	float4 r3;		float4 r9;
	float4 r4;		float4 r10;
	float4 r5;		float4 r11;

float4 _v0=0.0;
		
	_v0.xy=IN.txcoord0.xy;
	
		
	r0=tex2D(s1, _v0.xy); 
	r0.y=-_c77.x + _c77.y; 
	r0.y=1.0/r0.y;
	r0.z=r0.y * _c77.y; 
   r0.z=r0.z * -_c77.x; 
   r0.x=_c77.y * -r0.y + r0.x;
	r0.x=1.0/r0.x;
   r0.y=r0.z * r0.x;

	r1=tex2D(s2, _v0.xy);
	r2=tex2D(s3, _v0.xy);

	r0.w=abs(_c79.w);
	r3=_c4; 

float2 off_c76=_c76.xy*0.2;

	r4.xy=off_c76.xy * r3.xy + _v0.xy; 
	r4=tex2D(s2, r4.xy); 

	r5.xy=off_c76.xy * r3.zx + _v0.xy; 
	r5=tex2D(s2, r5.xy);

	r3.xz=off_c76.xy * r3.wz + _v0.xy;
	r6=tex2D(s2, r3.xz); 

	r3.xy=off_c76.xy * r3.yw + _v0;
	r7=tex2D(s2, r3.xy); 


	r1.w=dot(r4.xyz, r4.xyz);
	r1.w=1.0/r1.w;
	if (-r1.w<0.0)
	{
		r3.xyz=r4.xyz;
	} else r3.xyz=_c0.x;

	r1.w=dot(r5.xyz, r5.xyz); 
	r1.w=1.0/r1.w;
	if (-r1.w<0.0)
	{
		r4.xyz=r5.xyz;
	} else r4.xyz=_c0.x;

	r1.w=dot(r6.xyz, r6.xyz); 
	r1.w=1.0/r1.w;
	if (-r1.w<0.0)
	{
		r5.xyz=r6.xyz;
	} else r5.xyz=_c0.x;

	r1.w=dot(r7.xyz, r7.xyz); 
	r1.w=1.0/r1.w;
	if (-r1.w<0.0)
	{
		r6.xyz=r7.xyz;
	} else r6.xyz=_c0.x;

	r1.w=dot(r1.xyz, r1.xyz); 
	r1.w=1.0/r1.w;
	if (-r1.w<0.0)
	{
		r7.xyz=r1.xyz;
	} else r7.xyz=_c0.x;

	r0.x=r0.z * r0.x - _c78.w; 
	r0.x=_c78.y * -r3.w + r0.x; 
	r1.w=max(r0.x, _c0.x); 
	r0.x=1.0/_c78.z; 
	r0.x=r1.w * r0.x;
	r1.w=lerp(_c79.y, _c79.z, r0.x);
	r0.x=min(_c79.z, r1.w); 

	r0.z=dot(r7.xyz, _c0.yzw); 
	r8.x=dot(r3.xyz, _c0.yzw); 
	r8.y=dot(r4.xyz, _c0.yzw); 
	r8.z=dot(r5.xyz, _c0.yzw); 
	
	r8.w=dot(r6.xyz, _c0.yzw); 
	r1.w=dot(r8, _c1.xxxx);

	r8=r8 - r1.w;
	r2.w=dot(r8, r8);
	r0.z=r0.z - r1.w;
	r0.z=r0.z * r0.z - r2.w;
	r0.x=r0.x*r0.x;
	if (r0.z<0.0)
	{
		r0.x=r0.x;
	} else r0.x=_c1.y;


	r8=tex2D(s0, _v0.xy);


	r8.yz=_c1.yz; 
	r9=r8.w * -r8.z + _c2; 
	if (r9.w<0.0) 
	{
		r9=_c1.w; 
	} else r9=_c1.y; 

	r10=r8.w * -_c6.x + _c6.yzwx; 
	if (r10.x<0.0)
	{
		r10.x=-_c1.w; 
	} else r10.x=-_c1.y;

	if (r10.y<0.0)
	{
		r10.y=-_c1.w; 
	} else r10.y=-_c1.y; 

	if (r10.z<0.0)
	{
		r10.z=-_c1.w; 
	} else r10.z=-_c1.y; 

	if (r10.w<0.0)
	{
		r10.w=-_c1.w; 
	} else r10.w=-_c1.y; 


	
	r9=r9 + r10;
	r9=r9 * _c4.x; 

	r0.z=dot(r9, _c1.yyyy); 
	r0.z=r0.z + _c4.w; 
	r0.z=1.0/r0.z;
	r8.xzw=r3.xyz * r9.x;

	r7.xyz=r7 * _c4.w + r8.xzw; 
	r7.xyz=r4 * r9.y + r7;
	r7.xyz=r5 * r9.z + r7;
	
	r7.xyz=r6 * r9.w + r7;
	r7.xyz=r0.z * r7;
	r0.z=-r0.x + _c1.y; 
	r1.w=r0.x * _c1.x; 


	r3.xyz=r3 * r1.w;
	r3.xyz=r7 * r0.z + r3;
	r3.xyz=r4 * r1.w + r3;
	r3.xyz=r5 * r1.w + r3;
	r3.xyz=r6 * r1.w + r3;
	r4.x=_v0.y * _c5.x + _c5.y;
	r4.y=_v0.x * _c5.x + _c5.y;
	r4.z=_v0.y * _c5.x + _c5.y;

	r0.z=r4.y * _c77.z; 
	r0.z=r0.y * r0.z;
	r1.w=-r4.x * _c77.w; 
	r1.w=r0.y * r1.w;
	
	r5.xyz=r1.w * _c73; 
	r5.xyz=r0.z * _c72 + r5; 
	r5.xyz=-r0.y * _c74 + r5; 
	r5.xyz=r5 + _c75; 
	r0.y=-r5.z * _c77.z; 
	r0.y=1.0/r0.y;
	
	r6.x=r5.x * r0.y;
	
	r0.y=r5.z * _c77.w; 
	r0.y=1.0/r0.y;
	r6.y=r5.y * r0.y;

	r0.yz=-r4.yz + r6.xy;
	r0.y=r0.y * _c80.x;
	r0.z=r0.z * _c80.x;

	r4.x=r0.y * _c5.z;
	r4.y=r0.z * _c5.z;
	r5=tex2D(s6, _v0.xy);
	r1.w=r5.x + -_c85.x; 
	r4.zw=r3.xyxy * _c2.w; 
	r4.z=_v0.x * _c3.x + r4.z; 
	r4.w=_v0.y * _c3.y + r4.w;
	
	r5=tex2D(s5, r4.zw); 
	r2.w=r5.x + _c4.x; 

	r4.z=r4.x * r2.w + _v0.x; 
	r4.w=r4.y * r2.w + _v0.y; 
	r5.xyz=r3.xyz;
	r2.w=_c1.y; 
	r3.w=_c1.y; 

   for (int iii=0; iii<10; iii++)
    {
    r6.x=r4.x * r3.w + r4.z;
    r6.y=r4.y * r3.w + r4.w;
    r7=tex2D(s6, r6.xy);
    r5.w=r7.x - _c85.x;
    if (r5.w<-0.3)
    {
 	       r5.w=_c1.y; 
    } else r5.w=_c1.w; 
    r6=tex2D(s2, r6.xy);
    r5.xyz=r6.xyz * r5.w + r5.xyz;
		
    r2.w=r2.w + r5.w;
    r3.w=r3.w + _c1.y; 
    }
r2.w=1.0/r2.w;
r0.y=r0.y * _c44.x; 
r0.z=r0.z * _c44.y; 
r0.y=dot(r0.yz, r0.yz)+_c0.x;

r0.y=pow(r0.y, _c4.w); 
r0.y=r0.y * _c4.w; 
r0.x=r0.x + _c1.y;

r0.x=1.0/r0.x;
r0.x=saturate(r0.y * r0.x);

r4.xyz=r5 * r2.w - r3;	   
r0.xyz=r0.x * r4 + r3;
if (-r1.w<0.0) r0.xyz=r3.xyz;
if (-r0.w<0.0) r0.xyz=r1.xyz;

r11=r0;
	r1=tex2D(s4, _c0.x); 
r0.w=1.0/r1.x;
r0.w=r0.w * _c81.y; 
  r1.x=1.0/r0.w;
	r1.x=r1.x * _c81.x; 
  r1.xyz=r2 * _c66.x - r1.x; 
    r2.xyz=max(r1, _c0.x); 
	
    r1.xyz=r2 * _c81.z; 
r1.xyz=r1 * _c1.x; 
r0.xyz=r0 * _c66.x + r1; 


 r1.xyz=r0.w * r0;
r1.x=dot(r1.xyz, _c0.yzw); 
	r0.xyz=r0 * r0.w - r1.x;
	
	r0.xyz=_c82.x * r0 + r1.x;
	r0.w=r1.x * _c84.w; 
	r1.yzw=r0.w * _c84.xxyz; 
	
	r2.x=saturate(r0.w);
	
	r0.xyz=r0.xyz - _c84.xyz * r0.w; 
	r0.xyz=r2.x * r0.xyz + r1.yzww;
	
	r0.xyz=2.0 * r0.xyz * _c83.xyz; 
	r1.x=saturate(r1.x);
	
	r0.w=_c82.z - r8.y;
	r2.x=pow(r1.x, r0.w);
	_oC0.xyz=r0.xyz * r2.x; 
	_oC0.w=_c1.y; 
    r5=tex2D(s4, _c0.x);
    r0=tex2D(s2, _v0.xy);
	
  r0=r11;
    r5.w=r5.x;
  r5.w=1.2/r5.w;
r0.xyz=r0 * r5.w;
r3.xy=_c10.xwxw;

r3.xy=r3.xy * r5.w;
r7=tex2D(s3, _v0.xy); 

r7=r7*(1-pow(1.1,-r7*0.6))*1.0;
r7.r*=1.35;
r7.g*=1.25;

r7.b*=1.00;
r0=r7*0.02 + r0; 
r10=dot(r0.xyz, _c12.xyz); 

r10=r10*0.5;
r10=min(r10,0.120);
r10=max(r10,0.065);

r0=r0*r10;

r1=r0 * _c7.z;

r1=r1 + _c7.w;
r1.xyz=1.0/r1.xyz;
r0=r0 * r1;

r0=0.3*r7 * r3.x + r0;
r0.xyz=r0.xyz*0.6+sin(r0.xyz*3.1415926*0.5)*0.4;

_oC0.xyz=r0.xyz;

r0.r=r0.r*1.35;
r0.g=r0.g*1.25;
r0.b=r0.b*1.00;
	return _oC0;
}

technique Shader_C215BE6E
{
    pass p0 
    {
		PixelShader  = compile ps_3_0 PS_C215BE6E();
	}
}
