aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorhwc4872012-04-16 05:59:01 -0700
committerhwc4872012-04-16 05:59:01 -0700
commitc0aa5e88890fbf74124d019df96c33215da99f17 (patch)
tree9bff6d97cc19288b4d2c7bfd40a71f608b853fab /assets
parent8992d9baf542135e910bb59328a592d9e330703a (diff)
downloadninja-c0aa5e88890fbf74124d019df96c33215da99f17.tar.gz
Cloud material
Diffstat (limited to 'assets')
-rw-r--r--assets/shaders/Cloud.frag.glsl5
-rw-r--r--assets/shaders/Cloud.vert.glsl12
2 files changed, 13 insertions, 4 deletions
diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl
index ba1ef39e..c21dcf97 100644
--- a/assets/shaders/Cloud.frag.glsl
+++ b/assets/shaders/Cloud.frag.glsl
@@ -17,7 +17,8 @@ varying vec2 v_texCoord0;
17 17
18void main() 18void main()
19{ 19{
20 gl_FragColor = texture2D(u_tex0, v_texCoord0) * u_surfaceAlpha; 20 vec4 c = texture2D(u_tex0, v_texCoord0);
21 //gl_FragColor = texture2D(u_tex0, v_texCoord0); 21 //c.a *= u_surfaceAlpha;
22 gl_FragColor = c;
22} 23}
23 \ No newline at end of file 24 \ No newline at end of file
diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl
index 9a235349..c8ca9f3f 100644
--- a/assets/shaders/Cloud.vert.glsl
+++ b/assets/shaders/Cloud.vert.glsl
@@ -28,14 +28,22 @@ uniform mat4 u_worldMatrix;
28varying vec2 v_texCoord0; 28varying vec2 v_texCoord0;
29 29
30// constants 30// constants
31const float zSpeed = 1.0; 31const float zSpeed = 2.0;
32 32
33 33
34void main() 34void main()
35{ 35{
36 // Transform position 36 // Transform position
37 vec4 pos = vec4(a_pos,1); 37 vec4 pos = vec4(a_pos,1);
38 //pos.z += u_time*zSpeed; 38 float dz = u_time*zSpeed;
39 float n = floor( dz/(u_zmax-u_zmin) );
40 dz -= n*(u_zmax - u_zmin);
41 float z = pos.z + dz;
42 if (z > u_zmax)
43 {
44 z = u_zmin + (z - u_zmax);
45 }
46 pos.z = z;
39 gl_Position = u_projMatrix * u_mvMatrix * pos; 47 gl_Position = u_projMatrix * u_mvMatrix * pos;
40 48
41 v_texCoord0 = texcoord; 49 v_texCoord0 = texcoord;