Revision: 8914
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8914&view=rev
Author:   natepak
Date:     2010-09-20 21:58:33 +0000 (Mon, 20 Sep 2010)

Log Message:
-----------
Renamed glsl programs

Added Paths:
-----------
    code/gazebo/branches/wx/Media/materials/programs/ambient_one_texture_vp.glsl
    code/gazebo/branches/wx/Media/materials/programs/shadow_caster_fp.glsl
    code/gazebo/branches/wx/Media/materials/programs/shadow_caster_vp.glsl
    code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_fp.glsl
    code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_vp.glsl

Removed Paths:
-------------
    code/gazebo/branches/wx/Media/materials/programs/Ambient.frag
    code/gazebo/branches/wx/Media/materials/programs/Ambient.vert
    code/gazebo/branches/wx/Media/materials/programs/AmbientOneTexture.frag
    code/gazebo/branches/wx/Media/materials/programs/AmbientOneTexture.glsl
    code/gazebo/branches/wx/Media/materials/programs/AmbientOneTexture.vert
    code/gazebo/branches/wx/Media/materials/programs/DepthMap.frag
    code/gazebo/branches/wx/Media/materials/programs/DepthMap.vert
    code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapCasterFp.glsl
    code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapCasterVp.glsl
    
code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapReceiverFp.glsl
    
code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapReceiverVp.glsl
    code/gazebo/branches/wx/Media/materials/programs/DirectionalLight.frag
    code/gazebo/branches/wx/Media/materials/programs/DirectionalLight.vert
    code/gazebo/branches/wx/Media/materials/programs/PointLight.frag
    code/gazebo/branches/wx/Media/materials/programs/PointLight.vert
    code/gazebo/branches/wx/Media/materials/programs/SpotLight.frag
    code/gazebo/branches/wx/Media/materials/programs/SpotLight.vert
    code/gazebo/branches/wx/Media/materials/programs/pssm.cg
    code/gazebo/branches/wx/Media/materials/programs/pssm.hlsl
    code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_caster_fp.glsl
    code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_caster_vp.glsl
    code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_receiver_fp.glsl
    code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_receiver_vp.glsl

Deleted: code/gazebo/branches/wx/Media/materials/programs/Ambient.frag
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/Ambient.frag       
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/Ambient.frag       
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,4 +0,0 @@
-void main()
-{
-  gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
-}

Deleted: code/gazebo/branches/wx/Media/materials/programs/Ambient.vert
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/Ambient.vert       
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/Ambient.vert       
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,7 +0,0 @@
-
-void main()
-{
-       gl_Position = ftransform();
-       //gl_TexCoord[0] = gl_MultiTexCoord0;
-       gl_FrontColor = gl_Color;
-}

Deleted: code/gazebo/branches/wx/Media/materials/programs/AmbientOneTexture.frag
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/AmbientOneTexture.frag     
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/AmbientOneTexture.frag     
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,13 +0,0 @@
-// if you want to use more textures, don't forget to define them there
-uniform sampler2D diffuse_map;
-//uniform sampler2D diffuse_map2;
-//uniform sampler2D diffuse_map3;
-//uniform sampler2D diffuse_map4;
-
-varying float fogFactor;
-
-void main()
-{
-  vec4 color = texture2D( diffuse_map, gl_TexCoord[ 0 ].st ) * gl_Color;
-       gl_FragColor = mix(  vec4(gl_Fog.color), color, fogFactor);
-}

Deleted: code/gazebo/branches/wx/Media/materials/programs/AmbientOneTexture.glsl
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/AmbientOneTexture.glsl     
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/AmbientOneTexture.glsl     
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,13 +0,0 @@
-uniform vec4 ambient;
-
-/*
-  Basic ambient lighting vertex program
-*/
-void main()
-{
-       gl_Position = ftransform();
-       gl_TexCoord[0] = gl_MultiTexCoord0;
-       gl_FrontColor = ambient;
-}
-
-

Deleted: code/gazebo/branches/wx/Media/materials/programs/AmbientOneTexture.vert
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/AmbientOneTexture.vert     
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/AmbientOneTexture.vert     
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,28 +0,0 @@
-varying float fogFactor;
-
-void main()
-{
-  vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
-
-       gl_FrontColor = gl_LightModel.ambient * gl_FrontMaterial.ambient;
-       
-       // if you want to use more tex-coords, don't forget to assign them there
-       gl_TexCoord[ 0 ] = gl_MultiTexCoord0;
-       //gl_TexCoord[ 1 ] = gl_MultiTexCoord1;
-       //gl_TexCoord[ 2 ] = gl_MultiTexCoord2;
-       //gl_TexCoord[ 3 ] = gl_MultiTexCoord3;
-
-  // Compute the amount of fog to apply
-  if ( gl_Fog.end != 0.0)
-  {
-    fogFactor = clamp((gl_Fog.end - fabs(ecPosition.z)) * gl_Fog.scale,0,1);
-  }
-  else
-  {
-    fogFactor = 1.0;
-  }
-
-
-  
-       gl_Position = ftransform();
-}

Deleted: code/gazebo/branches/wx/Media/materials/programs/DepthMap.frag
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/DepthMap.frag      
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/DepthMap.frag      
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,9 +0,0 @@
-varying float depth;
-
-void main()
-{
-  float f = depth;
-
-  //f = 0.0;
-  gl_FragColor = vec4(f, f, f, f);
-}

Deleted: code/gazebo/branches/wx/Media/materials/programs/DepthMap.vert
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/DepthMap.vert      
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/DepthMap.vert      
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,14 +0,0 @@
-uniform vec4 texelOffsets;
-uniform float pNear;
-uniform float pFar;
-
-varying float depth;
-
-void main()
-{
-       gl_Position = ftransform();
-  gl_Position.xy += texelOffsets.zw * gl_Position.w;
-
-  //depth = gl_Position.z / (pFar - pNear);
-  depth = (gl_Position.z - pNear) / (pFar - pNear);
-}

Deleted: 
code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapCasterFp.glsl
===================================================================
--- 
code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapCasterFp.glsl    
    2010-09-20 21:55:19 UTC (rev 8913)
+++ 
code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapCasterFp.glsl    
    2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,16 +0,0 @@
-
-varying vec2 depth;
-
-void main()
-{
-#if LINEAR_RANGE
-       float finalDepth = depth.x;
-#else
-       float finalDepth = depth.x / depth.y;
-#endif
-       // just smear across all components 
-       // therefore this one needs high individual channel precision
-       gl_FragColor = vec4(finalDepth, finalDepth, finalDepth, 1);
-
-}
-

Deleted: 
code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapCasterVp.glsl
===================================================================
--- 
code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapCasterVp.glsl    
    2010-09-20 21:55:19 UTC (rev 8913)
+++ 
code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapCasterVp.glsl    
    2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,24 +0,0 @@
-uniform mat4 worldViewProj;
-uniform vec4 texelOffsets;
-uniform vec4 depthRange;
-
-varying vec2 depth;
-
-void main()
-{
-       gl_Position = ftransform();
-
-       // fix pixel / texel alignment
-       gl_Position.xy += texelOffsets.zw * gl_Position.w;
-       // linear depth storage
-       // offset / scale range output
-#if LINEAR_RANGE
-       depth.x = (gl_Position.z - depthRange.x) * depthRange.w;
-#else
-       depth.x = gl_Position.z;
-#endif
-       depth.y = gl_Position.w;
-
-
-}
-

