aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorweiss <weiss@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-07-19 14:16:43 +0000
committerweiss <weiss@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-07-19 14:16:43 +0000
commitd55a4543b406c29e0a18cfd15082a3ddc06bf77c (patch)
tree17fbc1fc398b49a63076665b950b0823daf67f32 /data
parent23705de21cacd60e0dabe53a73454bcd28f8afad (diff)
Make the recharge ripple fade nicely
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@144 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'data')
-rw-r--r--data/shaders/swirlytron.frag20
1 files changed, 11 insertions, 9 deletions
diff --git a/data/shaders/swirlytron.frag b/data/shaders/swirlytron.frag
index 81c80c3..7d8aaec 100644
--- a/data/shaders/swirlytron.frag
+++ b/data/shaders/swirlytron.frag
@@ -12,26 +12,28 @@
varying vec2 coords;
varying vec2 incoords;
uniform float time;
+uniform float rrb; /* Recharge ripple brightness */
uniform bool rechargeripple;
void main() {
vec3 colour;
- float f;
- float r;
- r = pow(abs(coords.x), 2.0) + pow(abs(coords.y), 2.0);
- f = 1.0;
colour.r = 0.0;
colour.g = 0.0;
- colour.b = 1.0 * cos(2*f*3.141*r - (time/250.0) );
+ colour.b = 0.5*max(0.0, cos(2*3.141*coords.x-(time/250.0))) + 0.5*max(0.0, cos(2*3.141*coords.y-(time/250.0)));
if ( rechargeripple ) {
+
+ const float f = 1.0;
+ float r;
+
r = pow(abs(incoords.x), 2.0) + pow(abs(incoords.y), 2.0);
- f = 1.0;
- colour.r += 0.8 * cos(2*f*3.141*r + (time/250.0) );
- colour.g += 0.3 * cos(2*f*3.141*r + (time/250.0) );
- colour.b += 0.1;
+
+ colour.r += rrb * 0.8 * cos(2*f*3.141*r + (time/250.0) );
+ colour.g += rrb * 0.3 * cos(2*f*3.141*r + (time/250.0) );
+ colour.b += rrb * 0.1;
+
}
gl_FragColor = vec4(colour.r, colour.g, colour.b, 1.0);