<jittershader name="ripples">
	<param name="waveFreq" type="float" default="100" />
	<param name="waveAmp" type="float" default="0.03" />
	<param name="time" type="float" default="1" />
	<language name="glsl" version="1.0">
		<bind param="waveFreq" program="ripples" />
		<bind param="waveAmp" program="ripples" />
		<bind param="time" program="ripples" />
		<program name="basic" type="vertex" source="sh.passthrudim.vp.glsl" />
		<program name="ripples" 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 waveFreq;
uniform float waveAmp;
uniform float time;

// 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 cosangle = P0 / radius;
    float sinangle = P1 / radius;

    float waveangle = (radius - time) * waveFreq;
    waveangle = mod(waveangle, 2.0 * 3.14159);
    float offset = 1.0 - cos(waveangle - 3.14159);
    offset *= waveAmp;

    float newradius = radius + offset;
    vec2 newP = vec2 (newradius * cosangle + 0.5,newradius * sinangle + 0.5);

    gl_FragColor = texture2DRect(tex0, newP*texdim0);
}

]]>		
		</program>
	</language>
</jittershader>