Deleted: 
code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapReceiverFp.glsl
===================================================================
--- 
code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapReceiverFp.glsl  
    2010-09-20 21:55:19 UTC (rev 8913)
+++ 
code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapReceiverFp.glsl  
    2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,66 +0,0 @@
-uniform float inverseShadowmapSize;
-uniform float fixedDepthBias;
-uniform float gradientClamp;
-uniform float gradientScaleBias;
-uniform float shadowFuzzyWidth;
-
-uniform sampler2D shadowMap;
-
-void main()
-{
-       vec4 shadowUV = gl_TexCoord[0];
-       // point on shadowmap
-#if LINEAR_RANGE
-       shadowUV.xy = shadowUV.xy / shadowUV.w;
-#else
-       shadowUV = shadowUV / shadowUV.w;
-#endif
-       float centerdepth = texture2D(shadowMap, shadowUV.xy).x;
-    
-    // gradient calculation
-       float pixeloffset = inverseShadowmapSize;
-    vec4 depths = vec4(
-       texture2D(shadowMap, shadowUV.xy + vec2(-pixeloffset, 0)).x,
-       texture2D(shadowMap, shadowUV.xy + vec2(+pixeloffset, 0)).x,
-       texture2D(shadowMap, shadowUV.xy + vec2(0, -pixeloffset)).x,
-       texture2D(shadowMap, shadowUV.xy + vec2(0, +pixeloffset)).x);
-
-       vec2 differences = abs( depths.yw - depths.xz );
-       float gradient = min(gradientClamp, max(differences.x, differences.y));
-       float gradientFactor = gradient * gradientScaleBias;
-
-       // visibility function
-       float depthAdjust = gradientFactor + (fixedDepthBias * centerdepth);
-       float finalCenterDepth = centerdepth + depthAdjust;
-
-       // shadowUV.z contains lightspace position of current object
-
-#if FUZZY_TEST
-       // fuzzy test - introduces some ghosting in result and doesn't appear 
to be needed?
-       //float visibility = saturate(1 + delta_z / (gradient * 
shadowFuzzyWidth));
-       float visibility = saturate(1 + (finalCenterDepth - shadowUV.z) * 
shadowFuzzyWidth * shadowUV.w);
-
-       gl_FragColor = vertexColour * visibility;
-#else
-       // hard test
-#if PCF
-       // use depths from prev, calculate diff
-       depths += depthAdjust;
-       float final = (finalCenterDepth > shadowUV.z) ? 1.0 : 0.0;
-       final += (depths.x > shadowUV.z) ? 1.0 : 0.0;
-       final += (depths.y > shadowUV.z) ? 1.0 : 0.0;
-       final += (depths.z > shadowUV.z) ? 1.0 : 0.0;
-       final += (depths.w > shadowUV.z) ? 1.0 : 0.0;
-       
-       final *= 0.2;
-
-       gl_FragColor = vec4(gl_Color.xyz * final, 1);
-       
-#else
-       gl_FragColor = (finalCenterDepth > shadowUV.z) ? gl_Color : 
vec4(0,0,0,1);
-#endif
-
-#endif
-   
-}
-

Deleted: 
code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapReceiverVp.glsl
===================================================================
--- 
code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapReceiverVp.glsl  
    2010-09-20 21:55:19 UTC (rev 8913)
+++ 
code/gazebo/branches/wx/Media/materials/programs/DepthShadowmapReceiverVp.glsl  
    2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,32 +0,0 @@
-uniform mat4 world;
-uniform mat4 worldIT;
-uniform mat4 worldViewProj;
-uniform mat4 texViewProj;
-uniform vec4 lightPosition;
-uniform vec4 lightColour;
-uniform vec4 shadowDepthRange;
-
-
-void main()
-{
-       gl_Position = ftransform();
-       
-       vec4 worldPos = world * gl_Vertex;
-
-       vec3 worldNorm = (worldIT * vec4(gl_Normal, 1)).xyz;
-
-       // calculate lighting (simple vertex lighting)
-       vec3 lightDir = normalize(
-               lightPosition.xyz -  (worldPos.xyz * lightPosition.w));
-
-       gl_FrontColor = lightColour * max(dot(lightDir, worldNorm), 0.0);
-
-       // calculate shadow map coords
-       gl_TexCoord[0] = texViewProj * worldPos;
-#if LINEAR_RANGE
-       // adjust by fixed depth bias, rescale into range
-       gl_TexCoord[0].z = (gl_TexCoord[0].z - shadowDepthRange.x) * 
shadowDepthRange.w;
-#endif
-
-}
-

Deleted: code/gazebo/branches/wx/Media/materials/programs/DirectionalLight.frag
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/DirectionalLight.frag      
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/DirectionalLight.frag      
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,28 +0,0 @@
-varying vec4 diffuse,ambient;
-varying vec3 normal,lightDir,halfVector;
-
-void main()
-{
-  vec3 n,halfV;
-  float NdotL,NdotHV;
-
-  /* The ambient term will always be present */
-  vec4 color = ambient;
-
-  /* a fragment shader can't write a varying variable, hence we need
-   *    a new variable to store the normalized interpolated normal */
-  n = normalize(normal);
-
-  /* compute the dot product between normal and ldir */
-  NdotL = max(dot(n,lightDir),0.0);
-
-  if (NdotL > 0.0) {
-    color += diffuse * NdotL;
-    halfV = normalize(halfVector);
-    NdotHV = max(dot(n,halfV),0.0);
-    color += gl_FrontMaterial.specular * 
-      gl_LightSource[1].specular * pow(NdotHV, gl_FrontMaterial.shininess);
-  }
-
-  gl_FragColor = color;
-}

Deleted: code/gazebo/branches/wx/Media/materials/programs/DirectionalLight.vert
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/DirectionalLight.vert      
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/DirectionalLight.vert      
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,18 +0,0 @@
-varying vec4 diffuse, ambient;
-varying vec3 normal, lightDir, halfVector;
-
-void main()
-{
-  // transform the normal into eye space
-  normal = gl_NormalMatrix * gl_Normal;
-
-  lightDir = normalize(vec3(gl_LightSource[1].position));
-
-  halfVector = normalize(gl_LightSource[1].halfVector.xyz);
-
-  diffuse = gl_FrontMaterial.diffuse * gl_LightSource[1].diffuse;
-  ambient = gl_FrontMaterial.ambient * gl_LightSource[1].ambient;
-  ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient;
-
-  gl_Position = ftransform();
-}

