mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Get the turbulence more correct.
This looks right, and should be easier to tweak.
This commit is contained in:
parent
d2dae4cc58
commit
5dbf913d41
1 changed files with 12 additions and 3 deletions
|
@ -8,15 +8,24 @@ const float SPEED = 20.0;
|
|||
const float CYCLE = 128.0;
|
||||
const float PI = 3.14159;
|
||||
const float FACTOR = PI * 2.0 / CYCLE;
|
||||
const vec2 BIAS = vec2 (1.0, 1.0);
|
||||
const float SCALE = 16.0;
|
||||
|
||||
vec2
|
||||
turb_st (vec2 st, float time)
|
||||
{
|
||||
vec2 angle = st.ts * CYCLE;
|
||||
vec2 phase = vec2 (time, time) * SPEED;
|
||||
return st + (sin ((angle + phase) * FACTOR) + BIAS) / SCALE;
|
||||
}
|
||||
|
||||
void
|
||||
main (void)
|
||||
{
|
||||
float pix;
|
||||
vec2 rt = vec2 (realtime, realtime);
|
||||
vec2 st = tst;
|
||||
vec2 st;
|
||||
|
||||
st = st + sin ((tst.ts * 64.0 + rt * SPEED) * FACTOR) / 64.0;
|
||||
st = turb_st (tst, realtime);
|
||||
pix = texture2D (texture, st).r;
|
||||
gl_FragColor = texture2D (palette, vec2 (pix, 0.5));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue