aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders
diff options
context:
space:
mode:
authorhwc4872012-05-25 13:35:10 -0700
committerhwc4872012-05-25 13:35:10 -0700
commit725c2175f20b5e0829518f725fd26cc077748bdf (patch)
treeb1dc12366de7df0434a9b99a191633587e4e0863 /assets/shaders
parentbc1b0276a3947e10f914e83f9750add4fa8b6c00 (diff)
downloadninja-725c2175f20b5e0829518f725fd26cc077748bdf.tar.gz
Parameters for twistVertex material
Diffstat (limited to 'assets/shaders')
-rw-r--r--assets/shaders/Cloud.frag.glsl2
-rw-r--r--assets/shaders/TwistVert.frag.glsl1
-rw-r--r--assets/shaders/TwistVert.vert.glsl11
3 files changed, 2 insertions, 12 deletions
diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl
index 2447fd79..cd70d1a0 100644
--- a/assets/shaders/Cloud.frag.glsl
+++ b/assets/shaders/Cloud.frag.glsl
@@ -18,8 +18,6 @@ varying vec2 v_texCoord0;
18void main() 18void main()
19{ 19{
20 vec4 c = texture2D(u_tex0, v_texCoord0); 20 vec4 c = texture2D(u_tex0, v_texCoord0);
21 //c.a *= u_surfaceAlpha;
22 //if ((c.r == 0.0) && (c.b == 0.0) && (c.g == 0.0) && (c.a == 1.0)) c = vec4( 0.0, 0.0, 1.0, 1.0 );
23 gl_FragColor = c; 21 gl_FragColor = c;
24} 22}
25 \ No newline at end of file 23 \ No newline at end of file
diff --git a/assets/shaders/TwistVert.frag.glsl b/assets/shaders/TwistVert.frag.glsl
index f8490615..01c32c42 100644
--- a/assets/shaders/TwistVert.frag.glsl
+++ b/assets/shaders/TwistVert.frag.glsl
@@ -28,5 +28,4 @@ void main()
28 col = texture2D(u_tex1, v_texcoord).xyz; 28 col = texture2D(u_tex1, v_texcoord).xyz;
29 29
30 gl_FragColor = vec4(col, 1.0); 30 gl_FragColor = vec4(col, 1.0);
31 //gl_FragColor = v_color;
32} 31}
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