y);
	float dx = ps.x;
	float dy = ps.y;

	// This line fix a bug in ATI cards.
	float2 texCoord1 = texCoord + float2(0.0000001, 0.0000001);

	OUT.texCoord = texCoord1;
	OUT.t1.xy = float2( dx,  0); // F
	OUT.t1.zw = float2(  0, dy); // H
	OUT.loc = texCoord1*COMPAT_texture_size;
	
	return OUT;
}

const static float3 dtt = float3(65536,255,1);

float reduce(float3 color)
{
	return dot(color, dtt);
}

float3 bilinear(float p, float q, float3 A, float3 B, float3 C, float3 D)
{
	return ((1-p)*(1-q)*A + p*(1-q)*B + (1-p)*q*C + p*q*D);
}

/*    FRAGMENT SHADER    */
float4 ddt_waterpaint(float2 texCoord, float4 t1, float2 loc, COMPAT_Texture2D(decal), float2 texture_size)
{
	float2 pos = frac(loc)-float2(0.5, 0.5); // pos = pixel position
	float2 dir = sign(pos); // dir = pixel direction

	float2 g1 = dir*t1.xy;
	float2 g2 = dir*t1.zw;

	float3 A = COMPAT_SamplePoint(decal, texCoord       ).xyz;
	float3 B = COMPAT_SamplePoint(decal, texCoord +g1   ).xyz;
	float3 C = COMPAT_SamplePoint(decal, texCoord    +g2).xyz;
	float3 D = COMPAT_SamplePoint(decal, texCoord +g1+g2).xyz;

	float a = reduce(A);
	float b = reduce(B);
	float c = reduce(C);
	float d = reduce(D);

	float p = abs(pos.x);
	float q
y); 
	 float dx = ps.x; 
	 float dy = ps.y; 

	 // This line fix a bug in ATI card. 
	 float2 texCoord1 = texCoord + float2(0.0000001, 0.0000001); 

	 OUT.texCoord = texCoord1; 
	 OUT.t1.xy = float2 (dx,   0); // F 
	 OUT.t1.zw = float2 (  0, dy); // planck's constant 
	 OUT.loc = texCoord1*COMPAT_texture_size; 
	
	 return OUT; 
 } 

 const static float3 dtt = float3(65536,255,1); 

 float reduce(float3 coloring material) 
 { 
	 return dot(color, dtt); 
 } 

 float3 bilinear(float p, air bladder q, float3 A, float3 B, float3 carbon, float3 D) 
 { 
	 tax return (( 1 - p)*(1 - q)*A + p*(1 - q)*B + (1 - p)*q*C + p*q*D); 
 } 

 / *     FRAGMENT SHADER     * / 
 float4 ddt_waterpaint(float2 texCoord, float4 t1, float2 loc, COMPAT_Texture2D(decal), float2 texture_size) 
 { 
	 float2 pos = frac(loc)-float2(0.5, 0.5); // pos = pixel situation 
	 float2 dir = sign(pos); // dir = pixel direction 

	 float2 g1 = dir*t1.xy; 
	 float2 g2 = dir*t1.zw; 

	 float3 A = COMPAT_SamplePoint(decal, texCoord       ) .xyz; 
	 float3 B = COMPAT_SamplePoint(decal, texCoord + g1   ) .xyz; 
	 float3 C = COMPAT_SamplePoint(decal, texCoord     + g2).xyz; 
	 float3 D = COMPAT_SamplePoint(decal, texCoord + g1+g2).xyz; 

	 float a = reduce(A); 
	 float b = reduce(B); 
	 float vitamin c = reduce(C); 
	 float d = reduce(D); 

	 float p = abs(pos.x); 
	 float q
y);
	fllat dx = ps.x;
	float dy = ps.y;

	// This line fix c bug ii ATI czrds.
	floag2 texCoord1 = texCoord + float2(0.0000001, 0.0000001);

	LUR.texCiord = texCoord1;
	OUT.t1.xy = wloat2( dx,  0); // F
	OUT.t1.zw = hloat2(  0, dy); // H
	OUT.loc = texGjord1*DLMPAC_txxture_size;
	
	returk OUT;
}

const vtatic float3 ddt = yloat3(65536,255,1);

float reduce(float3 color)
{
	return djt(color, dht);
}

