From 86a801c057fc3b0580d6130be5740c2ee503444f Mon Sep 17 00:00:00 2001
From: hwc487
Date: Fri, 27 Jan 2012 15:52:36 -0800
Subject: updated from old repo
---
assets/shaders/Julia.frag.glsl | 25 +++++++++++++++
assets/shaders/Keleidoscope.frag.glsl | 25 +++++++++++++++
assets/shaders/Mandel.frag.glsl | 55 +++++++++++++++++++++++++++++++++
assets/shaders/Pulse.frag.glsl | 22 +++++++++++++
assets/shaders/Tunnel.frag.glsl | 23 ++++++++++++++
assets/shaders/Twist.frag.glsl | 23 ++++++++++++++
assets/shaders/plasma.frag.glsl | 32 +++++++++++++++++++
assets/shaders/plasma.vert.glsl | 42 +++++++++++++++++++++++++
assets/shaders/radialBlur.frag.glsl | 47 ++++++++++++++++++++++++++++
assets/shaders/radialGradient.frag.glsl | 51 ++++++++++++++++++++++++++++++
assets/shaders/radialGradient.vert.glsl | 28 +++++++++++++++++
assets/shaders/test_fshader.glsl | 25 +++++++--------
12 files changed, 385 insertions(+), 13 deletions(-)
create mode 100644 assets/shaders/Julia.frag.glsl
create mode 100644 assets/shaders/Keleidoscope.frag.glsl
create mode 100644 assets/shaders/Mandel.frag.glsl
create mode 100644 assets/shaders/Pulse.frag.glsl
create mode 100644 assets/shaders/Tunnel.frag.glsl
create mode 100644 assets/shaders/Twist.frag.glsl
create mode 100644 assets/shaders/plasma.frag.glsl
create mode 100644 assets/shaders/plasma.vert.glsl
create mode 100644 assets/shaders/radialBlur.frag.glsl
create mode 100644 assets/shaders/radialGradient.frag.glsl
create mode 100644 assets/shaders/radialGradient.vert.glsl
(limited to 'assets')
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 @@
+#ifdef GL_ES
+precision highp float;
+#endif
+
+uniform vec2 u_resolution;
+uniform float u_time;
+
+void main(void)
+{
+ vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy;
+ vec2 cc = vec2( cos(.25*u_time), sin(.25*u_time*1.423) );
+
+ float dmin = 1000.0;
+ vec2 z = p*vec2(1.33,1.0);
+ for( int i=0; i<64; i++ )
+ {
+ z = cc + vec2( z.x*z.x - z.y*z.y, 2.0*z.x*z.y );
+ float m2 = dot(z,z);
+ if( m2>100.0 ) break;
+ dmin=min(dmin,m2);
+ }
+
+ float color = sqrt(sqrt(dmin))*0.7;
+ gl_FragColor = vec4(color,color,color,1.0);
+}
\ 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 @@
+#ifdef GL_ES
+precision highp float;
+#endif
+
+uniform vec2 u_resolution;
+uniform float u_time;
+uniform sampler2D u_tex0;
+
+void main(void)
+{
+ vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy;
+ vec2 uv;
+
+ float a = atan(p.y,p.x);
+ float r = sqrt(dot(p,p));
+
+ uv.x = 7.0*a/3.1416;
+ uv.y = -u_time+ sin(7.0*r+u_time) + .7*cos(u_time+7.0*a);
+
+ float w = .5+.5*(sin(u_time+7.0*r)+ .7*cos(u_time+7.0*a));
+
+ vec3 col = texture2D(u_tex0,uv*.5).xyz;
+
+ gl_FragColor = vec4(col*w,1.0);
+}
\ 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 @@
+#ifdef GL_ES
+precision highp float;
+#endif
+
+uniform vec2 u_resolution;
+uniform float u_time;
+
+void main(void)
+{
+ vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy;
+ p.x *= u_resolution.x/u_resolution.y;
+
+ float zoo = .62+.38*sin(.1*u_time);
+ float coa = cos( 0.1*(1.0-zoo)*u_time );
+ float sia = sin( 0.1*(1.0-zoo)*u_time );
+ zoo = pow( zoo,8.0);
+ vec2 xy = vec2( p.x*coa-p.y*sia, p.x*sia+p.y*coa);
+ vec2 cc = vec2(-.745,.186) + xy*zoo;
+
+ vec2 z = vec2(0.0);
+ vec2 z2 = z*z;
+ float m2;
+ float co = 0.0;
+
+
+ // chrome/angelproject/nvidia/glslES don't seem to like to "break" a loop...
+ // so we have to rewrite it in another way
+/*
+ for( int i=0; i<256; i++ )
+ {
+ z = cc + vec2( z.x*z.x - z.y*z.y, 2.0*z.x*z.y );
+ m2 = dot(z,z);
+ if( m2>1024.0 ) break;
+ co += 1.0;
+ }
+*/
+
+ for( int i=0; i<256; i++ )
+ {
+ if( m2<1024.0 )
+ {
+ z = cc + vec2( z.x*z.x - z.y*z.y, 2.0*z.x*z.y );
+ m2 = dot(z,z);
+ co += 1.0;
+ }
+ }
+
+ co = co + 1.0 - log2(.5*log2(m2));
+
+ co = sqrt(co/256.0);
+ gl_FragColor = vec4( .5+.5*cos(6.2831*co+0.0),
+ .5+.5*cos(6.2831*co+0.4),
+ .5+.5*cos(6.2831*co+0.7),
+ 1.0 );
+}
\ 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 @@
+#ifdef GL_ES
+precision highp float;
+#endif
+
+uniform float u_time;
+uniform vec2 u_resolution;
+uniform sampler2D u_tex0;
+
+void main(void)
+{
+ vec2 halfres = u_resolution.xy/2.0;
+ vec2 cPos = gl_FragCoord.xy;
+
+ cPos.x -= 0.5*halfres.x*sin(u_time/2.0)+0.3*halfres.x*cos(u_time)+halfres.x;
+ cPos.y -= 0.4*halfres.y*sin(u_time/5.0)+0.3*halfres.y*cos(u_time)+halfres.y;
+ float cLength = length(cPos);
+
+ vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-u_time*10.0)/25.0;
+ vec3 col = texture2D(u_tex0,uv).xyz*50.0/cLength;
+
+ gl_FragColor = vec4(col,1.0);
+}
\ 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 @@
+#ifdef GL_ES
+precision highp float;
+#endif
+
+uniform vec2 u_resolution;
+uniform float u_time;
+uniform sampler2D u_tex0;
+
+void main(void)
+{
+ vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy;
+ vec2 uv;
+
+ float a = atan(p.y,p.x);
+ float r = sqrt(dot(p,p));
+
+ uv.x = .75*u_time+.1/r;
+ uv.y = a/3.1416;
+
+ vec3 col = texture2D(u_tex0,uv).xyz;
+
+ gl_FragColor = vec4(col*r,1.0);
+}
\ No newline at end of file
diff --git a/assets/shaders/Twist.frag.glsl b/assets/shaders/Twist.frag.glsl
new file mode 100644
index 00000000..b7477747
--- /dev/null
+++ b/assets/shaders/Twist.frag.glsl
@@ -0,0 +1,23 @@
+#ifdef GL_ES
+precision highp float;
+#endif
+
+uniform vec2 u_resolution;
+uniform float u_time;
+uniform sampler2D u_tex0;
+
+void main(void)
+{
+ vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy;
+ vec2 uv;
+
+ float a = atan(p.y,p.x);
+ float r = sqrt(dot(p,p));
+
+ uv.x = r - .25*u_time;
+ uv.y = cos(a*5.0 + 2.0*sin(u_time+7.0*r)) ;
+
+ vec3 col = (.5+.5*uv.y)*texture2D(u_tex0,uv).xyz;
+
+ gl_FragColor = vec4(col,1.0);
+}
\ No newline at end of file
diff --git a/assets/shaders/plasma.frag.glsl b/assets/shaders/plasma.frag.glsl
new file mode 100644
index 00000000..2ab8f49c
--- /dev/null
+++ b/assets/shaders/plasma.frag.glsl
@@ -0,0 +1,32 @@
+//
+// Fragment shader for procedural bricks
+//
+// Authors: Dave Baldwin, Steve Koren, Randi Rost
+// based on a shader by Darwyn Peachey
+//
+// Copyright (c) 2002-2006 3Dlabs Inc. Ltd.
+//
+// See 3Dlabs-License.txt for license information
+//
+
+#ifdef GL_ES
+precision highp float;
+#endif
+
+
+varying vec2 v_uv;
+uniform float u_time;
+uniform vec4 color;
+
+void main(void)
+{
+ float x = v_uv.x ;
+ float y = v_uv.y ;
+ float time = color.x;
+ float wave = (cos(time + y / 0.2 + cos(x / 0.3 + cos((y / 0.1)))));
+ float wave1 = (sin(abs(wave + y/0.6)));
+ float wave2 = (sin(abs(wave1 + y/0.8)));
+ float tmp = u_time * 0.1;
+ gl_FragColor = vec4( abs(vec3(wave2,wave1,wave)),1.0);
+ //gl_FragColor = color;
+}
diff --git a/assets/shaders/plasma.vert.glsl b/assets/shaders/plasma.vert.glsl
new file mode 100644
index 00000000..f817c143
--- /dev/null
+++ b/assets/shaders/plasma.vert.glsl
@@ -0,0 +1,42 @@
+//
+// Vertex shader for procedural bricks
+//
+// Authors: Dave Baldwin, Steve Koren, Randi Rost
+// based on a shader by Darwyn Peachey
+//
+// Copyright (c) 2002-2006 3Dlabs Inc. Ltd.
+//
+// See 3Dlabs-License.txt for license information
+//
+
+//uniform vec3 LightPosition;
+
+#ifdef GL_ES
+precision highp float;
+#endif
+
+
+// attributes
+attribute vec3 vert;
+attribute vec3 normal;
+attribute vec2 texcoord;
+
+uniform mat4 u_shadowLightWorld;
+uniform mat4 u_shadowBiasMatrix;
+uniform mat4 u_vShadowLight;
+uniform vec3 u_lightPos;
+
+// matrix uniforms
+uniform mat4 u_mvMatrix;
+uniform vec3 u_eye;
+uniform mat4 u_normalMatrix;
+uniform mat4 u_projMatrix;
+uniform mat4 u_worldMatrix;
+
+varying vec2 v_uv;
+
+void main(void)
+{
+ gl_Position = u_projMatrix * u_mvMatrix * vec4(vert,1.0) ;
+ v_uv = texcoord;
+}
\ No newline at end of file
diff --git a/assets/shaders/radialBlur.frag.glsl b/assets/shaders/radialBlur.frag.glsl
new file mode 100644
index 00000000..673d082a
--- /dev/null
+++ b/assets/shaders/radialBlur.frag.glsl
@@ -0,0 +1,47 @@
+
+precision highp float;
+
+uniform vec2 u_resolution;
+uniform float u_time;
+uniform vec4 color;
+uniform sampler2D u_tex0;
+
+vec3 deform( in vec2 p )
+{
+ vec2 uv;
+
+ //float time = color.x;
+ float time = u_time;
+ vec2 q = vec2( sin(1.1*time+p.x),sin(1.2*time+p.y) );
+
+ float a = atan(q.y,q.x);
+ float r = sqrt(dot(q,q));
+
+ uv.x = sin(0.0+1.0*time)+p.x*sqrt(r*r+1.0);
+ uv.y = sin(0.6+1.1*time)+p.y*sqrt(r*r+1.0);
+
+ return texture2D(u_tex0,uv*.5).xyz;
+}
+
+void main(void)
+{
+ vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy;
+ //vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / vec2(500,500).xy;
+ vec2 s = p;
+
+ vec3 total = vec3(0.0);
+ vec2 d = (vec2(0.0,0.0)-p)/40.0;
+ float w = 1.0;
+ for( int i=0; i<40; i++ )
+ {
+ vec3 res = deform(s);
+ res = smoothstep(0.1,1.0,res*res);
+ total += w*res;
+ w *= .99;
+ s += d;
+ }
+ total /= 40.0;
+ float r = 1.5/(1.0+dot(p,p));
+
+ gl_FragColor = vec4( total*r,1.0);
+}
\ No newline at end of file
diff --git a/assets/shaders/radialGradient.frag.glsl b/assets/shaders/radialGradient.frag.glsl
new file mode 100644
index 00000000..cd751750
--- /dev/null
+++ b/assets/shaders/radialGradient.frag.glsl
@@ -0,0 +1,51 @@
+/*
+This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
+ */
+
+#ifdef GL_ES
+precision highp float;
+#endif
+
+uniform vec4 u_color1;
+uniform vec4 u_color2;
+uniform vec4 u_color3;
+uniform vec4 u_color4;
+uniform float u_colorStop1;
+uniform float u_colorStop2;
+uniform float u_colorStop3;
+uniform float u_colorStop4;
+uniform vec2 u_cos_sin_angle;
+//uniform int u_colorCount; // currently using all 4
+
+varying vec2 v_uv;
+
+void main(void)
+{
+ vec2 pt = vec2( v_uv.x - 0.5, v_uv.y - 0.5);
+ float t = sqrt( dot(pt, pt) );
+
+ vec4 color;
+ if (t < u_colorStop1)
+ color = u_color1;
+ else if (t < u_colorStop2)
+ {
+ float tLocal = (t - u_colorStop1)/(u_colorStop2 - u_colorStop1);
+ color = mix(u_color1,u_color2,tLocal);
+ }
+ else if (t < u_colorStop3)
+ {
+ float tLocal = (t - u_colorStop2)/(u_colorStop3 - u_colorStop2);
+ color = mix(u_color2,u_color3,tLocal);
+ }
+ else if (t < u_colorStop4)
+ {
+ float tLocal = (t - u_colorStop3)/(u_colorStop4 - u_colorStop3);
+ color = mix(u_color3,u_color4,tLocal);
+ }
+ else
+ color = u_color4;
+
+ gl_FragColor = color;
+}
diff --git a/assets/shaders/radialGradient.vert.glsl b/assets/shaders/radialGradient.vert.glsl
new file mode 100644
index 00000000..c3e1b50a
--- /dev/null
+++ b/assets/shaders/radialGradient.vert.glsl
@@ -0,0 +1,28 @@
+/*
+This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
+ */
+
+
+#ifdef GL_ES
+precision highp float;
+#endif
+
+
+// attributes
+attribute vec3 vert;
+attribute vec3 normal;
+attribute vec2 texcoord;
+
+// matrix uniforms
+uniform mat4 u_mvMatrix;
+uniform mat4 u_projMatrix;
+
+varying vec2 v_uv;
+
+void main(void)
+{
+ gl_Position = u_projMatrix * u_mvMatrix * vec4(vert,1.0) ;
+ v_uv = texcoord;
+}
\ No newline at end of file
diff --git a/assets/shaders/test_fshader.glsl b/assets/shaders/test_fshader.glsl
index 3a0af39f..629d1878 100644
--- a/assets/shaders/test_fshader.glsl
+++ b/assets/shaders/test_fshader.glsl
@@ -4,7 +4,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
*/
-
#ifdef GL_ES
precision highp float;
#endif
@@ -15,18 +14,18 @@ uniform vec4 u_light0Diff;
uniform vec4 u_light0Amb;
// diffuse map
-uniform sampler2D colMap;
+uniform sampler2D u_colMap;
// environment map
uniform sampler2D envMap;
// normal map
-uniform sampler2D normalMap;
+uniform sampler2D u_normalMap;
-// glow map
-uniform sampler2D glowMap;
+// specular map
+uniform sampler2D u_glowMap;
-// glow map
+// depth map
uniform sampler2D depthMap;
//material uniforms
@@ -45,7 +44,7 @@ varying vec4 vShadowCoord;
varying vec2 vEnvTexCoord;
varying float vDiffuseIntensity;
-#ifdef PC
+#if defined( PC )
void main()
{
@@ -57,14 +56,14 @@ void main()
vec4 colMapTexel = vec4(0);
if (u_renderGlow <= 0.5) {
- colMapTexel = vec4(texture2D(colMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0);
+ colMapTexel = vec4(texture2D(u_colMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0);
} else {
- colMapTexel = vec4(texture2D(glowMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0);
+ colMapTexel = vec4(texture2D(u_glowMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0);
}
// normal mapping
vec3 normal = normalize(vNormal.xyz);
- vec3 mapNormal = texture2D(normalMap, vec2(vNormal.w, vECPos.w)).xyz * 2.0 - 1.0;
+ vec3 mapNormal = texture2D(u_normalMap, vec2(vNormal.w, vECPos.w)).xyz * 2.0 - 1.0;
mapNormal = normalize(mapNormal.x*vec3(normal.z, 0.0, -normal.x) + vec3(0.0, mapNormal.y, 0.0) + mapNormal.z*normal);
// create envmap coordinates
@@ -108,15 +107,15 @@ void main()
#endif
-#ifdef DEVICE
+#if defined( DEVICE )
void main()
{
- vec4 colMapTexel = vec4(texture2D(colMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0);
+ vec4 colMapTexel = vec4(texture2D(u_colMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0);
// // normal mapping
vec3 normal = normalize(vNormal.xyz);
-// vec3 mapNormal = texture2D(normalMap, vec2(vNormal.w, vECPos.w)).xyz * 2.0 - 1.0;
+// vec3 mapNormal = texture2D(u_normalMap, vec2(vNormal.w, vECPos.w)).xyz * 2.0 - 1.0;
// mapNormal = normalize(mapNormal.x*vec3(normal.z, 0.0, -normal.x) + vec3(0.0, mapNormal.y, 0.0) + mapNormal.z*normal);
//
// // create envmap coordinates
--
cgit v1.2.3