aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders/TwistVert.vert.glsl
diff options
context:
space:
mode:
authorArmen Kesablyan2012-06-20 15:00:34 -0700
committerArmen Kesablyan2012-06-20 15:00:34 -0700
commit38f571d1fdf02d36c3816637af7b2ca2493809da (patch)
tree69b97839be8b2b6fb65e9150d4dc02856041fb1d /assets/shaders/TwistVert.vert.glsl
parentf7c14e54c52bce8875cde81db621dde6f4ff1e34 (diff)
parent120e31dcf1e11eed11ee430d77c438e7b073e9f8 (diff)
downloadninja-38f571d1fdf02d36c3816637af7b2ca2493809da.tar.gz
Merge branch 'refs/heads/master' into binding
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