diff options
author | Jose Antonio Marquez | 2012-06-19 10:25:16 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-06-19 10:25:16 -0700 |
commit | 4d2a5acd1631f0cf4e38f127c886f481668ddce0 (patch) | |
tree | 3bc8f2b21826c0ee6d37bc77753d45a882783cbf /assets/shaders/Cloud.vert.glsl | |
parent | 616b31a644ee221edcbc19f821b2194e8edf9fad (diff) | |
parent | 483ad57efcd6475776f580c3af5b60e6deeaf781 (diff) | |
download | ninja-4d2a5acd1631f0cf4e38f127c886f481668ddce0.tar.gz |
Merge branch 'refs/heads/Ninja-Internal' into FileIO
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 | ||