diff options
Diffstat (limited to 'assets/shaders/Cloud.vert.glsl')
-rw-r--r-- | assets/shaders/Cloud.vert.glsl | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl index 95c14132..c709bc27 100644 --- a/assets/shaders/Cloud.vert.glsl +++ b/assets/shaders/Cloud.vert.glsl | |||
@@ -34,7 +34,7 @@ precision highp float; | |||
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | // attributes | 36 | // attributes |
37 | attribute vec3 a_pos; | 37 | attribute vec3 a_pos; |
38 | attribute vec2 texcoord; | 38 | attribute vec2 texcoord; |
39 | 39 | ||
40 | // uniforms | 40 | // uniforms |
@@ -48,7 +48,7 @@ uniform mat4 u_mvMatrix; | |||
48 | uniform mat4 u_projMatrix; | 48 | uniform mat4 u_projMatrix; |
49 | 49 | ||
50 | // varying | 50 | // varying |
51 | varying vec2 v_texCoord0; | 51 | varying vec2 v_texCoord0; |
52 | 52 | ||
53 | // constants | 53 | // constants |
54 | const float zSpeed = 10.0; | 54 | const float zSpeed = 10.0; |
@@ -57,19 +57,19 @@ const float zSpeed = 10.0; | |||
57 | void main() | 57 | void main() |
58 | { | 58 | { |
59 | // Transform position | 59 | // Transform position |
60 | vec4 pos = vec4(a_pos,1); | 60 | vec4 pos = vec4(a_pos,1); |
61 | 61 | ||
62 | float dz = u_time*zSpeed; | 62 | float dz = u_time*zSpeed; |
63 | float n = floor( dz/(u_zmax-u_zmin) ); | 63 | float n = floor( dz/(u_zmax-u_zmin) ); |
64 | dz -= n*(u_zmax - u_zmin); | 64 | dz -= n*(u_zmax - u_zmin); |
65 | float z = pos.z + dz; | 65 | float z = pos.z + dz; |
66 | if (z > u_zmax) | 66 | if (z > u_zmax) |
67 | { | 67 | { |
68 | z = u_zmin + (z - u_zmax); | 68 | z = u_zmin + (z - u_zmax); |
69 | } | 69 | } |
70 | pos.z = z; | 70 | pos.z = z; |
71 | 71 | ||
72 | gl_Position = u_projMatrix * u_mvMatrix * pos; | 72 | gl_Position = u_projMatrix * u_mvMatrix * pos; |
73 | 73 | ||
74 | v_texCoord0 = texcoord; | 74 | v_texCoord0 = texcoord; |
75 | } | 75 | } |