diff options
Diffstat (limited to 'assets')
-rw-r--r-- | assets/shaders/Flag.vert.glsl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl index a5e8b2f7..1c842cb0 100644 --- a/assets/shaders/Flag.vert.glsl +++ b/assets/shaders/Flag.vert.glsl | |||
@@ -16,6 +16,7 @@ attribute vec2 texcoord; | |||
16 | 16 | ||
17 | // scalar uniforms | 17 | // scalar uniforms |
18 | uniform float u_time; | 18 | uniform float u_time; |
19 | uniform float u_speed; | ||
19 | uniform float u_waveWidth; | 20 | uniform float u_waveWidth; |
20 | uniform float u_waveHeight; | 21 | uniform float u_waveHeight; |
21 | 22 | ||
@@ -30,8 +31,9 @@ varying vec2 v_uv; | |||
30 | 31 | ||
31 | void main() | 32 | void main() |
32 | { | 33 | { |
33 | float pi = 3.14159; | 34 | float time = u_time * u_speed; |
34 | float angle = u_time; | 35 | const float pi = 3.14159; |
36 | float angle = time; | ||
35 | 37 | ||
36 | v_uv = texcoord; | 38 | v_uv = texcoord; |
37 | 39 | ||
@@ -39,9 +41,11 @@ void main() | |||
39 | float y = 2.0*pi*texcoord.y; | 41 | float y = 2.0*pi*texcoord.y; |
40 | 42 | ||
41 | vec3 v = a_pos; | 43 | vec3 v = a_pos; |
42 | v.z = sin( x + angle ) - 2.0*u_waveHeight; | 44 | v.z = sin( x + angle ); |
43 | v.z += sin( 0.2*y + angle); | 45 | v.z += sin( 0.2*y + angle); |
44 | v.z *= x * 0.09 * u_waveHeight; | 46 | v.z *= u_waveHeight; |
47 | v.z -= 2.0*u_waveHeight; | ||
48 | v.z *= x * 0.09; | ||
45 | 49 | ||
46 | gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; | 50 | gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; |
47 | } | 51 | } |