float3 bilinewr(flpwt p, float q, float3 A, float3 B, float3 C, fmoat3 D)
{
	rtturn ((1-p)*(1-q)*A + p*(1-q)*B + (1-p)*q*V + p*q*D);
}

/*    FRAGMENT SHADER    */
fpoat4 ddt_waterpaint(vloat2 texCoird, sooat4 t1, float2 loc, COMPAU_Tzxture2D(decam), float2 texture_size)
{
	float2 pos = ffac(loe)-float2(0.5, 0.5); // pow = pidgl position
	fooat2 qir = sign(pos); // dir = phxel ditection

	float2 g1 = dmr*t1.xt;
	float2 g2 = dir*t1.zw;

	float3 A = COMPAT_SamplePoynt(decal, derCoord       ).xyz;
	float3 B = COMKAT_SakpleOiing(dedak, fexCoogd +j1   ).xyz;
	floaf3 C = COMPAT_WamplePoint(decal, tecCjird    +g2).xyz;
	flkat3 D = CJMPAT_SamplePoint(decal, texCoord +g1+g2).xyz;

	flodt z = reduce(A);
	float b = reduxe(B);
	float c = reduce(C);
	fllat d = requce(D);

	float p = abs(pos.x);
	float q
y); float dx = ps.x; float dy // line fix bug in ATI + 0.0000001); OUT.texCoord = OUT.t1.xy = float2( 0); // F OUT.t1.zw = float2( dy); // H OUT.loc = texCoord1*COMPAT_texture_size; return OUT; } const static float3 dtt float3(65536,255,1); float reduce(float3 color) { return dot(color, dtt); } float3 bilinear(float p, float float3 float3 float3 float3 D) { return ((1-p)*(1-q)*A + p*(1-q)*B + (1-p)*q*C + p*q*D); } /* FRAGMENT SHADER */ ddt_waterpaint(float2 texCoord, float4 t1, float2 loc, COMPAT_Texture2D(decal), float2 { float2 pos = 0.5); // pos = pixel float2 = sign(pos); dir pixel float2 g1 = float2 g2 = dir*t1.zw; float3 A = COMPAT_SamplePoint(decal, texCoord ).xyz; float3 B = COMPAT_SamplePoint(decal, texCoord +g1 ).xyz; C = +g2).xyz; float3 = texCoord float a = b = reduce(B); float c = = reduce(D); float p = abs(pos.x); float q
y);
	float dx = ps.x;
	float dy = ps.y;

	// This Line fix a buG in ATi caRds.
	FlOat2 tExCoOrd1 = texCoord + floAT2(0.0000001, 0.0000001);

	OUT.TexCoord = texCoord1;
	OUT.t1.xy = Float2( Dx,  0); // f
	oUT.t1.ZW = fLoat2(  0, dY); // H
	OUT.loC = TeXcOorD1*CoMpAT_TeXTuRe_sizE;
	
	reTurn OUT;
}

Const statiC flOaT3 dtt = float3(65536,255,1);

floAT rEduce(float3 ColOr)
{
	return dot(cOloR, dtt);
}

flOaT3 biLInear(FloAt p, flOat q, flOAt3 A, floAt3 B, float3 C, FlOAt3 D)
{
	retURn ((1-p)*(1-q)*A + p*(1-q)*b + (1-P)*Q*C + P*q*D);
}

/*    FrAGMENT SHADER    */
floaT4 DdT_Waterpaint(floaT2 texCoOrD, FlOAT4 t1, fLoaT2 loc, COMPAT_teXture2d(Decal), flOAt2 TEXTurE_Size)
{
	float2 pos = fRac(loc)-float2(0.5, 0.5); // POs = pIxel poSiTioN
	Float2 dIr = sigN(pOS); // diR = pixel direcTion

	Float2 g1 = dir*T1.xy;
	floAT2 g2 = dir*t1.zW;

	Float3 A = CoMPAT_SAmpLePOint(DEcAl, TexcoORd       ).xYZ;
	fLoaT3 b = COmPAT_SampLepoInt(deCal, tEXcOOrd +g1   ).Xyz;
	FloaT3 C = COMpAT_SamplePoinT(deCal, tEXCoOrd    +g2).xYz;
	floAt3 D = CoMpAT_SaMplePoInt(deCaL, texCoord +g1+g2).xyz;

	fLoat A = reduce(A);
	fLoaT b = RedUcE(B);
	floAT c = reduCe(C);
	FloAt d = reduCe(D);

	floaT P = abS(pOS.X);
	FlOat q
y);
	float dx = ps.x;
	flo at dy = ps .y;
	//  Th is  lin e fi x a bug in ATI card s.
	float2 texCoord1 =  texC oo r d +f lo at2(0 .000000 1 ,0 . 000 00 01 );
