aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders
diff options
context:
space:
mode:
authorKris Kowal2012-07-06 11:52:06 -0700
committerKris Kowal2012-07-06 15:01:48 -0700
commit648ee61ae84216d0236e0dbc211addc13b2cfa3a (patch)
tree8f0f55557bd0c47a84e49c1977c950645d284607 /assets/shaders
parentaedd14b18695d031f695d27dfbd94df5614495bb (diff)
downloadninja-648ee61ae84216d0236e0dbc211addc13b2cfa3a.tar.gz
Expand tabs
Diffstat (limited to 'assets/shaders')
-rwxr-xr-xassets/shaders/Basic.vert.glsl6
-rw-r--r--assets/shaders/BasicTex.frag.glsl2
-rw-r--r--assets/shaders/Cloud.frag.glsl6
-rw-r--r--assets/shaders/Cloud.vert.glsl28
-rw-r--r--assets/shaders/Flag.vert.glsl22
-rw-r--r--assets/shaders/Taper.vert.glsl152
-rw-r--r--assets/shaders/TwistVert.frag.glsl8
-rw-r--r--assets/shaders/TwistVert.vert.glsl84
-rwxr-xr-xassets/shaders/linearGradient.frag.glsl68
-rwxr-xr-xassets/shaders/linearGradient.vert.glsl30
-rw-r--r--assets/shaders/radialGradient.frag.glsl70
-rw-r--r--assets/shaders/radialGradient.vert.glsl8
-rwxr-xr-xassets/shaders/test_fshader.glsl18
-rwxr-xr-xassets/shaders/test_fshader_full.glsl8
-rwxr-xr-xassets/shaders/test_vshader.glsl60
-rwxr-xr-xassets/shaders/ub_fshader.glsl414
-rwxr-xr-xassets/shaders/ub_vshader.glsl232
17 files changed, 608 insertions, 608 deletions
diff --git a/assets/shaders/Basic.vert.glsl b/assets/shaders/Basic.vert.glsl
index ae454411..80b2f088 100755
--- a/assets/shaders/Basic.vert.glsl
+++ b/assets/shaders/Basic.vert.glsl
@@ -39,7 +39,7 @@ attribute vec3 a_pos;
39attribute vec2 texcoord; 39attribute vec2 texcoord;
40 40
41// varying 41// varying
42varying vec2 v_texCoord0; 42varying vec2 v_texCoord0;
43 43
44// matrix uniforms 44// matrix uniforms
45uniform mat4 u_mvMatrix; 45uniform mat4 u_mvMatrix;
@@ -48,6 +48,6 @@ uniform mat4 u_worldMatrix;
48 48
49void main(void) 49void main(void)
50{ 50{
51 v_texCoord0 = texcoord; 51 v_texCoord0 = texcoord;
52 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ; 52 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ;
53} 53}
diff --git a/assets/shaders/BasicTex.frag.glsl b/assets/shaders/BasicTex.frag.glsl
index 4fee288d..d89e2ead 100644
--- a/assets/shaders/BasicTex.frag.glsl
+++ b/assets/shaders/BasicTex.frag.glsl
@@ -35,7 +35,7 @@ precision highp float;
35 35
36uniform sampler2D u_tex0; 36uniform sampler2D u_tex0;
37 37
38varying vec2 v_texCoord0; 38varying vec2 v_texCoord0;
39 39
40 40
41void main() { 41void main() {
diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl
index 85a43699..dc984191 100644
--- a/assets/shaders/Cloud.frag.glsl
+++ b/assets/shaders/Cloud.frag.glsl
@@ -36,12 +36,12 @@ precision highp float;
36uniform sampler2D u_tex0; 36uniform sampler2D u_tex0;
37uniform float u_surfaceAlpha; 37uniform float u_surfaceAlpha;
38 38
39varying vec2 v_texCoord0; 39varying vec2 v_texCoord0;
40 40
41 41
42void main() 42void main()
43{ 43{
44 vec4 c = texture2D(u_tex0, v_texCoord0); 44 vec4 c = texture2D(u_tex0, v_texCoord0);
45 gl_FragColor = c; 45 gl_FragColor = c;
46} 46}
47 47
diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl
index 95c14132..c709bc27 100644
--- a/assets/shaders/Cloud.vert.glsl
+++ b/assets/shaders/Cloud.vert.glsl
@@ -34,7 +34,7 @@ precision highp float;
34#endif 34#endif
35 35
36// attributes 36// attributes
37attribute vec3 a_pos; 37attribute vec3 a_pos;
38attribute vec2 texcoord; 38attribute vec2 texcoord;
39 39
40// uniforms 40// uniforms
@@ -48,7 +48,7 @@ uniform mat4 u_mvMatrix;
48uniform mat4 u_projMatrix; 48uniform mat4 u_projMatrix;
49 49
50// varying 50// varying
51varying vec2 v_texCoord0; 51varying vec2 v_texCoord0;
52 52
53// constants 53// constants
54const float zSpeed = 10.0; 54const float zSpeed = 10.0;
@@ -57,19 +57,19 @@ const float zSpeed = 10.0;
57void main() 57void main()
58{ 58{
59 // Transform position 59 // Transform position
60 vec4 pos = vec4(a_pos,1); 60 vec4 pos = vec4(a_pos,1);
61 61
62 float dz = u_time*zSpeed; 62 float dz = u_time*zSpeed;
63 float n = floor( dz/(u_zmax-u_zmin) ); 63 float n = floor( dz/(u_zmax-u_zmin) );
64 dz -= n*(u_zmax - u_zmin); 64 dz -= n*(u_zmax - u_zmin);
65 float z = pos.z + dz; 65 float z = pos.z + dz;
66 if (z > u_zmax) 66 if (z > u_zmax)
67 { 67 {
68 z = u_zmin + (z - u_zmax); 68 z = u_zmin + (z - u_zmax);
69 } 69 }
70 pos.z = z; 70 pos.z = z;
71 71
72 gl_Position = u_projMatrix * u_mvMatrix * pos; 72 gl_Position = u_projMatrix * u_mvMatrix * pos;
73 73
74 v_texCoord0 = texcoord; 74 v_texCoord0 = texcoord;
75} 75}
diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl
index fe3ff722..49eaaccb 100644
--- a/assets/shaders/Flag.vert.glsl
+++ b/assets/shaders/Flag.vert.glsl
@@ -55,21 +55,21 @@ varying vec2 v_uv;
55 55
56void main() 56void main()
57{ 57{
58 float time = u_time * u_speed; 58 float time = u_time * u_speed;
59 const float pi = 3.14159; 59 const float pi = 3.14159;
60 float angle = time; 60 float angle = time;
61 61
62 v_uv = texcoord; 62 v_uv = texcoord;
63 63
64 float x = 2.0*pi*texcoord.x/u_waveWidth; 64 float x = 2.0*pi*texcoord.x/u_waveWidth;
65 float y = 2.0*pi*texcoord.y; 65 float y = 2.0*pi*texcoord.y;
66 66
67 vec3 v = a_pos; 67 vec3 v = a_pos;
68 v.z = sin( x + angle ); 68 v.z = sin( x + angle );
69 v.z += sin( 0.2*y + angle); 69 v.z += sin( 0.2*y + angle);
70 v.z *= u_waveHeight; 70 v.z *= u_waveHeight;
71 v.z -= 2.0*u_waveHeight; 71 v.z -= 2.0*u_waveHeight;
72 v.z *= x * 0.09; 72 v.z *= x * 0.09;
73 73
74 gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; 74 gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ;
75} 75}
diff --git a/assets/shaders/Taper.vert.glsl b/assets/shaders/Taper.vert.glsl
index 5fe173b2..e55aeede 100644
--- a/assets/shaders/Taper.vert.glsl
+++ b/assets/shaders/Taper.vert.glsl
@@ -60,85 +60,85 @@ varying vec4 v_color;
60 60
61float TaperAmount( float param ) 61float TaperAmount( float param )
62{ 62{
63 // Bezier coordinates of the X coordinate. 63 // Bezier coordinates of the X coordinate.
64 // Adjust these to get tighter or looser 64 // Adjust these to get tighter or looser
65 float tightness = 0.8; 65 float tightness = 0.8;
66 66
67 float x0, y0, x1, y1, x2, y2; 67 float x0, y0, x1, y1, x2, y2;
68 float t; 68 float t;
69 if (param < 0.5) 69 if (param < 0.5)
70 { 70 {
71 t = 2.0*param; 71 t = 2.0*param;
72 x0 = 0.0; y0 = 0.0; 72 x0 = 0.0; y0 = 0.0;
73 x1 = tightness; y1 = 0.0; 73 x1 = tightness; y1 = 0.0;
74 x2 = 1.0; y2 = 0.5; 74 x2 = 1.0; y2 = 0.5;
75 } 75 }
76 else 76 else
77 { 77 {
78 t = (param - 0.5)*2.0; 78 t = (param - 0.5)*2.0;
79 x0 = 0.0; y0 = 0.5; 79 x0 = 0.0; y0 = 0.5;
80 x1 = 1.0 - tightness; y1 = 1.0; 80 x1 = 1.0 - tightness; y1 = 1.0;
81 x2 = 1.0; y2 = 1.0; 81 x2 = 1.0; y2 = 1.0;
82 } 82 }
83 83
84 float a = x0 - 2.0*x1 + x2; 84 float a = x0 - 2.0*x1 + x2;
85 float b = 2.0*(x1 - x0); 85 float b = 2.0*(x1 - x0);
86 float c = x0 - t; 86 float c = x0 - t;
87 87
88 float descr = sqrt( b*b - 4.0*a*c ); 88 float descr = sqrt( b*b - 4.0*a*c );
89 float denom = 2.0*a; 89 float denom = 2.0*a;
90 float n1 = (-b + descr)/denom; 90 float n1 = (-b + descr)/denom;
91 float n2 = (-b - descr)/denom; 91 float n2 = (-b - descr)/denom;
92 if ((n1 >= 0.0) || (n1 <= 1.0)) t = n1; 92 if ((n1 >= 0.0) || (n1 <= 1.0)) t = n1;
93 else if ((n2 >= 0.0) || (n2 <= 1.0)) t = n2; 93 else if ((n2 >= 0.0) || (n2 <= 1.0)) t = n2;
94 else 94 else
95 t = 0.0; 95 t = 0.0;
96 96
97 float ya = y0 + t*(y1 - y0); 97 float ya = y0 + t*(y1 - y0);
98 float yb = y1 + t*(y2 - y1); 98 float yb = y1 + t*(y2 - y1);
99 float yc = ya + t*(yb - ya); 99 float yc = ya + t*(yb - ya);
100 100
101 return yc; 101 return yc;
102} 102}
103 103
104 104