Deleted: code/gazebo/branches/wx/Media/materials/programs/PointLight.frag
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/PointLight.frag    
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/PointLight.frag    
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,34 +0,0 @@
-varying vec4 diffuse,ambientGlobal, ambient;
-varying vec3 normal,lightDir,halfVector;
-varying float dist;
-
-void main(void)
-{
-  /*vec4 color = ambientGlobal;
-
-  vec3 n,halfV,viewV,ldir;
-  float NdotL,NdotHV;
-  float att;
-
-  n = normalize(normal);
-
-  NdotL = max(dot(n,normalize(lightDir)),0.0);
-
-  if (NdotL > 0.0) {
-
-    att = 1.0 / (gl_LightSource[0].constantAttenuation +
-        gl_LightSource[0].linearAttenuation * dist +
-        gl_LightSource[0].quadraticAttenuation * dist * dist);
-    color += att * (diffuse * NdotL + ambient);
-
-
-    halfV = normalize(halfVector);
-    NdotHV = max(dot(n,halfV),0.0);
-    color += att * gl_FrontMaterial.specular * gl_LightSource[0].specular * 
-      pow(NdotHV,gl_FrontMaterial.shininess);
-  }
-
-  */
-  gl_FragColor = gl_Color;
-}
-

Deleted: code/gazebo/branches/wx/Media/materials/programs/PointLight.vert
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/PointLight.vert    
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/PointLight.vert    
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,31 +0,0 @@
-
-varying vec4 diffuse,ambientGlobal,ambient;
-varying vec3 normal,lightDir,halfVector;
-varying float dist;
-
-void main(void)
-{ 
-  /*vec4 ecPos;
-  vec3 aux;
-
-  normal = normalize(gl_NormalMatrix * gl_Normal);
-
-  ecPos = gl_ModelViewMatrix * gl_Vertex;
-  aux = vec3(gl_LightSource[0].position-ecPos);
-  lightDir = normalize(aux);
-  dist = length(aux);
-
-  halfVector = normalize(gl_LightSource[0].halfVector.xyz);
-
-  diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;
-
-  ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient;
-  ambientGlobal = gl_LightModel.ambient * gl_FrontMaterial.ambient;
-
-  gl_FrontColor = vec4(1.0, 0.0, 0.0, 1.0);
-  gl_BackColor = vec4(1.0, 0.0, 0.0, 1.0);
-  */
-
-  gl_Position = ftransform();
-} 
-

Deleted: code/gazebo/branches/wx/Media/materials/programs/SpotLight.frag
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/SpotLight.frag     
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/SpotLight.frag     
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,49 +0,0 @@
-uniform vec4 lightAttenuation;
-uniform vec4 lightPositionOS;
-uniform vec4 cameraPositionOS;
-uniform vec4 spotParams;
-
-varying vec4 diffuse, specular;
-varying vec3 normal;
-varying vec4 position;
-
-void main()
-{
-  vec4 color = vec4 (0.0, 0.0, 0.0, 0.0);
-
-  vec3 n, halfV;
-  float NdotL, NdotHV;
-  float att, spotEffect;
-  float spotExponent = spotParams[2];
-
-  vec3 aux = vec3 (gl_ModelViewMatrix * lightPositionOS - position);
-  float toLightDist = length (aux);
-  vec3 lightDir = normalize (aux);
-  vec3 halfVector = normalize(vec3 (lightDir + normalize (vec3 
(gl_ModelViewMatrix * cameraPositionOS - position))));
-
-  n = normalize (normal);
-
-  /* compute the dot product between normal and ldir */
-  NdotL = max (dot (n,lightDir),0.0);
-
-  if (gl_LightSource[0].spotCosCutoff >= 0.0 && NdotL > 0.0) {
-
-    spotEffect = dot(normalize(gl_LightSource[0].spotDirection), -lightDir);
-    if (spotEffect > gl_LightSource[0].spotCosCutoff)
-    {
-      spotEffect = pow(max(spotEffect, 0.0), spotExponent);
-
-      att = spotEffect / (lightAttenuation.y +
-          lightAttenuation.z * toLightDist +
-          lightAttenuation.w * toLightDist * toLightDist);
-
-      color += att * (diffuse * NdotL);
-
-
-      NdotHV = max (dot (n, halfVector), 0.0);
-      color += att * specular * pow (NdotHV,gl_FrontMaterial.shininess);
-    }
-  }   
-
-  gl_FragColor = color;
-} 

Deleted: code/gazebo/branches/wx/Media/materials/programs/SpotLight.vert
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/SpotLight.vert     
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/SpotLight.vert     
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,19 +0,0 @@
-uniform vec4 lightDiffuse;
-uniform vec4 lightSpecular;
-
-varying vec4 diffuse, specular;
-varying vec3 normal;
-varying vec4 position;
-
-void main()
-{   
-  /* first transform the normal into eye space and normalize the result */
-  normal = normalize (gl_NormalMatrix * gl_Normal);
-  position = gl_ModelViewMatrix * gl_Vertex;
-
-  /* Compute the diffuse, ambient and globalAmbient terms */
-  diffuse = gl_FrontMaterial.diffuse * lightDiffuse;
-  specular = gl_FrontMaterial.specular * lightSpecular;
-
-  gl_Position = ftransform();   
-} 

Copied: 
code/gazebo/branches/wx/Media/materials/programs/ambient_one_texture_vp.glsl 
(from rev 8905, 
code/gazebo/branches/wx/Media/materials/programs/AmbientOneTexture.glsl)
===================================================================
--- 
code/gazebo/branches/wx/Media/materials/programs/ambient_one_texture_vp.glsl    
                            (rev 0)
+++ 
code/gazebo/branches/wx/Media/materials/programs/ambient_one_texture_vp.glsl    
    2010-09-20 21:58:33 UTC (rev 8914)
@@ -0,0 +1,11 @@
+uniform vec4 ambient;
+
+/*
+  Basic ambient lighting vertex program
+*/
+void main()
+{
+       gl_Position = ftransform();
+       gl_TexCoord[0] = gl_MultiTexCoord0;
+       gl_FrontColor = ambient;
+}

