aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders/TwistVert.vert.glsl
diff options
context:
space:
mode:
authorJonathan Duran2012-06-19 08:40:26 -0700
committerJonathan Duran2012-06-19 08:40:26 -0700
commit6f25a2e70079de6bcbb8c3411ddef88c2ed1ea39 (patch)
tree253e5f6dd5923218e3155f78fa67ff3e43de0ebc /assets/shaders/TwistVert.vert.glsl
parentb51c9448bc187f9bfa3ab39c366657ec2bb9e2fb (diff)
parent483ad57efcd6475776f580c3af5b60e6deeaf781 (diff)
downloadninja-6f25a2e70079de6bcbb8c3411ddef88c2ed1ea39.tar.gz
Merge branch 'refs/heads/NINJAmaster' into TimelineUber
Diffstat (limited to 'assets/shaders/TwistVert.vert.glsl')
-rw-r--r--assets/shaders/TwistVert.vert.glsl11
1 files changed, 2 insertions, 9 deletions
diff --git a/assets/shaders/TwistVert.vert.glsl b/assets/shaders/TwistVert.vert.glsl
index 29cb30ea..9734063d 100644
--- a/assets/shaders/TwistVert.vert.glsl
+++ b/assets/shaders/TwistVert.vert.glsl
@@ -19,7 +19,7 @@ attribute vec2 texcoord;
19uniform float u_limit1; 19uniform float u_limit1;
20uniform float u_limit2; 20uniform float u_limit2;
21uniform float u_twistAmount; 21uniform float u_twistAmount;
22uniform float u_center; 22//uniform float u_center;
23 23
24// texture sampler uniforms 24// texture sampler uniforms
25uniform sampler2D u_tex0; 25uniform sampler2D u_tex0;
@@ -63,17 +63,14 @@ void main(void)
63 vec2 uv = texcoord; 63 vec2 uv = texcoord;
64 v_texcoord = texcoord; 64 v_texcoord = texcoord;
65 65
66 //v_color = vec4(texcoord.x, texcoord.y, 0, 1);
67
68 v_zNormal = 1.0; 66 v_zNormal = 1.0;
69 if (uv.x < u_limit2) 67 if (uv.x < u_limit2)
70 { 68 {
71 float angle = GetAngle( uv.x ); 69 float angle = GetAngle( uv.x );
72 float cs = cos(angle), sn = sin(angle); 70 float cs = cos(angle), sn = sin(angle);
73 71
74 pos.y -= u_center;
75 vec3 ctrPt = pos; 72 vec3 ctrPt = pos;
76 float y = pos.y*cs - pos.z*sn + u_center; 73 float y = pos.y*cs - pos.z*sn; // + u_center;
77 pos.z = pos.y*sn + pos.z*cs; 74 pos.z = pos.y*sn + pos.z*cs;
78 pos.y = y; 75 pos.y = y;
79 76
@@ -85,11 +82,7 @@ void main(void)
85 cs = cos(angle); sn = sin(angle); 82 cs = cos(angle); sn = sin(angle);
86 rotMat = mat3( vec3( 1.0, 0.0, 0.0 ), vec3( 0.0, cs, sn ), vec3( 0.0, -sn, cs ) ); 83 rotMat = mat3( vec3( 1.0, 0.0, 0.0 ), vec3( 0.0, cs, sn ), vec3( 0.0, -sn, cs ) );
87 pt2 = rotMat * pt2; 84 pt2 = rotMat * pt2;
88 pt0.y += u_center; pt1.y += u_center; pt2.y += u_center;
89 //vec4 nrm = u_projMatrix * u_mvMatrix * vec4( cross(pt1-pt0, pt2-pt0), 1.0 );
90 vec4 nrm = vec4( cross(pt1-pt0, pt2-pt0), 1.0 ); 85 vec4 nrm = vec4( cross(pt1-pt0, pt2-pt0), 1.0 );
91
92 //v_zNormal = normal.y*sn + normal.z*cs;
93 v_zNormal = -nrm.z; 86 v_zNormal = -nrm.z;
94 } 87 }
95 88