// Includes all post-process common data (textures & sampler)
#include "PPCommonData.fxh"

//---------------------------------------------------------------------
// Filter data

float g_fTime = 1.0f;							// The time variable

float2 fSinTiler = float2(50.0f, 50.0f);		// A wave multiplier
float2 fBiasScaler = float2(100.0f, 100.0f);	// A wave scaler


//-----------------------------------------------------------------------------
// Pixel Shader: ColorWiggle
// Desc: Performs post-processing effect that wiggles the source image
//-----------------------------------------------------------------------------
float4 ColorWiggle(float2 Tex : TEXCOORD0) : COLOR0
{
	// Compute texcoords (PS2.0 automatically avoids division by 0)
	Tex += sin( (Tex.yx+g_fTime*0.1)*fSinTiler ) / fBiasScaler;
	
	// And return the color	
	return tex2D(g_samSrcColor, Tex);
}


//-----------------------------------------------------------------------------
// Technique: PostProcess
// Desc: Performs post-processing effect that wiggle the source image
//-----------------------------------------------------------------------------
technique PostProcess
<
	string Parameter0 = "fSinTiler";
	string Parameter0Desc = "(float)";
	int Parameter0Size = 2;
	float2 Parameter0Def = float2(50.0f, 50.0f);
	
	string Parameter1 = "fBiasScaler";
	string Parameter1Desc = "(float)";
	int Parameter1Size = 2;
	float2 Parameter1Def = float2(100.0f, 100.0f);
>
{
    pass p0
    {
	ZEnable = false;
		
        VertexShader = null;
        PixelShader = compile ps_2_0 ColorWiggle();
    }
}
