MATERIAL *pp_spiral =
// Take a source image and spiral/pinch/bulge around the center
{
cycle = 10;
effect = "
float4 vecSkill1;
float4 vecCycle;
texture TargetMap;
sampler sRendertarget = sampler_state { Texture = <TargetMap>; };
float fCoeff = 1.0; //vecSkill1.y
float fAngle, Angle, Dist;
float4 pp_spiral(float2 Tex: TEXCOORD0): COLOR
{
fAngle = vecCycle.y * vecSkill1.x;
Dist = distance(Tex.xy, float2(0.5,0.5))* 2;
if (Dist <2.0) {
Angle = atan2(Tex.y-0.5, Tex.x -0.5) + pow(1-Dist,1.0) * fAngle;
Dist = (pow(Dist,vecSkill1.y))/2;
Tex.x = cos(Angle) * Dist + 0.5;
Tex.y = sin(Angle) * Dist + 0.5;
}
return tex2D(sRendertarget, Tex.xy);
}
technique spiral {
pass p1 {
AlphaBlendEnable = false;
PixelShader = compile ps_2_0 pp_spiral();
}
}
";
}