diff options
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 | ||