#include "postfx_common.sh"

POSTFX_VSH_1_TEX


sampler sceneTex : register(s0);

float4 params : register(c1);


float4 psh(VsOutput I) : COLOR
{
  float2 dp=I.tc*2-1;
  float f=saturate(dot(dp, dp));
  float tf=smoothstep(0, 1, 1-abs((params.y-0.7)/0.7));
  float a=params.x*(1-pow(f, 1.0/256))*tf*800;
  float ca=cos(a), sa=sin(a);

  float2 tc;
  tc.x=dot(dp, float2( ca, sa));
  tc.y=dot(dp, float2(-sa, ca));
  tc=tc*0.5+0.5;

  float4 res=tex2D(sceneTex, tc);
  return res;
}
