2012-01-10 11:50:47 +00:00
|
|
|
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);
|
2012-01-10 12:11:21 +00:00
|
|
|
vec2 st = tst;
|
2012-01-10 11:50:47 +00:00
|
|
|
|
2012-01-10 12:11:21 +00:00
|
|
|
st = st + sin ((tst.ts * 64.0 + rt * SPEED) * FACTOR) / 64.0;
|
2012-01-10 11:50:47 +00:00
|
|
|
pix = texture2D (texture, st).r;
|
|
|
|
gl_FragColor = texture2D (palette, vec2 (pix, 0.5));
|
|
|
|
}
|