diff options
author | Eric Guzman | 2012-06-20 19:42:03 -0700 |
---|---|---|
committer | Eric Guzman | 2012-06-20 19:42:03 -0700 |
commit | 3270aac4980c908f305fb53abadda5121ff6b9cb (patch) | |
tree | 6255aaab239fde71b1f4862dd70de7be62f48b85 /assets/shaders/Cloud.vert.glsl | |
parent | a5d93daf6fdccbfee160d6a8ba08f6b6d4b9d7cc (diff) | |
parent | 87377c81da06abf6d656017859830a3ab2902f0e (diff) | |
download | ninja-3270aac4980c908f305fb53abadda5121ff6b9cb.tar.gz |
Merge branch 'binding' of github.com:dhg637/ninja-internal into binding
Diffstat (limited to 'assets/shaders/Cloud.vert.glsl')
-rw-r--r-- | assets/shaders/Cloud.vert.glsl | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl new file mode 100644 index 00000000..acd581fc --- /dev/null +++ b/assets/shaders/Cloud.vert.glsl | |||
@@ -0,0 +1,51 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | |||
8 | #ifdef GL_ES | ||
9 | precision highp float; | ||
10 | #endif | ||
11 | |||
12 | // attributes | ||
13 | attribute vec3 a_pos; | ||
14 | attribute vec2 texcoord; | ||
15 | |||
16 | // uniforms | ||
17 | uniform float u_time; | ||
18 | uniform float u_zmin; | ||
19 | uniform float u_zmax; | ||
20 | uniform float u_surfaceAlpha; | ||
21 | |||
22 | // matrix uniforms | ||
23 | uniform mat4 u_mvMatrix; | ||
24 | uniform mat4 u_projMatrix; | ||
25 | |||
26 | // varying | ||
27 | varying vec2 v_texCoord0; | ||
28 | |||
29 | // constants | ||
30 | const float zSpeed = 10.0; | ||
31 | |||
32 | |||
33 | void main() | ||
34 | { | ||
35 | // Transform position | ||
36 | vec4 pos = vec4(a_pos,1); | ||
37 | |||
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; | ||
47 | |||
48 | gl_Position = u_projMatrix * u_mvMatrix * pos; | ||
49 | |||
50 | v_texCoord0 = texcoord; | ||
51 | } \ No newline at end of file | ||