diff options
author | Armen Kesablyan | 2012-06-20 15:00:34 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-06-20 15:00:34 -0700 |
commit | 38f571d1fdf02d36c3816637af7b2ca2493809da (patch) | |
tree | 69b97839be8b2b6fb65e9150d4dc02856041fb1d /assets/shaders | |
parent | f7c14e54c52bce8875cde81db621dde6f4ff1e34 (diff) | |
parent | 120e31dcf1e11eed11ee430d77c438e7b073e9f8 (diff) | |
download | ninja-38f571d1fdf02d36c3816637af7b2ca2493809da.tar.gz |
Merge branch 'refs/heads/master' into binding
Diffstat (limited to 'assets/shaders')
25 files changed, 228 insertions, 65 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; | |||
14 | attribute vec3 a_pos; | 14 | attribute vec3 a_pos; |
15 | attribute vec2 texcoord; | 15 | attribute vec2 texcoord; |
16 | 16 | ||
17 | // varying | ||
18 | varying vec2 v_texCoord0; | ||
17 | 19 | ||
18 | // matrix uniforms | 20 | // matrix uniforms |
19 | uniform mat4 u_mvMatrix; | 21 | uniform mat4 u_mvMatrix; |
@@ -22,5 +24,6 @@ uniform mat4 u_worldMatrix; | |||
22 | 24 | ||
23 | void main(void) | 25 | void 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> | ||
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 | uniform sampler2D u_tex0; | ||
13 | |||
14 | varying vec2 v_texCoord0; | ||
15 | |||
16 | |||
17 | void 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> | ||
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 | uniform sampler2D u_tex0; | ||
13 | uniform float u_surfaceAlpha; | ||
14 | |||
15 | varying vec2 v_texCoord0; | ||
16 | |||
17 | |||
18 | void 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> | ||
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 | ||
diff --git a/assets/shaders/Deform.frag.glsl b/assets/shaders/Deform.frag.glsl index 1dbe45a0..a2bb4fa0 100644 --- a/assets/shaders/Deform.frag.glsl +++ b/assets/shaders/Deform.frag.glsl | |||
@@ -3,6 +3,7 @@ precision highp float; | |||
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | uniform float u_time; | 5 | uniform float u_time; |
6 | uniform float u_speed; | ||
6 | uniform vec2 u_resolution; | 7 | uniform vec2 u_resolution; |
7 | //uniform vec4 mouse; | 8 | //uniform vec4 mouse; |
8 | uniform sampler2D u_tex0; | 9 | uniform sampler2D u_tex0; |
@@ -19,7 +20,7 @@ void main(void) | |||
19 | float r2 = sqrt(dot(p+m,p+m)); | 20 | float r2 = sqrt(dot(p+m,p+m)); |
20 | 21 | ||
21 | vec2 uv; | 22 | vec2 uv; |
22 | uv.x = 0.2*u_time + (r1-r2)*0.25; | 23 | uv.x = 0.2*u_time*u_speed + (r1-r2)*0.25; |
23 | uv.y = sin(2.0*(a1-a2)); | 24 | uv.y = sin(2.0*(a1-a2)); |
24 | 25 | ||
25 | float w = r1*r2*0.8; | 26 | float w = r1*r2*0.8; |
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> | ||
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 | uniform sampler2D u_tex0; | ||
13 | |||
14 | varying vec2 v_uv; | ||
15 | |||
16 | void 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 |
18 | uniform float u_time; | 18 | uniform float u_time; |
19 | uniform float u_speed; | ||
20 | uniform float u_waveWidth; | ||
21 | uniform float u_waveHeight; | ||
19 | 22 | ||
20 | // matrix uniforms | 23 | // matrix uniforms |
21 | uniform mat4 u_mvMatrix; | 24 | uniform mat4 u_mvMatrix; |
22 | uniform mat4 u_projMatrix; | 25 | uniform mat4 u_projMatrix; |
23 | uniform mat4 u_worldMatrix; | 26 | uniform mat4 u_worldMatrix; |
24 | 27 | ||
25 | void main() | 28 | // varying variables |
26 | { | 29 | varying 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; | 32 | void main() |
33 | { | ||
34 | float time = u_time * u_speed; | ||
35 | const float pi = 3.14159; | ||
36 | float angle = time; | ||