aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders/Cloud.vert.glsl
blob: acd581fc6d579181bafde51172668179ef16ceff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* <copyright>
This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
(c) Copyright 2011 Motorola Mobility, Inc.  All Rights Reserved.
</copyright> */


#ifdef GL_ES
precision highp float;
#endif

// attributes
attribute vec3	a_pos;
attribute vec2  texcoord;

// uniforms
uniform float u_time;
uniform float u_zmin;
uniform float u_zmax;
uniform float u_surfaceAlpha;

// matrix uniforms
uniform mat4 u_mvMatrix;
uniform mat4 u_projMatrix;

// varying
varying vec2	v_texCoord0;

// constants
const float zSpeed = 10.0;


void main()
{
    // Transform position
	vec4 pos = vec4(a_pos,1);

	float dz = u_time*zSpeed;
	float n = floor( dz/(u_zmax-u_zmin) );
	dz -= n*(u_zmax - u_zmin);
	float z = pos.z + dz;
	if (z > u_zmax)
	{
		z = u_zmin + (z - u_zmax);
	}
	pos.z = z;

	gl_Position = u_projMatrix * u_mvMatrix * pos;
	    
    v_texCoord0 = texcoord;
}