aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorhwc4872012-04-04 05:52:54 -0700
committerhwc4872012-04-04 05:52:54 -0700
commit0f31002ca696c1ef303d2926a504afd27305e94f (patch)
tree8f3684ff426fd94db338b802ecf1eed643efde9d /assets
parent4b199cf04af83f59895d4d1e9a2d8443c1ec8e06 (diff)
downloadninja-0f31002ca696c1ef303d2926a504afd27305e94f.tar.gz
Added Flag material
Diffstat (limited to 'assets')
-rw-r--r--assets/shaders/Flag.vert.glsl19
1 files changed, 9 insertions, 10 deletions
diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl
index 9da0ee1c..a5e8b2f7 100644
--- a/assets/shaders/Flag.vert.glsl
+++ b/assets/shaders/Flag.vert.glsl
@@ -27,22 +27,21 @@ uniform mat4 u_worldMatrix;
27// varying variables 27// varying variables
28varying vec2 v_uv; 28varying vec2 v_uv;
29 29
30
30void main() 31void main()
31{ 32{
32 float pi = 3.14159; 33 float pi = 3.14159;
33 float angle = mod(u_time, pi)*2.0; 34 float angle = u_time;
34 35
35 vec3 v = a_pos;
36 v_uv = texcoord; 36 v_uv = texcoord;
37 37
38 vec2 pos = texcoord; 38 float x = 2.0*pi*texcoord.x/u_waveWidth;
39 float tmp = pos.x; pos.x = pos.y; pos.y = tmp; 39 float y = 2.0*pi*texcoord.y;
40 pos.x = pos.x * 1.0*pi * u_waveWidth;
41 pos.y = pos.y * 1.0*pi * u_waveWidth;
42 40
43 v.z = sin( pos.x + angle); 41 vec3 v = a_pos;
44 v.z += sin( pos.y/2.0 + angle); 42 v.z = sin( x + angle ) - 2.0*u_waveHeight;
45 v.z *= v.y * 0.09 * u_waveHeight; 43 v.z += sin( 0.2*y + angle);
44 v.z *= x * 0.09 * u_waveHeight;
46 45
47 gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; 46 gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ;
48} 47}