aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders/Taper.vert.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'assets/shaders/Taper.vert.glsl')
-rw-r--r--assets/shaders/Taper.vert.glsl66
1 files changed, 66 insertions, 0 deletions
diff --git a/assets/shaders/Taper.vert.glsl b/assets/shaders/Taper.vert.glsl
new file mode 100644
index 00000000..82151f13
--- /dev/null
+++ b/assets/shaders/Taper.vert.glsl
@@ -0,0 +1,66 @@
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;
23uniform float u_center;
24
25uniform vec4 color;
26
27
28// matrix uniforms
29uniform mat4 u_mvMatrix;
30uniform mat4 u_projMatrix;
31uniform mat4 u_worldMatrix;
32
33varying vec4 v_color;
34
35float TaperAmount( float param )
36{
37 float y0 = 1.0, y1 = 1.0, y2 = 0.0, y3 = 0.0;
38 float yA0 = y0 + param*(y1 - y0), yA1 = y1 + param*(y2 - y1), yA2 = y2 + param*(y3 - y2);
39 float yB0 = yA0 + param*(yA1 - yA0), yB1 = yA1 + param*(yA2 - yA1);
40 float yC0 = yB0 + param*(yB1 - yB0);
41
42 return yC0;
43}
44
45void main(void)
46{
47 vec3 pos = vert;
48 vec2 uv = texcoord;
49
50 v_color = vec4(texcoord.x, texcoord.y, 0, 1);
51 if (uv.x > u_limit1)
52 {
53 if (uv.x < u_limit2)
54 {
55 float t = (uv.x - u_limit1)/(u_limit2 - u_limit1);
56 pos.y = pos.y - pos.y*TaperAmount(t)*u_taperAmount;
57 }
58 else if (uv.x < u_limit3)
59 {
60 float t = 1.0 - (uv.x - u_limit2)/(u_limit3 - u_limit2);
61 pos.y = pos.y - pos.y*TaperAmount(t)*u_taperAmount;
62 }
63 }
64
65 gl_Position = u_projMatrix * u_mvMatrix * vec4(pos,1.0) ;
66} \ No newline at end of file