<jittershader name="twirl">
	<param name="amp" type="float" default="5" />
	<param name="phase" type="float" default="0" />
	<language name="glsl" version="1.0">
		<bind param="amp" program="twirl" />
		<bind param="phase" program="twirl" />
		<program name="basic" type="vertex" source="sh.passthrudim.vp.glsl" />
		<program name="twirl" type="fragment">
<![CDATA[
///////////////////////////////////////////////////////////////////////////////
//
// Copyright 2003, ATI Technologies, Inc., All rights reserved.
//
// Permission to use, copy, modify, and distribute this software and its 
// documentation for any purpose and without fee is hereby granted,
// provided that the above copyright notice appear in all copies and derivative
// works and that both the copyright notice and this permission notice appear in
// support documentation, and that the name of ATI Technologies, Inc. not be used
// in advertising or publicity pertaining to distribution of the software without
// specific, written prior permission.
//
///////////////////////////////////////////////////////////////////////////////

// vertex to fragment shader io
varying vec2 texcoord0;
varying vec2 texdim0;

// globals
uniform float amp;
uniform float phase;

// samplers
uniform sampler2DRect tex0;

// entry point
void 
main()
{
	
    vec2 PP = texcoord0/texdim0 - vec2(0.5,0.5);
    float P0 = PP[0];
    float P1 = PP[1];
    float radius = sqrt(P0 * P0 + P1 * P1);
    float angle = atan(P1,P0);

    float offset = radius * amp + phase;
    angle += offset;

    angle = mod(angle, 2.0 * 3.14159);
    float cosangle = -cos(angle - 3.14159);
    float sinangle = -sin(angle - 3.14159);

    vec2 newP = vec2 (0,0);
    newP[0] = radius * cosangle + 0.5;
    newP[1] = radius * sinangle + 0.5;

    gl_FragColor = texture2DRect(tex0, vec2(newP*texdim0));
}
]]>	
		</program>
	</language>
</jittershader>
