From 805059d68087530721212a650412aefb85e98d1f Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 9 Feb 2012 10:26:57 -0800 Subject: Removed unused materials. Signed-off-by: Nivesh Rajbhandari --- assets/shaders/Basic.frag.glsl | 19 ++++++++++++ assets/shaders/Basic.vert.glsl | 3 ++ assets/shaders/radialGradient.frag.glsl | 51 +++++++++++++++++++++++++++++++++ assets/shaders/radialGradient.vert.glsl | 28 ++++++++++++++++++ assets/shaders/test_fshader.glsl | 25 ++++++++-------- 5 files changed, 113 insertions(+), 13 deletions(-) create mode 100644 assets/shaders/Basic.frag.glsl create mode 100644 assets/shaders/radialGradient.frag.glsl create mode 100644 assets/shaders/radialGradient.vert.glsl (limited to 'assets/shaders') diff --git a/assets/shaders/Basic.frag.glsl b/assets/shaders/Basic.frag.glsl new file mode 100644 index 00000000..c1f9a5c8 --- /dev/null +++ b/assets/shaders/Basic.frag.glsl @@ -0,0 +1,19 @@ +/* +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 color; +varying vec4 v_color; + +void main() { + gl_FragColor = v_color; + //gl_FragColor = color; +} diff --git a/assets/shaders/Basic.vert.glsl b/assets/shaders/Basic.vert.glsl index 028786d1..40b97ad7 100644 --- a/assets/shaders/Basic.vert.glsl +++ b/assets/shaders/Basic.vert.glsl @@ -12,7 +12,9 @@ precision highp float; // attributes attribute vec3 a_pos; +attribute vec2 texcoord; +varying vec4 v_color; // matrix uniforms @@ -22,5 +24,6 @@ uniform mat4 u_worldMatrix; void main(void) { + v_color = vec4(texcoord.x, texcoord.y, 0, 1); gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,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 From a9a02ef8a206082ea9ea0cb66f3fb70e1f4256df Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 9 Feb 2012 11:45:16 -0800 Subject: Undoing experimental changes from the basic webgl shaders. Signed-off-by: Nivesh Rajbhandari --- assets/shaders/Basic.frag.glsl | 4 +--- assets/shaders/Basic.vert.glsl | 3 --- 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'assets/shaders') diff --git a/assets/shaders/Basic.frag.glsl b/assets/shaders/Basic.frag.glsl index c1f9a5c8..a2c21afa 100644 --- a/assets/shaders/Basic.frag.glsl +++ b/assets/shaders/Basic.frag.glsl @@ -11,9 +11,7 @@ precision highp float; uniform vec4 color; -varying vec4 v_color; void main() { - gl_FragColor = v_color; - //gl_FragColor = color; + gl_FragColor = color; } diff --git a/assets/shaders/Basic.vert.glsl b/assets/shaders/Basic.vert.glsl index 40b97ad7..0d5b8d63 100644 --- a/assets/shaders/Basic.vert.glsl +++ b/assets/shaders/Basic.vert.glsl @@ -14,8 +14,6 @@ precision highp float; attribute vec3 a_pos; attribute vec2 texcoord; -varying vec4 v_color; - // matrix uniforms uniform mat4 u_mvMatrix; @@ -24,6 +22,5 @@ uniform mat4 u_worldMatrix; void main(void) { - v_color = vec4(texcoord.x, texcoord.y, 0, 1); gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ; } \ No newline at end of file -- cgit v1.2.3