aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'assets/shaders')
-rw-r--r--assets/shaders/Basic.frag.glsl17
-rw-r--r--assets/shaders/Taper.vert.glsl61
2 files changed, 78 insertions, 0 deletions
diff --git a/assets/shaders/Basic.frag.glsl b/assets/shaders/Basic.frag.glsl
new file mode 100644
index 00000000..a2c21afa
--- /dev/null
+++ b/assets/shaders/Basic.frag.glsl
@@ -0,0 +1,17 @@
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
13uniform vec4 color;
14
15void main() {
16 gl_FragColor = color;
17}
diff --git a/assets/shaders/Taper.vert.glsl b/assets/shaders/Taper.vert.glsl
new file mode 100644
index 00000000..46f04fb3
--- /dev/null
+++ b/assets/shaders/Taper.vert.glsl
@@ -0,0 +1,61 @@
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
13// attributes
14attribute vec3 vert;
15attribute vec3 normal;
16attribute vec2 texcoord;
17
18// scalar uniforms
19uniform float u_limit1;
20uniform float u_limit2;
21uniform float u_limit3;
22uniform float u_taperAmount;
23
24uniform vec4 color;
25
26
27// matrix uniforms
28uniform mat4 u_mvMatrix;
29uniform mat4 u_projMatrix;
30uniform mat4 u_worldMatrix;
31
32varying vec4 v_color;
33
34
35void main(void)
36{
37 vec3 pos = vert;
38 vec2 uv = texcoord;
39
40 v_color = vec4(0, 1, 0, 1);
41 if (uv.x > u_limit1)
42 {
43 if (uv.x < u_limit2)
44 {
45 float t = (uv.x - u_limit1)/(u_limit2 - u_limit1);
46 pos.y = pos.y - t*u_taperAmount;
47 v_color = vec4( 1, 1, 0, 1 );
48 }
49 else if (uv.x < u_limit3)
50 {
51 float t = 1.0 - (uv.x - u_limit2)/(u_limit3 - u_limit2);
52 pos.y = pos.y - t*u_taperAmount;
53 v_color = vec4( 0, 1, 1, 1 );
54 }
55 else
56 v_color = vec4(0,0,1,1);
57 }
58
59
60 gl_Position = u_projMatrix * u_mvMatrix * vec4(pos,1.0) ;
61} \ No newline at end of file