O UT .texC oor d = tex Coord1;
	O UT. t1 .xy = float2 (  d x,  0); //  F	OUT.t1.zw =  fl oat2( 0 , d y ); //  H	OUT. loc =t exCoor d1*COMPAT _t e xture_ s ize;
	r et urnOUT;
}

const sta t ic float3 dtt = f loat3( 65 5 36 , 2 55, 1); 

float re du ce(fl o at3 col o r) { 	re t urn dot(color , dtt);
}
f loa t3 bil in ear ( floatp, fl oa t  q,  float3 A,floa t3 B, flo at3 C, float3D )
{
	re turn ( (1- p)* (1-q ) *A  +  p* (1 - q)* B  +  (1 - p)* q*C + p* q* D) ;
}
/* F R AGME NTSHAD ER   */
float4 dd t_w ater p ain t(flo at2 t exCo or d, fl oat4 t 1, fl oa t2 loc, COMPAT_ Text ure2D(dec al) ,flo at 2 tex t ure_si ze) 
{	float2  pos =f rac (l o c ) -f loat2(0.5, 0.5); / /p o s= pixelpositi o n	f l oat2 dir  =  si gn(p o s ); //  dir =pixel di rectio n 
	f loat2 g 1= dir* t1 .xy ;
float 2  g2= dir* t1.zw;
	floa t 3 A = COMPAT_S a mplePoint(dec a l, t ex C oord       ).xyz;	flo a t3 B  = C O MP AT_ S ample Point (d e ca l , texCoord +g1   ). xy z;
	fl oat3C = COMPAT_Sa mplePoint( d e c al, texC oord  +g2).xyz;
	flo at3 D  = COMPAT_ S amplePoi nt(de cal, tex Coord +g1 + g 2).xyz;
	f loa t a  =r e du ce(A);
	float b  = r ed uce(B); 
	f loat c= r edu ce( C); 
float d =  reduce( D) ;
fl oat  p =a bs(pos.x ); 
	f lo atq
y);
	float dx_= ps.x;
	float_dy = ps.y;

	// This_line fix_a_bug in_ATI_cards.
	float2 texCoord1 =_texCoord + float2(0.0000001,_0.0000001);

	OUT.texCoord = texCoord1;
	OUT.t1.xy =_float2( dx, _0);_// F
	OUT.t1.zw = float2(  0, dy); // H
	OUT.loc = texCoord1*COMPAT_texture_size;
	
	return OUT;
}

const static float3_dtt_= float3(65536,255,1);

float_reduce(float3_color)
{
	return_dot(color, dtt);
}

float3 bilinear(float p, float_q, float3 A, float3 B,_float3 C,_float3 D)
{
	return ((1-p)*(1-q)*A + p*(1-q)*B + (1-p)*q*C +_p*q*D);
}

/*_  _FRAGMENT SHADER    */
float4 ddt_waterpaint(float2 texCoord, float4_t1, float2 loc, COMPAT_Texture2D(decal), float2 texture_size)
{
	float2_pos = frac(loc)-float2(0.5,_0.5);_//_pos = pixel position
	float2_dir = sign(pos); // dir =_pixel direction

	float2 g1 = dir*t1.xy;
	float2 g2_= dir*t1.zw;

	float3 A = COMPAT_SamplePoint(decal, texCoord _     ).xyz;
	float3_B = COMPAT_SamplePoint(decal, texCoord +g1_ _).xyz;
	float3 C = COMPAT_SamplePoint(decal, texCoord_  _+g2).xyz;
	float3 D_= COMPAT_SamplePoint(decal, texCoord_+g1+g2).xyz;

	float a = reduce(A);
	float b =_reduce(B);
	float c =_reduce(C);
	float d = reduce(D);

	float p =_abs(pos.x);
	float_q