Deleted: code/gazebo/branches/wx/Media/materials/programs/pssm.cg
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/pssm.cg    2010-09-20 
21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/pssm.cg    2010-09-20 
21:58:33 UTC (rev 8914)
@@ -1,164 +0,0 @@
-void shadow_caster_vs(
-       float4 position                 : POSITION,
-
-       out float4 oPosition    : POSITION,
-       out float2 oDepth               : TEXCOORD0,
-
-       uniform float4x4 wvpMat)
-{
-       // this is the view space position
-       oPosition = mul(wvpMat, position);
-
-       // depth info for the fragment.
-       oDepth.x = oPosition.z;
-       oDepth.y = oPosition.w;
-
-       // clamp z to zero. seem to do the trick. :-/
-       //oPosition.z = max(oPosition.z, 0);
-}
-
-void shadow_caster_ps(
-       float2 depth            : TEXCOORD0,
-
-       out float4 oColour      : COLOR,
-
-       uniform float4 pssmSplitPoints)
-{
-       float finalDepth = depth.x / depth.y;
-       oColour = float4(finalDepth, finalDepth, finalDepth, 1);
-}
-
-
-
-void shadow_receiver_vs(
-       float4 position                         : POSITION,
-       float3 normal                           : NORMAL,
-       float2 uv                                       : TEXCOORD0,
-
-       out float4 oPosition            : POSITION,
-       out float3 oUv                          : TEXCOORD0,
-       out float3 oLightDir            : TEXCOORD1,
-       out float3 oHalfAngle           : TEXCOORD2,
-       out float4 oLightPosition0      : TEXCOORD3,
-       out float4 oLightPosition1      : TEXCOORD4,
-       out float4 oLightPosition2      : TEXCOORD5,
-       out float3 oNormal                      : TEXCOORD6,
-
-       uniform float4 lightPosition,                           // object space
-       uniform float3 eyePosition,                                     // 
object space
-       uniform float4x4 worldViewProjMatrix,
-       uniform float4x4 texWorldViewProjMatrix0,
-       uniform float4x4 texWorldViewProjMatrix1,
-       uniform float4x4 texWorldViewProjMatrix2)
-{
-       // calculate output position
-       oPosition = mul(worldViewProjMatrix, position);
-
-       // pass the main uvs straight through unchanged
-       oUv.xy = uv;
-       oUv.z = oPosition.z;
-
-       // calculate tangent space light vector
-       // Get object space light direction
-       oLightDir = normalize(lightPosition.xyz - (position * 
lightPosition.w).xyz);
-
-       // Calculate half-angle in tangent space
-       float3 eyeDir = normalize(eyePosition - position.xyz);
-       oHalfAngle = normalize(eyeDir + oLightDir);     
-
-       // Calculate the position of vertex in light space
-       oLightPosition0 = mul(texWorldViewProjMatrix0, position);
-       oLightPosition1 = mul(texWorldViewProjMatrix1, position);
-       oLightPosition2 = mul(texWorldViewProjMatrix2, position);
-
-       oNormal = normal;
-}
-
-float shadowPCF(sampler2D shadowMap, float4 shadowMapPos, float2 offset)
-{
-       shadowMapPos = shadowMapPos / shadowMapPos.w;
-       float2 uv = shadowMapPos.xy;
-       float3 o = float3(offset, -offset.x) * 0.3f;
-
-       // Note: We using 2x2 PCF. Good enough and is alot faster.
-       float c =       (shadowMapPos.z <= tex2D(shadowMap, uv.xy - o.xy).r) ? 
1 : 0; // top left
-       c +=            (shadowMapPos.z <= tex2D(shadowMap, uv.xy + o.xy).r) ? 
1 : 0; // bottom right
-       c +=            (shadowMapPos.z <= tex2D(shadowMap, uv.xy + o.zy).r) ? 
1 : 0; // bottom left
-       c +=            (shadowMapPos.z <= tex2D(shadowMap, uv.xy - o.zy).r) ? 
1 : 0; // top right
-       //float c =     (shadowMapPos.z <= tex2Dlod(shadowMap, uv.xyyy - 
o.xyyy).r) ? 1 : 0; // top left
-       //c +=          (shadowMapPos.z <= tex2Dlod(shadowMap, uv.xyyy + 
o.xyyy).r) ? 1 : 0; // bottom right
-       //c +=          (shadowMapPos.z <= tex2Dlod(shadowMap, uv.xyyy + 
o.zyyy).r) ? 1 : 0; // bottom left
-       //c +=          (shadowMapPos.z <= tex2Dlod(shadowMap, uv.xyyy - 
o.zyyy).r) ? 1 : 0; // top right
-       return c / 4;
-}
-
-// to put it simply, this does 100% per pixel diffuse lighting
-void shadow_receiver_ps(
-       float3 uv                               : TEXCOORD0,
-       float3 OSlightDir                       : TEXCOORD1,
-       float3 OShalfAngle              : TEXCOORD2,
-       float4 LightPosition0   : TEXCOORD3,
-       float4 LightPosition1   : TEXCOORD4,
-       float4 LightPosition2   : TEXCOORD5,
-       float3 normal                   : TEXCOORD6,
-
-       out float4 oColour              : COLOR,
-
-       uniform float4 invShadowMapSize0,
-       uniform float4 invShadowMapSize1,
-       uniform float4 invShadowMapSize2,
-       uniform float4 pssmSplitPoints,
-       uniform sampler2D diffuse,
-       uniform sampler2D specular,
-       uniform sampler2D normalMap,
-       uniform sampler2D shadowMap0,
-       uniform sampler2D shadowMap1,
-       uniform sampler2D shadowMap2,
-       uniform float4 lightDiffuse,
-       uniform float4 lightSpecular,
-       uniform float4 ambient
-       )
-{
-       // calculate shadow
-       float shadowing = 1.0f;
-       float4 splitColour;
-       if (uv.z <= pssmSplitPoints.y)
-       {
-               splitColour = float4(0.1, 0, 0, 1);
-               shadowing = shadowPCF(shadowMap0, LightPosition0, 
invShadowMapSize0.xy);
-       }
-       else if (uv.z <= pssmSplitPoints.z)
-       {
-               splitColour = float4(0, 0.1, 0, 1);
-               shadowing = shadowPCF(shadowMap1, LightPosition1, 
invShadowMapSize1.xy);
-       }
-       else
-       {
-               splitColour = float4(0.1, 0.1, 0, 1);
-               shadowing = shadowPCF(shadowMap2, LightPosition2, 
invShadowMapSize2.xy);
-       }
-
-       // retrieve normalised light vector, expand from range-compressed
-       float3 lightVec = normalize(OSlightDir);
-
-       // retrieve half angle and normalise through cube map
-       float3 halfAngle = normalize(OShalfAngle);
-
-       // get diffuse colour
-       float4 diffuseColour = tex2D(diffuse, uv.xy);
-
-       // specular
-       float4 specularColour = tex2D(specular, uv.xy);
-       float shininess = specularColour.w;
-       specularColour.w = 1;
-
-       // calculate lit value.
-       float4 lighting = lit(dot(normal, lightVec), dot(normal, halfAngle), 
shininess * 128) * shadowing;
-
-       // final lighting with diffuse and spec
-       oColour = (diffuseColour * clamp(ambient + lightDiffuse * lighting.y, 
0, 1)) + (lightSpecular * specularColour * lighting.z);
-       oColour.w = diffuseColour.w;
-
-       //oColour += splitColour;
-}
-

