aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders
diff options
context:
space:
mode:
authorPushkar Joshi2012-02-02 11:28:45 -0800
committerPushkar Joshi2012-02-02 11:28:45 -0800
commitacc500d1f1c76f4e7c93ae1cfea8d925ca95e7b9 (patch)
tree877f8ca734228c11050b037ce82fc0d1e1303193 /assets/shaders
parent4d4de64472603426a73b26cc98ba8206190949b8 (diff)
parent4222db97e353fb65fab787ba5927d16d9fa4e1f7 (diff)
downloadninja-acc500d1f1c76f4e7c93ae1cfea8d925ca95e7b9.tar.gz
Merge branch 'working' of c:/Code/github/emueller/ninja-internal/ into pentool
Diffstat (limited to 'assets/shaders')
-rw-r--r--assets/shaders/Basic.frag.glsl17
-rw-r--r--assets/shaders/Julia.frag.glsl25
-rw-r--r--assets/shaders/Keleidoscope.frag.glsl25
-rw-r--r--assets/shaders/Mandel.frag.glsl55
-rw-r--r--assets/shaders/Pulse.frag.glsl22
-rw-r--r--assets/shaders/Taper.vert.glsl61
-rw-r--r--assets/shaders/Tunnel.frag.glsl23
-rw-r--r--assets/shaders/Twist.frag.glsl23
-rw-r--r--assets/shaders/plasma.frag.glsl32
-rw-r--r--assets/shaders/plasma.vert.glsl42
-rw-r--r--assets/shaders/radialBlur.frag.glsl47
-rw-r--r--assets/shaders/radialGradient.frag.glsl51
-rw-r--r--assets/shaders/radialGradient.vert.glsl28
-rw-r--r--assets/shaders/test_fshader.glsl25
14 files changed, 463 insertions, 13 deletions
diff --git a/assets/shaders/Basic.frag.glsl b/assets/shaders/Basic.frag.glsl
new file mode 100644
index 00000000..a2c21afa
--- /dev/null
+++ b/assets/shaders/Basic.frag.glsl
@@ -0,0 +1,17 @@
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
13uniform vec4 color;
14
15void main() {
16 gl_FragColor = color;
17}
diff --git a/assets/shaders/Julia.frag.glsl b/assets/shaders/Julia.frag.glsl
new file mode 100644
index 00000000..68cda703
--- /dev/null
+++ b/assets/shaders/Julia.frag.glsl
@@ -0,0 +1,25 @@
1#ifdef GL_ES
2precision highp float;
3#endif
4
5uniform vec2 u_resolution;
6uniform float u_time;
7
8void main(void)
9{
10 vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy;
11 vec2 cc = vec2( cos(.25*u_time), sin(.25*u_time*1.423) );
12
13 float dmin = 1000.0;
14 vec2 z = p*vec2(1.33,1.0);
15 for( int i=0; i<64; i++ )
16 {
17 z = cc + vec2( z.x*z.x - z.y*z.y, 2.0*z.x*z.y );
18 float m2 = dot(z,z);
19 if( m2>100.0 ) break;
20 dmin=min(dmin,m2);
21 }
22
23 float color = sqrt(sqrt(dmin))*0.7;
24 gl_FragColor = vec4(color,color,color,1.0);
25} \ No newline at end of file
diff --git a/assets/shaders/Keleidoscope.frag.glsl b/assets/shaders/Keleidoscope.frag.glsl
new file mode 100644
index 00000000..7d1bdb17
--- /dev/null
+++ b/assets/shaders/Keleidoscope.frag.glsl
@@ -0,0 +1,25 @@
1#ifdef GL_ES
2precision highp float;
3#endif
4
5uniform vec2 u_resolution;
6uniform float u_time;
7uniform sampler2D u_tex0;
8
9void main(void)
10{
11 vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy;
12 vec2 uv;
13
14 float a = atan(p.y,p.x);
15 float r = sqrt(dot(p,p));
16
17 uv.x = 7.0*a/3.1416;
18 uv.y = -u_time+ sin(7.0*r+u_time) + .7*cos(u_time+7.0*a);
19
20 float w = .5+.5*(sin(u_time+7.0*r)+ .7*cos(u_time+7.0*a));
21
22 vec3 col = texture2D(u_tex0,uv*.5).xyz;
23
24 gl_FragColor = vec4(col*w,1.0);
25} \ No newline at end of file
diff --git a/assets/shaders/Mandel.frag.glsl b/assets/shaders/Mandel.frag.glsl
new file mode 100644
index 00000000..6465899d
--- /dev/null
+++ b/assets/shaders/Mandel.frag.glsl
@@ -0,0 +1,55 @@
1#ifdef GL_ES
2precision highp float;
3#endif
4
5uniform vec2 u_resolution;
6uniform float u_time;
7
8void main(void)
9{
10 vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy;
11 p.x *= u_resolution.x/u_resolution.y;
12
13 float zoo = .62+.38*sin(.1*u_time);
14 float coa = cos( 0.1*(1.0-zoo)*u_time );
15 float sia = sin( 0.1*(1.0-zoo)*u_time );
16 zoo = pow( zoo,8.0);
17 vec2 xy = vec2( p.x*coa-p.y*sia, p.x*sia+p.y*coa);
18 vec2 cc = vec2(-.745,.186) + xy*zoo;
19
20 vec2 z = vec2(0.0);
21 vec2 z2 = z*z;
22 float m2;
23 float co = 0.0;
24
25
26 // chrome/angelproject/nvidia/glslES don't seem to like to "break" a loop...
27 // so we have to rewrite it in another way
28/*
29 for( int i=0; i<256; i++ )
30 {
31 z = cc + vec2( z.x*z.x - z.y*z.y, 2.0*z.x*z.y );
32 m2 = dot(z,z);
33 if( m2>1024.0 ) break;
34 co += 1.0;
35 }
36*/
37
38 for( int i=0; i<256; i++ )
39 {
40 if( m2<1024.0 )
41 {
42 z = cc + vec2( z.x*z.x - z.y*z.y, 2.0*z.x*z.y );
43 m2 = dot(z,z);
44 co += 1.0;
45 }
46 }
47
48 co = co + 1.0 - log2(.5*log2(m2));
49
50 co = sqrt(co/256.0);
51 gl_FragColor = vec4( .5+.5*cos(6.2831*co+0.0),
52 .5+.5*cos(6.2831*co+0.4),
53 .5+.5*cos(6.2831*co+0.7),
54 1.0 );
55} \ No newline at end of file
diff --git a/assets/shaders/Pulse.frag.glsl b/assets/shaders/Pulse.frag.glsl
new file mode 100644
index 00000000..b24c9bef
--- /dev/null
+++ b/assets/shaders/Pulse.frag.glsl
@@ -0,0 +1,22 @@
1#ifdef GL_ES
2precision highp float;
3#endif
4
5uniform float u_time;
6uniform vec2 u_resolution;
7uniform sampler2D u_tex0;
8
9void main(void)
10{
11 vec2 halfres = u_resolution.xy/2.0;
12 vec2 cPos = gl_FragCoord.xy;
13
14 cPos.x -= 0.5*halfres.x*sin(u_time/2.0)+0.3*halfres.x*cos(u_time)+halfres.x;
15 cPos.y -= 0.4*halfres.y*sin(u_time/5.0)+0.3*halfres.y*cos(u_time)+halfres.y;
16 float cLength = length(cPos);
17
18 vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-u_time*10.0)/25.0;
19 vec3 col = texture2D(u_tex0,uv).xyz*50.0/cLength;
20
21 gl_FragColor = vec4(col,1.0);
22} \ No newline at end of file
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
diff --git a/assets/shaders/Tunnel.frag.glsl b/assets/shaders/Tunnel.frag.glsl
new file mode 100644
index 00000000..9deb52fb
--- /dev/null
+++ b/assets/shaders/Tunnel.frag.glsl
@@ -0,0 +1,23 @@
1#ifdef GL_ES
2precision highp float;