aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'assets/shaders')
-rwxr-xr-xassets/shaders/Basic.vert.glsl3
-rw-r--r--assets/shaders/BasicTex.frag.glsl19
-rw-r--r--assets/shaders/Cloud.frag.glsl23
-rw-r--r--assets/shaders/Cloud.vert.glsl51
-rw-r--r--assets/shaders/Flag.frag.glsl20
-rw-r--r--assets/shaders/Flag.vert.glsl32
-rw-r--r--assets/shaders/Pulse.frag.glsl12
-rw-r--r--assets/shaders/TwistVert.frag.glsl1
-rw-r--r--assets/shaders/TwistVert.vert.glsl11
-rw-r--r--assets/shaders/Water2.frag.glsl30
-rw-r--r--assets/shaders/plasma.frag.glsl16
-rwxr-xr-xassets/shaders/test_fshader.glsl2
12 files changed, 181 insertions, 39 deletions
diff --git a/assets/shaders/Basic.vert.glsl b/assets/shaders/Basic.vert.glsl
index 0d5b8d63..f96f8322 100755
--- a/assets/shaders/Basic.vert.glsl
+++ b/assets/shaders/Basic.vert.glsl
@@ -14,6 +14,8 @@ precision highp float;
14attribute vec3 a_pos; 14attribute vec3 a_pos;
15attribute vec2 texcoord; 15attribute vec2 texcoord;
16 16
17// varying
18varying vec2 v_texCoord0;
17 19
18// matrix uniforms 20// matrix uniforms
19uniform mat4 u_mvMatrix; 21uniform mat4 u_mvMatrix;
@@ -22,5 +24,6 @@ uniform mat4 u_worldMatrix;
22 24
23void main(void) 25void main(void)
24{ 26{
27 v_texCoord0 = texcoord;
25 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ; 28 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ;
26} \ No newline at end of file 29} \ No newline at end of file
diff --git a/assets/shaders/BasicTex.frag.glsl b/assets/shaders/BasicTex.frag.glsl
new file mode 100644
index 00000000..a716e77d
--- /dev/null
+++ b/assets/shaders/BasicTex.frag.glsl
@@ -0,0 +1,19 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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
9precision highp float;
10#endif
11
12uniform sampler2D u_tex0;
13
14varying vec2 v_texCoord0;
15
16
17void main() {
18 gl_FragColor = texture2D(u_tex0, v_texCoord0);
19}
diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl
new file mode 100644
index 00000000..cd70d1a0
--- /dev/null
+++ b/assets/shaders/Cloud.frag.glsl
@@ -0,0 +1,23 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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
9precision highp float;
10#endif
11
12uniform sampler2D u_tex0;
13uniform float u_surfaceAlpha;
14
15varying vec2 v_texCoord0;
16
17
18void main()
19{
20 vec4 c = texture2D(u_tex0, v_texCoord0);
21 gl_FragColor = c;
22}
23 \ No newline at end of file
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>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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
9precision highp float;
10#endif
11
12// attributes
13attribute vec3 a_pos;
14attribute vec2 texcoord;
15
16// uniforms
17uniform float u_time;
18uniform float u_zmin;
19uniform float u_zmax;
20uniform float u_surfaceAlpha;
21
22// matrix uniforms
23uniform mat4 u_mvMatrix;
24uniform mat4 u_projMatrix;
25
26// varying
27varying vec2 v_texCoord0;
28
29// constants
30const float zSpeed = 10.0;
31
32
33void 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
diff --git a/assets/shaders/Flag.frag.glsl b/assets/shaders/Flag.frag.glsl
new file mode 100644
index 00000000..b05b4888
--- /dev/null
+++ b/assets/shaders/Flag.frag.glsl
@@ -0,0 +1,20 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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
9precision highp float;
10#endif
11
12uniform sampler2D u_tex0;
13
14varying vec2 v_uv;
15
16void main(void)
17{
18 vec3 col = texture2D(u_tex0, v_uv).xyz;
19 gl_FragColor = vec4(col,1.0);
20} \ No newline at end of file
diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl
index 7dc932a7..1c842cb0 100644
--- a/assets/shaders/Flag.vert.glsl
+++ b/assets/shaders/Flag.vert.glsl
@@ -16,20 +16,36 @@ attribute vec2 texcoord;
16 16
17// scalar uniforms 17// scalar uniforms
18uniform float u_time; 18uniform float u_time;
19uniform float u_speed;
20uniform float u_waveWidth;
21uniform float u_waveHeight;
19 22
20// matrix uniforms 23// matrix uniforms
21uniform mat4 u_mvMatrix; 24uniform mat4 u_mvMatrix;
22uniform mat4 u_projMatrix; 25uniform mat4 u_projMatrix;
23uniform mat4 u_worldMatrix; 26uniform mat4 u_worldMatrix;
24 27
25void main() 28// varying variables
26{ 29varying vec2 v_uv;
27 float angle = (u_time%360)*2;
28 30
29 a_pos.z = sin( a_pos.x + angle);
30 a_pos.z += sin( a_pos.y/2 + angle);
31 a_pos.z *= a_pos.x * 0.09;
32 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ;
33 31
34 gl_FragColor = v_color; 32void main()
33{
34 float time = u_time * u_speed;
35 const float pi = 3.14159;
36 float angle = time;
37
38 v_uv = texcoord;
39
40 float x = 2.0*pi*texcoord.x/u_waveWidth;
41 float y = 2.0*pi*texcoord.y;
42
43 vec3 v = a_pos;
44 v.z = sin( x + angle );
45 v.z += sin( 0.2*y + angle);
46 v.z *= u_waveHeight;
47 v.z -= 2.0*u_waveHeight;
48 v.z *= x * 0.09;
49
50 gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ;
35} 51}
diff --git a/assets/shaders/Pulse.frag.glsl b/assets/shaders/Pulse.frag.glsl
index b24c9bef..9aeb05c9 100644
--- a/assets/shaders/Pulse.frag.glsl
+++ b/assets/shaders/Pulse.frag.glsl
@@ -6,16 +6,22 @@ uniform float u_time;
6uniform vec2 u_resolution; 6uniform vec2 u_resolution;
7uniform sampler2D u_tex0; 7uniform sampler2D u_tex0;
8 8
9uniform float u_speed;
10uniform float u_xscale;
11uniform float u_yscale;
12
9void main(void) 13void main(void)
10{ 14{
11 vec2 halfres = u_resolution.xy/2.0; 15 vec2 halfres = u_resolution.xy/2.0;
12 vec2 cPos = gl_FragCoord.xy; 16 vec2 cPos = gl_FragCoord.xy;
13 17
14 cPos.x -= 0.5*halfres.x*sin(u_time/2.0)+0.3*halfres.x*cos(u_time)+halfres.x; 18 float time = u_time * u_speed;
15 cPos.y -= 0.4*halfres.y*sin(u_time/5.0)+0.3*halfres.y*cos(u_time)+halfres.y; 19
20 cPos.x -= u_xscale*halfres.x*sin(time/2.0)+0.3*halfres.x*cos(time)+halfres.x;
21 cPos.y -= u_yscale*halfres.y*sin(time/5.0)+0.3*halfres.y*cos(time)+halfres.y;
16 float cLength = length(cPos); 22 float cLength = length(cPos);
17 23
18 vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-u_time*10.0)/25.0; 24 vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-time*10.0)/25.0;
19 vec3 col = texture2D(u_tex0,uv).xyz*50.0/cLength; 25 vec3 col = texture2D(u_tex0,uv).xyz*50.0/cLength;
20 26
21 gl_FragColor = vec4(col,1.0); 27 gl_FragColor = vec4(col,1.0);
diff --git a/assets/shaders/TwistVert.frag.glsl b/assets/shaders/TwistVert.frag.glsl
index f8490615..01c32c42 100644
--- a/assets/shaders/TwistVert.frag.glsl
+++ b/assets/shaders/TwistVert.frag.glsl
@@ -28,5 +28,4 @@ void main()