Deleted: code/gazebo/branches/wx/Media/materials/programs/pssm.hlsl
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/pssm.hlsl  2010-09-20 
21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/pssm.hlsl  2010-09-20 
21:58:33 UTC (rev 8914)
@@ -1,167 +0,0 @@
-void shadow_caster_vs(
-       float4 position                 : POSITION,
-
-       out float4 oPosition    : SV_POSITION,
-       out float2 oDepth               : TEXCOORD0,
-
-       uniform float4x4 wvpMat)
-{
-       // this is the view space position
-       oPosition = mul(wvpMat, position);
-
-       // depth info for the fragment.
-       oDepth.x = oPosition.z;
-       oDepth.y = oPosition.w;
-
-       // clamp z to zero. seem to do the trick. :-/
-       //oPosition.z = max(oPosition.z, 0);
-}
-
-void shadow_caster_ps(
-  float4 Position      : SV_POSITION,
-       float2 depth            : TEXCOORD0,
-
-       out float4 oColour      : COLOR,
-
-       uniform float4 pssmSplitPoints)
-{
-       float finalDepth = depth.x / depth.y;
-//     oColour = float4(finalDepth, finalDepth, finalDepth, 1);
-       oColour = float4(0, 0, 0, 1);
-}
-
-
-
-void shadow_receiver_vs(
-       float4 position                         : POSITION,
-       float3 normal                           : NORMAL,
-       float2 uv                                       : TEXCOORD0,
-
-       out float4 oPosition            : SV_POSITION,
-       out float3 oUv                          : TEXCOORD0,
-       out float3 oLightDir            : TEXCOORD1,
-       out float3 oHalfAngle           : TEXCOORD2,
-       out float4 oLightPosition0      : TEXCOORD3,
-       out float4 oLightPosition1      : TEXCOORD4,
-       out float4 oLightPosition2      : TEXCOORD5,
-       out float3 oNormal                      : TEXCOORD6,
-
-       uniform float4 lightPosition,                           // object space
-       uniform float3 eyePosition,                                     // 
object space
-       uniform float4x4 worldViewProjMatrix,
-       uniform float4x4 texWorldViewProjMatrix0,
-       uniform float4x4 texWorldViewProjMatrix1,
-       uniform float4x4 texWorldViewProjMatrix2)
-{
-       // calculate output position
-       oPosition = mul(worldViewProjMatrix, position);
-
-       // pass the main uvs straight through unchanged
-       oUv.xy = uv;
-       oUv.z = oPosition.z;
-
-       // calculate tangent space light vector
-       // Get object space light direction
-       oLightDir = normalize(lightPosition.xyz - (position * 
lightPosition.w).xyz);
-
-       // Calculate half-angle in tangent space
-       float3 eyeDir = normalize(eyePosition - position.xyz);
-       oHalfAngle = normalize(eyeDir + oLightDir);     
-
-       // Calculate the position of vertex in light space
-       oLightPosition0 = mul(texWorldViewProjMatrix0, position);
-       oLightPosition1 = mul(texWorldViewProjMatrix1, position);
-       oLightPosition2 = mul(texWorldViewProjMatrix2, position);
-
-       oNormal = normal;
-}
-
-float shadowPCF(sampler2D shadowMap, float4 shadowMapPos, float2 offset)
-{
-       shadowMapPos = shadowMapPos / shadowMapPos.w;
-       float2 uv = shadowMapPos.xy;
-       float3 o = float3(offset, -offset.x) * 0.3f;
-
-       // Note: We using 2x2 PCF. Good enough and is alot faster.
-       float c =       (shadowMapPos.z <= tex2D(shadowMap, uv.xy - o.xy).r)>0 
? 1 : 0; // top left
-       c +=            (shadowMapPos.z <= tex2D(shadowMap, uv.xy + o.xy).r)>0 
? 1 : 0; // bottom right
-       c +=            (shadowMapPos.z <= tex2D(shadowMap, uv.xy + o.zy).r)>0 
? 1 : 0; // bottom left
-       c +=            (shadowMapPos.z <= tex2D(shadowMap, uv.xy - o.zy).r)>0 
? 1 : 0; // top right
-       //float c =     (shadowMapPos.z <= tex2Dlod(shadowMap, uv.xyyy - 
o.xyyy).r) ? 1 : 0; // top left
-       //c +=          (shadowMapPos.z <= tex2Dlod(shadowMap, uv.xyyy + 
o.xyyy).r) ? 1 : 0; // bottom right
-       //c +=          (shadowMapPos.z <= tex2Dlod(shadowMap, uv.xyyy + 
o.zyyy).r) ? 1 : 0; // bottom left
-       //c +=          (shadowMapPos.z <= tex2Dlod(shadowMap, uv.xyyy - 
o.zyyy).r) ? 1 : 0; // top right
-       return c / 4;
-}
-
-// to put it simply, this does 100% per pixel diffuse lighting
-void shadow_receiver_ps(
-  float4 oPosition             : SV_POSITION,
-       float3 uv                               : TEXCOORD0,
-       float3 OSlightDir                       : TEXCOORD1,
-       float3 OShalfAngle              : TEXCOORD2,
-       float4 LightPosition0   : TEXCOORD3,
-       float4 LightPosition1   : TEXCOORD4,
-       float4 LightPosition2   : TEXCOORD5,
-       float3 normal                   : TEXCOORD6,
-
-       out float4 oColour              : COLOR,
-
-       uniform float4 invShadowMapSize0,
-       uniform float4 invShadowMapSize1,
-       uniform float4 invShadowMapSize2,
-       uniform float4 pssmSplitPoints,
-       uniform sampler2D diffuse:register(s3),
-       uniform sampler2D specular:register(s4),
-       uniform sampler2D normalMap:register(s5),
-       uniform sampler2D shadowMap0:register(s0),
-       uniform sampler2D shadowMap1:register(s1),
-       uniform sampler2D shadowMap2:register(s2),
-       uniform float4 lightDiffuse,
-       uniform float4 lightSpecular,
-       uniform float4 ambient
-       )
-{
-       // calculate shadow
-       float shadowing = 1.0f;
-       float4 splitColour;
-       if (uv.z <= pssmSplitPoints.y)
-       {
-               splitColour = float4(0.1, 0, 0, 1);
-               shadowing = shadowPCF(shadowMap0, LightPosition0, 
invShadowMapSize0.xy);
-       }
-       else if (uv.z <= pssmSplitPoints.z)
-       {
-               splitColour = float4(0, 0.1, 0, 1);
-               shadowing = shadowPCF(shadowMap1, LightPosition1, 
invShadowMapSize1.xy);
-       }
-       else
-       {
-               splitColour = float4(0.1, 0.1, 0, 1);
-               shadowing = shadowPCF(shadowMap2, LightPosition2, 
invShadowMapSize2.xy);
-       }
-
-       // retrieve normalised light vector, expand from range-compressed
-       float3 lightVec = normalize(OSlightDir);
-
-       // retrieve half angle and normalise through cube map
-       float3 halfAngle = normalize(OShalfAngle);
-
-       // get diffuse colour
-       float4 diffuseColour = tex2D(diffuse, uv.xy);
-
-       // specular
-       float4 specularColour = tex2D(specular, uv.xy);
-       float shininess = specularColour.w;
-       specularColour.w = 1;
-
-       // calculate lit value.
-       float4 lighting = lit(dot(normal, lightVec), dot(normal, halfAngle), 
shininess * 128) * shadowing;
-
-       // final lighting with diffuse and spec
-       oColour = (diffuseColour * clamp(ambient + lightDiffuse * lighting.y, 
0, 1)) + (lightSpecular * specularColour * lighting.z);
-       oColour.w = diffuseColour.w;
-
-       //oColour += splitColour;
-}
-

Deleted: 
code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_caster_fp.glsl
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_caster_fp.glsl    
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_caster_fp.glsl    
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,11 +0,0 @@
-uniform float far;
-
-varying vec4 vertexDepth;
-
-void main()
-{
-  //float depth = length(vertexDepth.z) / far;
-  //gl_FragColor = vec4(depth, depth*depth, 0.0, 1.0);
-  
-  gl_FragColor = vec4(vertexDepth.x, vertexDepth.x, vertexDepth.x, 1.0);
-}

