diff options
author | Valerio Virgillito | 2012-06-20 11:17:47 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-06-20 11:17:47 -0700 |
commit | 3f5aa43b5b545cd551c5585ef5f2d478c2d49cad (patch) | |
tree | fe5beec45a8d7f45a90659e95c4f13a679ae35d5 /assets/shaders/Flag.vert.glsl | |
parent | 5c4ff40d7950282a179dcfd49c5ea9234e0a8185 (diff) | |
parent | fcb6309915161d16a74a4385b905742f35b7d62d (diff) | |
download | ninja-3f5aa43b5b545cd551c5585ef5f2d478c2d49cad.tar.gz |
Merge branch 'refs/heads/master' into montage-v11-integration
Conflicts:
js/io/system/ninjalibrary.json
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'assets/shaders/Flag.vert.glsl')
-rw-r--r-- | assets/shaders/Flag.vert.glsl | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl index 7dc932a7..1c842cb0 100644 --- a/assets/shaders/Flag.vert.glsl +++ b/assets/shaders/Flag.vert.glsl | |||
@@ -16,20 +16,36 @@ 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; | ||
20 | uniform float u_waveWidth; | ||
21 | uniform float u_waveHeight; | ||
19 | 22 | ||
20 | // matrix uniforms | 23 | // matrix uniforms |
21 | uniform mat4 u_mvMatrix; | 24 | uniform mat4 u_mvMatrix; |
22 | uniform mat4 u_projMatrix; | 25 | uniform mat4 u_projMatrix; |
23 | uniform mat4 u_worldMatrix; | 26 | uniform mat4 u_worldMatrix; |
24 | 27 | ||
25 | void main() | 28 | // varying variables |
26 | { | 29 | varying vec2 v_uv; |
27 | float angle = (u_time%360)*2; | ||
28 | 30 | ||
29 | a_pos.z = sin( a_pos.x + angle); | ||
30 | a_pos.z += sin( a_pos.y/2 + angle); | ||
31 | a_pos.z *= a_pos.x * 0.09; | ||
32 | gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ; | ||
33 | 31 | ||
34 | gl_FragColor = v_color; | 32 | void main() |
33 | { | ||
34 | float time = u_time * u_speed; | ||
35 | const float pi = 3.14159; | ||
36 | float angle = time; | ||
37 | |||
38 | v_uv = texcoord; | ||
39 | |||
40 | float x = 2.0*pi*texcoord.x/u_waveWidth; | ||
41 | float y = 2.0*pi*texcoord.y; | ||
42 | |||
43 | vec3 v = a_pos; | ||
44 | v.z = sin( x + angle ); | ||
45 | v.z += sin( 0.2*y + angle); | ||
46 | v.z *= u_waveHeight; | ||
47 | v.z -= 2.0*u_waveHeight; | ||
48 | v.z *= x * 0.09; | ||
49 | |||
50 | gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; | ||
35 | } | 51 | } |