texture  TexA : Diffuse
<
	string ResourceName = "G:\\TestData\\pic\\NA2B59~1.JPG";
>;

texture  TexB : Diffuse
<
	string ResourceName = "G:\\TestData\\pic\\NA2F49~1.JPG";
>;
texture TexW : Diffuse
<
	string ResourceName = "F:\\Project\\kanten\\trunk\\subsys\\Transitions\\fx\\water wave.jpg";
>;

sampler TextureSamplerA : register(s0) = sampler_state
{
	Texture = <TexA>;
	MinFilter = Linear;
	MagFilter = Linear;
	MipFilter = Linear;
};
sampler TextureSamplerB : register(s1) = sampler_state
{
	Texture = <TexB>;
	MinFilter = Linear;
	MagFilter = Linear;
	MipFilter = Linear;
};
sampler TextureSamplerW : register(s2) = sampler_state
{
	Texture = <TexW>;
	MinFilter = Linear;
	MagFilter = Linear;
	MipFilter = Linear;
};


//------------------------------------
struct vertexInput {
    float3 position				: POSITION;
    float3 normal				: NORMAL;
    float4 texCoordDiffuse		: TEXCOORD0;
};

struct vertexOutput {
    float4 hPosition		: POSITION;
    float4 texCoordDiffuse	: TEXCOORD0;
    float4 diffAmbColor		: COLOR0;
    float4 specCol			: COLOR1;
};

float weight 
<
	string UIName = "weight";
	string UIWidget = "slider";
	float UIMin = 0.0;
	float UIStep = 0.01;
	float UIMax = 1.0;
> =  0.0;

float rippletime
<
	string UIName = "rippletime";
	string UIWidget = "slider";
	float UIMin = 0.0;
	float UIStep = 0.01;
	float UIMax = 1.0;
> =  0.0; 

float distort 
<
	string UIName = "distort";
	string UIWidget = "slider";
	float UIMin = 0.1;
	float UIStep = 0.01;
	float UIMax = 0.3;
> =  0.3; 
//-----------------------------------
float numripple
<
	string UIName = "numripple";
	string UIWidget = "slider";
	float UIMin = 0.1;
	float UIStep = 0.01;
	float UIMax = 2.0;
> =  0.2; 

float magnitude
<
	string UIName = "magnitude";
	string UIWidget = "slider";
	float UIMin = 0.0;
	float UIStep = 0.01;
	float UIMax = 1.0;
> = 1.0;


float4 PS_Textured(float2 uv: TEXCOORD0, float4 color : COLOR0): COLOR
{
  float2 texCoord =  uv;
  float t2c =  length(texCoord.xy-float2(0.5,0.5) ); 

  float d = magnitude*(tex2D(TextureSamplerW, float2(numripple*t2c+(1.0-rippletime), 0)).x - 0.5 );
  texCoord.x += distort*d;
  
  float w = max(0.0, (min(1.0,weight + d))); 
  float4 ColorA = tex2D( TextureSamplerA, texCoord );
  float4 ColorB = tex2D( TextureSamplerB, texCoord );
  float4 retColor = ColorA*(1-w) + ColorB*w;
  return retColor;
}


//-----------------------------------
technique rippleTransition_PS
{
    pass p0 
    {				
		PixelShader  = compile ps_2_0 PS_Textured();
    }
}