Deleted: 
code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_caster_vp.glsl
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_caster_vp.glsl    
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_caster_vp.glsl    
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,15 +0,0 @@
-uniform mat4 wvpMat;
-uniform vec4 texel_offsets;
-uniform vec4 depth_range;
-
-attribute vec4 vertex;
-
-varying vec4 vertexDepth;
-
-void main()
-{
-  gl_Position = wvpMat * vertex;
-  gl_Position.xy += texel_offsets.zw * gl_Position.w;
-
-  vertexDepth.x = (gl_Position.z - depth_range.x) * depth_range.w;
-}

Deleted: 
code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_receiver_fp.glsl
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_receiver_fp.glsl  
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_receiver_fp.glsl  
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,158 +0,0 @@
-uniform vec4 invShadowMapSize;
-uniform vec3 derived_light_diffuse_color;
-uniform vec4 derived_light_specular_color;
-uniform float surface_shininess;
-
-uniform vec4 light_position_view_space;
-uniform vec4 light_direction_view_space;
-uniform vec4 light_attenuation;
-uniform vec4 spotlight_params;
-
-uniform sampler2D shadowMap;
-uniform sampler2D diffuseMap;
-
-varying vec3 vertexWorldViewPos;
-varying vec3 vertexWorldPos;
-varying vec3 vertexWorldNorm;
-varying vec4 vertexLightPos;
-
-float ShadowPCF()
-{
-  // Get the shadow map position
-  vec4 shadowMapPos = vertexLightPos / vertexLightPos.w;
-  vec2 uv = shadowMapPos.xy;
-
-  //float dist = length(vertexLightPos.z) / light_attenuation.x ;
-  float dist = vertexLightPos.z;
-
-  vec2 o = invShadowMapSize.xy;
-
-  float centerDepth = texture2D(shadowMap, uv.xy).x;
-
-  //vec4 depths = vec4( texture2D(shadowMap, vec2(uv.x - offset.x, uv.y)).x,
-  //                    texture2D(shadowMap, vec2(uv.x + offset.x, uv.y)).x,
-  //                    texture2D(shadowMap, vec2(uv.x, uv.y - offset.y)).x,
-  //                    texture2D(shadowMap, vec2(uv.x, uv.y + offset.y)).x );
-  
-
-  float final = (centerDepth > dist) ? 1.0 : 0.0;
-  final += (texture2D(shadowMap, uv.xy - o.xy).x > dist) ? 1.0 : 0.0;
-  final += (texture2D(shadowMap, uv.xy + o.xy).x > dist) ? 1.0 : 0.0;
-  final += (texture2D(shadowMap, vec2(uv.x - o.x, uv.y)).x > dist) ? 1.0 : 0.0;
-  final += (texture2D(shadowMap, vec2(uv.x + o.x, uv.y)).x > dist) ? 1.0 : 0.0;
-  final += (texture2D(shadowMap, vec2(uv.x, uv.y + o.y)).x > dist) ? 1.0 : 0.0;
-  final += (texture2D(shadowMap, vec2(uv.x, uv.y - o.y)).x > dist) ? 1.0 : 0.0;
-  final += (texture2D(shadowMap, vec2(uv.x - o.x, uv.y + o.y)).x > dist) ? 1.0 
: 0.0;
-  final += (texture2D(shadowMap, vec2(uv.x + o.x, uv.y - o.y)).x > dist) ? 1.0 
: 0.0;
-
-  final /= 9.0;
-  return final;
-
-  //vec2 c = texture2D(shadowMap, uv.xy).rg; // center
-  //c += texture2D(shadowMap, uv.xy - offset.xy).rg; // top left
-  //c += texture2D(shadowMap, uv.xy + offset.xy).rg; // bottom right
-  //c += texture2D(shadowMap, vec2(uv.x - offset.x, uv.y)).rg; // left
-  //c += texture2D(shadowMap, vec2(uv.x + offset.x, uv.y)).rg; // right
-  //c += texture2D(shadowMap, vec2(uv.x, uv.y + offset.y)).rg; // bottom
-  //c += texture2D(shadowMap, vec2(uv.x, uv.y - offset.y)).rg; // top
-  //c += texture2D(shadowMap, vec2(uv.x - offset.x, uv.y + offset.y)).rg; // 
bottom left
-  //c += texture2D(shadowMap, vec2(uv.x + offset.x, uv.y - offset.y)).rg; // 
top right
-  //c /= 9.0;
-
-  //vec2 moments = c;
-  //float litFactor = (dist <= moments.x  ? 1.0 : 0.0); 
-  //return litFactor;
-
-  //// standard variance shadow mapping code
-  //float variance = min(max( moments.y - (moments.x * moments.x), 0.0), 1.0);
-  //float m_d = moments.x - dist;
-  //float p = variance / (variance + m_d * m_d);
-
-  //return smoothstep(0.4, 1.0, max(litFactor, p));
-}
-
-//-----------------------------------------------------------------------------
-float Light_Spot_Diffuse(
-            in vec3 vNegLightDirView,
-            in vec3 vLightView,
-            in vec4 vAttParams,
-            in vec3 vSpotParams,
-            in float fLightD,
-            in float nDotL)
-{           
-  float spot = 1.0;
-
-  if (nDotL > 0.0 && fLightD <= vAttParams.x)
-  {
-    float fAtten  = 1.0 / (vAttParams.y + vAttParams.z*fLightD + 
vAttParams.w*fLightD*fLightD);    
-    float rho   = dot(vNegLightDirView, vLightView);
-    float fSpotE  = clamp((rho - vSpotParams.y) / (vSpotParams.x - 
vSpotParams.y), 0.0, 1.0);
-    float fSpotT  = pow(fSpotE, vSpotParams.z);
-
-    spot = nDotL * fAtten * fSpotT;
-  }
-
-  return spot;
-}  
-
-void main()
-{
-  float spot = 1.0;
-  float specular = 0.0;
-
-  // Normalized fragment normal
-  vec3 N = normalize(vertexWorldNorm);
-
-  // Direction from the fragment to the light 
-  vec3 lightDirView = light_position_view_space.xyz - vertexWorldViewPos.xyz * 
light_position_view_space.w;
-
-  // light_position_view_space.w == 0 for directional lights
-  float lightDist = length(lightDirView) * light_position_view_space.w;
-  lightDirView = normalize(lightDirView);
-
-  float lambertTerm = max( dot(N, lightDirView), 0.0 );
-
-  
//////////////////////////////////////////////////////////////////////////////
-  // COMPUTE DIFFUSE CONTRIBUTION
-  vec4 diffuseTex = texture2D(diffuseMap, gl_TexCoord[0].st);
-  vec4 diffuseContrib = vec4(derived_light_diffuse_color * diffuseTex.rgb * 
lambertTerm,1.0);
-
-
-  
//////////////////////////////////////////////////////////////////////////////
-  // COMPUTE SPOT AND SPECULAR COMPONENTS
-  if (lambertTerm > 0.0 && lightDist <= light_attenuation.x) 
-  {
-    vec3 view = -normalize(vertexWorldViewPos.xyz);
-    vec3 halfway = normalize( view + lightDirView );
-    float nDotH = dot(N, halfway);
-
-    float fAtten = 1.0 / (light_attenuation.y + 
-                          light_attenuation.z*lightDist + 
-                          light_attenuation.w*lightDist*lightDist);    
-
-    float rho = dot(-light_direction_view_space.xyz, lightDirView);
-
-    float fSpotE  = clamp((rho - spotlight_params.y) / 
-        (spotlight_params.x - spotlight_params.y),0.0,1.0);
-
-    float fSpotT  = pow(fSpotE, spotlight_params.z);
-
-    // Make sure we have a spot light
-    if ( !(spotlight_params.x == 1.0 && spotlight_params.y == 0.0 && 
-           spotlight_params.z == 0.0 && spotlight_params.w == 1.0) )
-    {
-      spot = lambertTerm * fAtten * fSpotT;
-    }
-
-    // Works for all light types
-    specular = pow(clamp(nDotH, 0.0, 1.0), surface_shininess) * fAtten, fSpotT;
-  }
-
-  
//////////////////////////////////////////////////////////////////////////////
-  // COMPUTE SHADOW CONTRIBUTION
-  float shadowAmount = ShadowPCF();
-
-  vec4 specularContrib = specular * derived_light_specular_color;
-
-  gl_FragColor = (diffuseContrib + specularContrib) * shadowAmount * spot;
-}

