aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders/Taper.vert.glsl
diff options
context:
space:
mode:
authorhwc4872012-02-01 13:05:32 -0800
committerhwc4872012-02-01 13:05:32 -0800
commitb2ce8b819cc85a558d862c04965b7e65a6ce8640 (patch)
tree520fb12c07ba78f93d22f693369db45248c448d1 /assets/shaders/Taper.vert.glsl
parentaa1b4b78d9e1b9cc15529dbf7196b7ac8a88e260 (diff)
downloadninja-b2ce8b819cc85a558d862c04965b7e65a6ce8640.tar.gz
changes to allow minimal rendering ofnon-animated materials.
Diffstat (limited to 'assets/shaders/Taper.vert.glsl')
-rw-r--r--assets/shaders/Taper.vert.glsl61
1 files changed, 61 insertions, 0 deletions
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