quakeforge/libs/video/renderer/glsl/quaketrb.frag
Bill Currie 3508972d66 Draw water surfaces... with some really funky turbulence.
It seems I misunderstood the sw turbulence code.
2012-01-10 20:50:47 +09:00

22 lines
464 B
GLSL

uniform sampler2D palette;
uniform sampler2D texture;
uniform float realtime;
varying vec2 tst;
const float SPEED = 20.0;
const float CYCLE = 128.0;
const float PI = 3.14159;
const float FACTOR = PI * 2.0 / CYCLE;
void
main (void)
{
float pix;
vec2 rt = vec2 (realtime, realtime);
vec2 st;
st = tst + sin ((tst.ts * 64.0 + rt * SPEED) * FACTOR);
pix = texture2D (texture, st).r;
gl_FragColor = texture2D (palette, vec2 (pix, 0.5));
}