Deleted: 
code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_receiver_vp.glsl
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_receiver_vp.glsl  
2010-09-20 21:55:19 UTC (rev 8913)
+++ code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_receiver_vp.glsl  
2010-09-20 21:58:33 UTC (rev 8914)
@@ -1,37 +0,0 @@
-uniform mat4 wMat;
-uniform mat4 wvMat;
-uniform mat4 wvpMat;
-uniform mat4 inv_trans_wvMat;
-uniform vec4 lightWorldPos;
-
-uniform mat4 twvpMat;
-uniform vec4 spotDir;
-uniform vec4 shadow_depth_range;
-
-attribute vec3 normal;
-attribute vec4 vertex;
-
-varying vec3 vertexWorldNorm;
-varying vec3 vertexWorldViewPos;
-varying vec3 vertexWorldPos;
-
-varying vec4 vertexLightPos;
-
-void main()
-{
-  gl_Position = wvpMat * vertex;
-
-  // Vertex in world space
-  vertexWorldViewPos = (wvMat * vertex).xyz;
-  vertexWorldPos = (wMat * vertex).xyz;
-
-  // Vertex normal in world space
-  vertexWorldNorm = (inv_trans_wvMat * vec4(normal, 1.0)).xyz;
-
-  // Position of the vertex in light space (shadow map texture coords)
-  vertexLightPos = twvpMat * vertex;
-  vertexLightPos.z = (vertexLightPos.z - shadow_depth_range.x) * 
shadow_depth_range.w;
-
-  // Pass through the diffuse component
-  gl_TexCoord[0] = gl_MultiTexCoord0;
-}

Copied: code/gazebo/branches/wx/Media/materials/programs/shadow_caster_fp.glsl 
(from rev 8913, 
code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_caster_fp.glsl)
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/shadow_caster_fp.glsl      
                        (rev 0)
+++ code/gazebo/branches/wx/Media/materials/programs/shadow_caster_fp.glsl      
2010-09-20 21:58:33 UTC (rev 8914)
@@ -0,0 +1,11 @@
+uniform float far;
+
+varying vec4 vertexDepth;
+
+void main()
+{
+  //float depth = length(vertexDepth.z) / far;
+  //gl_FragColor = vec4(depth, depth*depth, 0.0, 1.0);
+  
+  gl_FragColor = vec4(vertexDepth.x, vertexDepth.x, vertexDepth.x, 1.0);
+}

Copied: code/gazebo/branches/wx/Media/materials/programs/shadow_caster_vp.glsl 
(from rev 8913, 
code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_caster_vp.glsl)
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/shadow_caster_vp.glsl      
                        (rev 0)
+++ code/gazebo/branches/wx/Media/materials/programs/shadow_caster_vp.glsl      
2010-09-20 21:58:33 UTC (rev 8914)
@@ -0,0 +1,15 @@
+uniform mat4 wvpMat;
+uniform vec4 texel_offsets;
+uniform vec4 depth_range;
+
+attribute vec4 vertex;
+
+varying vec4 vertexDepth;
+
+void main()
+{
+  gl_Position = wvpMat * vertex;
+  gl_Position.xy += texel_offsets.zw * gl_Position.w;
+
+  vertexDepth.x = (gl_Position.z - depth_range.x) * depth_range.w;
+}

Copied: 
code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_fp.glsl (from 
rev 8913, 
code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_receiver_fp.glsl)
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_fp.glsl    
                        (rev 0)
+++ code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_fp.glsl    
2010-09-20 21:58:33 UTC (rev 8914)
@@ -0,0 +1,158 @@
+uniform vec4 invShadowMapSize;
+uniform vec3 derived_light_diffuse_color;
+uniform vec4 derived_light_specular_color;
+uniform float surface_shininess;
+
+uniform vec4 light_position_view_space;
+uniform vec4 light_direction_view_space;
+uniform vec4 light_attenuation;
+uniform vec4 spotlight_params;
+
+uniform sampler2D shadowMap;
+uniform sampler2D diffuseMap;
+
+varying vec3 vertexWorldViewPos;
+varying vec3 vertexWorldPos;
+varying vec3 vertexWorldNorm;
+varying vec4 vertexLightPos;
+
+float ShadowPCF()
+{
+  // Get the shadow map position
+  vec4 shadowMapPos = vertexLightPos / vertexLightPos.w;
+  vec2 uv = shadowMapPos.xy;
+
+  //float dist = length(vertexLightPos.z) / light_attenuation.x ;
+  float dist = vertexLightPos.z;
+
+  vec2 o = invShadowMapSize.xy;
+
+  float centerDepth = texture2D(shadowMap, uv.xy).x;
+
+  //vec4 depths = vec4( texture2D(shadowMap, vec2(uv.x - offset.x, uv.y)).x,
+  //                    texture2D(shadowMap, vec2(uv.x + offset.x, uv.y)).x,
+  //                    texture2D(shadowMap, vec2(uv.x, uv.y - offset.y)).x,
+  //                    texture2D(shadowMap, vec2(uv.x, uv.y + offset.y)).x );
+  
+
+  float final = (centerDepth > dist) ? 1.0 : 0.0;
+  final += (texture2D(shadowMap, uv.xy - o.xy).x > dist) ? 1.0 : 0.0;
+  final += (texture2D(shadowMap, uv.xy + o.xy).x > dist) ? 1.0 : 0.0;
+  final += (texture2D(shadowMap, vec2(uv.x - o.x, uv.y)).x > dist) ? 1.0 : 0.0;
+  final += (texture2D(shadowMap, vec2(uv.x + o.x, uv.y)).x > dist) ? 1.0 : 0.0;
+  final += (texture2D(shadowMap, vec2(uv.x, uv.y + o.y)).x > dist) ? 1.0 : 0.0;
+  final += (texture2D(shadowMap, vec2(uv.x, uv.y - o.y)).x > dist) ? 1.0 : 0.0;
+  final += (texture2D(shadowMap, vec2(uv.x - o.x, uv.y + o.y)).x > dist) ? 1.0 
: 0.0;
+  final += (texture2D(shadowMap, vec2(uv.x + o.x, uv.y - o.y)).x > dist) ? 1.0 
: 0.0;
+
+  final /= 9.0;
+  return final;
+
+  //vec2 c = texture2D(shadowMap, uv.xy).rg; // center
+  //c += texture2D(shadowMap, uv.xy - offset.xy).rg; // top left
+  //c += texture2D(shadowMap, uv.xy + offset.xy).rg; // bottom right
+  //c += texture2D(shadowMap, vec2(uv.x - offset.x, uv.y)).rg; // left
+  //c += texture2D(shadowMap, vec2(uv.x + offset.x, uv.y)).rg; // right
+  //c += texture2D(shadowMap, vec2(uv.x, uv.y + offset.y)).rg; // bottom
+  //c += texture2D(shadowMap, vec2(uv.x, uv.y - offset.y)).rg; // top
+  //c += texture2D(shadowMap, vec2(uv.x - offset.x, uv.y + offset.y)).rg; // 
bottom left
+  //c += texture2D(shadowMap, vec2(uv.x + offset.x, uv.y - offset.y)).rg; // 
top right
+  //c /= 9.0;
+
+  //vec2 moments = c;
+  //float litFactor = (dist <= moments.x  ? 1.0 : 0.0); 
+  //return litFactor;
+
+  //// standard variance shadow mapping code
+  //float variance = min(max( moments.y - (moments.x * moments.x), 0.0), 1.0);
+  //float m_d = moments.x - dist;
+  //float p = variance / (variance + m_d * m_d);
+
+  //return smoothstep(0.4, 1.0, max(litFactor, p));
+}
+
+//-----------------------------------------------------------------------------
+float Light_Spot_Diffuse(
+            in vec3 vNegLightDirView,
+            in vec3 vLightView,
+            in vec4 vAttParams,
+            in vec3 vSpotParams,
+            in float fLightD,
+            in float nDotL)
+{           
+  float spot = 1.0;
+
+  if (nDotL > 0.0 && fLightD <= vAttParams.x)
+  {
+    float fAtten  = 1.0 / (vAttParams.y + vAttParams.z*fLightD + 
vAttParams.w*fLightD*fLightD);    
+    float rho   = dot(vNegLightDirView, vLightView);
+    float fSpotE  = clamp((rho - vSpotParams.y) / (vSpotParams.x - 
vSpotParams.y), 0.0, 1.0);
+    float fSpotT  = pow(fSpotE, vSpotParams.z);
+
+    spot = nDotL * fAtten * fSpotT;
+  }
+
+  return spot;
+}  
+
+void main()
+{
+  float spot = 1.0;
+  float specular = 0.0;
+
+  // Normalized fragment normal
+  vec3 N = normalize(vertexWorldNorm);
+
+  // Direction from the fragment to the light 
+  vec3 lightDirView = light_position_view_space.xyz - vertexWorldViewPos.xyz * 
light_position_view_space.w;
+
+  // light_position_view_space.w == 0 for directional lights
+  float lightDist = length(lightDirView) * light_position_view_space.w;
+  lightDirView = normalize(lightDirView);
+
+  float lambertTerm = max( dot(N, lightDirView), 0.0 );
+
+  
//////////////////////////////////////////////////////////////////////////////
+  // COMPUTE DIFFUSE CONTRIBUTION
+  vec4 diffuseTex = texture2D(diffuseMap, gl_TexCoord[0].st);
+  vec4 diffuseContrib = vec4(derived_light_diffuse_color * diffuseTex.rgb * 
lambertTerm,1.0);
+
+
+  
//////////////////////////////////////////////////////////////////////////////
+  // COMPUTE SPOT AND SPECULAR COMPONENTS
+  if (lambertTerm > 0.0 && lightDist <= light_attenuation.x) 
+  {
+    vec3 view = -normalize(vertexWorldViewPos.xyz);
+    vec3 halfway = normalize( view + lightDirView );
+    float nDotH = dot(N, halfway);
+
+    float fAtten = 1.0 / (light_attenuation.y + 
+                          light_attenuation.z*lightDist + 
+                          light_attenuation.w*lightDist*lightDist);    
+
+    float rho = dot(-light_direction_view_space.xyz, lightDirView);
+
+    float fSpotE  = clamp((rho - spotlight_params.y) / 
+        (spotlight_params.x - spotlight_params.y),0.0,1.0);
+
+    float fSpotT  = pow(fSpotE, spotlight_params.z);
+
+    // Make sure we have a spot light
+    if ( !(spotlight_params.x == 1.0 && spotlight_params.y == 0.0 && 
+           spotlight_params.z == 0.0 && spotlight_params.w == 1.0) )
+    {
+      spot = lambertTerm * fAtten * fSpotT;
+    }
+
+    // Works for all light types
+    specular = pow(clamp(nDotH, 0.0, 1.0), surface_shininess) * fAtten, fSpotT;
+  }
+
+  
//////////////////////////////////////////////////////////////////////////////
+  // COMPUTE SHADOW CONTRIBUTION
+  float shadowAmount = ShadowPCF();
+
+  vec4 specularContrib = specular * derived_light_specular_color;
+
+  gl_FragColor = (diffuseContrib + specularContrib) * shadowAmount * spot;
+}

Copied: 
code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_vp.glsl (from 
rev 8913, 
code/gazebo/branches/wx/Media/materials/programs/pssm_vsm_receiver_vp.glsl)
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_vp.glsl    
                        (rev 0)
+++ code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_vp.glsl    
2010-09-20 21:58:33 UTC (rev 8914)
@@ -0,0 +1,37 @@
+uniform mat4 wMat;
+uniform mat4 wvMat;
+uniform mat4 wvpMat;
+uniform mat4 inv_trans_wvMat;
+uniform vec4 lightWorldPos;
+
+uniform mat4 twvpMat;
+uniform vec4 spotDir;
+uniform vec4 shadow_depth_range;
+
+attribute vec3 normal;
+attribute vec4 vertex;
+
+varying vec3 vertexWorldNorm;
+varying vec3 vertexWorldViewPos;
+varying vec3 vertexWorldPos;
+
+varying vec4 vertexLightPos;
+
+void main()
+{
+  gl_Position = wvpMat * vertex;
+
+  // Vertex in world space
+  vertexWorldViewPos = (wvMat * vertex).xyz;
+  vertexWorldPos = (wMat * vertex).xyz;
+
+  // Vertex normal in world space
+  vertexWorldNorm = (inv_trans_wvMat * vec4(normal, 1.0)).xyz;
+
+  // Position of the vertex in light space (shadow map texture coords)
+  vertexLightPos = twvpMat * vertex;
+  vertexLightPos.z = (vertexLightPos.z - shadow_depth_range.x) * 
shadow_depth_range.w;
+
+  // Pass through the diffuse component
+  gl_TexCoord[0] = gl_MultiTexCoord0;
+}


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to