Revision: 8915
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8915&view=rev
Author:   natepak
Date:     2010-09-21 20:46:40 +0000 (Tue, 21 Sep 2010)

Log Message:
-----------
Improved spot light shadows

Modified Paths:
--------------
    code/gazebo/branches/wx/Media/materials/programs/CMakeLists.txt
    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
    code/gazebo/branches/wx/Media/materials/scripts/CMakeLists.txt
    code/gazebo/branches/wx/Media/materials/scripts/Gazebo.material
    code/gazebo/branches/wx/Media/materials/scripts/blur.material
    code/gazebo/branches/wx/Media/materials/scripts/shadow_caster.material
    code/gazebo/branches/wx/Media/materials/scripts/shadow_receiver.material
    code/gazebo/branches/wx/server/physics/PlaneShape.cc
    code/gazebo/branches/wx/server/rendering/Light.cc
    code/gazebo/branches/wx/server/rendering/OgreAdaptor.cc
    code/gazebo/branches/wx/server/rendering/OgreCamera.cc
    code/gazebo/branches/wx/server/rendering/OgreCreator.cc
    code/gazebo/branches/wx/server/rendering/Scene.cc
    code/gazebo/branches/wx/server/rendering/Scene.hh
    code/gazebo/branches/wx/server/wx/SimulationFrame.cc
    code/gazebo/branches/wx/server/wx/SpotLightMaker.cc
    code/gazebo/branches/wx/worlds/empty.world

Modified: code/gazebo/branches/wx/Media/materials/programs/CMakeLists.txt
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/CMakeLists.txt     
2010-09-20 21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/Media/materials/programs/CMakeLists.txt     
2010-09-21 20:46:40 UTC (rev 8915)
@@ -1,8 +1,8 @@
-SET (files pssm_vsm_caster_fp.glsl
-           pssm_vsm_caster_vp.glsl
-           pssm_vsm_receiver_fp.glsl
-           pssm_vsm_receiver_vp.glsl
-           AmbientOneTexture.glsl
+SET (files shadow_caster_fp.glsl
+           shadow_caster_vp.glsl
+           shadow_receiver_fp.glsl
+           shadow_receiver_vp.glsl
+           ambient_one_texture_vp.glsl
            blur.glsl
 ) 
 

Modified: code/gazebo/branches/wx/Media/materials/programs/shadow_caster_fp.glsl
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/shadow_caster_fp.glsl      
2010-09-20 21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/Media/materials/programs/shadow_caster_fp.glsl      
2010-09-21 20:46:40 UTC (rev 8915)
@@ -1,11 +1,12 @@
-uniform float far;
+//uniform float far;
 
 varying vec4 vertexDepth;
+//varying float d;
 
 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);
+  float depth = length(vertexDepth.xyz)/500.0;
+  gl_FragColor = vec4(depth, depth*depth, 0.0, 1.0);
+
+  //gl_FragColor = vec4(d, d * d, 0.0, 1.0);
 }

Modified: code/gazebo/branches/wx/Media/materials/programs/shadow_caster_vp.glsl
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/shadow_caster_vp.glsl      
2010-09-20 21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/Media/materials/programs/shadow_caster_vp.glsl      
2010-09-21 20:46:40 UTC (rev 8915)
@@ -1,15 +1,19 @@
 uniform mat4 wvpMat;
+uniform mat4 wvMat;
+uniform mat4 pMat;
 uniform vec4 texel_offsets;
 uniform vec4 depth_range;
 
 attribute vec4 vertex;
 
 varying vec4 vertexDepth;
+//varying float d;
 
 void main()
 {
-  gl_Position = wvpMat * vertex;
+  vertexDepth = wvpMat * vertex;
+  //d = (vertexDepth.z - depthRange.x) * depthRange.w;
+
+  gl_Position = vertexDepth;
   gl_Position.xy += texel_offsets.zw * gl_Position.w;
-
-  vertexDepth.x = (gl_Position.z - depth_range.x) * depth_range.w;
 }

Modified: 
code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_fp.glsl
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_fp.glsl    
2010-09-20 21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_fp.glsl    
2010-09-21 20:46:40 UTC (rev 8915)
@@ -4,6 +4,7 @@
 uniform float surface_shininess;
 
 uniform vec4 light_position_view_space;
+uniform vec4 light_position_world_space;
 uniform vec4 light_direction_view_space;
 uniform vec4 light_attenuation;
 uniform vec4 spotlight_params;
@@ -16,85 +17,42 @@
 varying vec3 vertexWorldNorm;
 varying vec4 vertexLightPos;
 
+vec4 Blur(sampler2D map, vec2 uv, float radius, float steps)
+{
+  float stepSize = 2.0 * radius / steps;
+  uv.xy -= vec2(radius);
+
+  vec4 total = vec4(0.0, 0.0, 0.0, 0.0);
+  for (float x = 0.0; x < steps; x+=1.0)
+    for (float y = 0.0; y < steps; y+=1.0)
+      total +=
+        texture2D(map, vec2(uv.xy + vec2(x * stepSize, y * stepSize)));
+
+  return total / (steps * steps);
+}
+
 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;
+  float dist = length(light_position_world_space.xyz - vertexWorldPos)/500.0;
 
-  vec2 o = invShadowMapSize.xy;
+  vec2 c = Blur(shadowMap, uv, invShadowMapSize.x, 4.0).xy;
 
-  float centerDepth = texture2D(shadowMap, uv.xy).x;
+  if ( dist <= c.x + 0.0001)
+    return 1.0;
 
-  //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 );
-  
+  // standard variance shadow mapping code
+  float variance = min(max( c.y - (c.x * c.x), 0.0), 1.0);
+  float m_d = c.x - dist;
+  float p = variance / (variance + m_d * m_d);
 
-  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));
+  return smoothstep(0.3, 1.0, 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;
@@ -107,7 +65,7 @@
   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;
+  float lightDist = length(lightDirView);
   lightDirView = normalize(lightDirView);
 
   float lambertTerm = max( dot(N, lightDirView), 0.0 );

Modified: 
code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_vp.glsl
===================================================================
--- code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_vp.glsl    
2010-09-20 21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_vp.glsl    
2010-09-21 20:46:40 UTC (rev 8915)
@@ -30,7 +30,7 @@
 
   // 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;
+  //vertexLightPos.z = (vertexLightPos.z - shadow_depth_range.x) * 
shadow_depth_range.w;
 
   // Pass through the diffuse component
   gl_TexCoord[0] = gl_MultiTexCoord0;

Modified: code/gazebo/branches/wx/Media/materials/scripts/CMakeLists.txt
===================================================================
--- code/gazebo/branches/wx/Media/materials/scripts/CMakeLists.txt      
2010-09-20 21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/Media/materials/scripts/CMakeLists.txt      
2010-09-21 20:46:40 UTC (rev 8915)
@@ -1,6 +1,8 @@
 SET (files Gazebo.material 
            shadow_receiver.material 
            shadow_caster.material
+           blur.compositor
+           blur.material
 )
 
 INSTALL(FILES ${files} DESTINATION 
${CMAKE_INSTALL_PREFIX}/share/gazebo/Media/materials/scripts/)

Modified: code/gazebo/branches/wx/Media/materials/scripts/Gazebo.material
===================================================================
--- code/gazebo/branches/wx/Media/materials/scripts/Gazebo.material     
2010-09-20 21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/Media/materials/scripts/Gazebo.material     
2010-09-21 20:46:40 UTC (rev 8915)
@@ -1,30 +1,10 @@
 
////////////////////////////////////////////////////////////////////////////////
 // Shader Programs 
-vertex_program Gazebo/DepthMapVS glsl
-{
-  source DepthMap.vert
 
-  default_params
-  {
-    param_named_auto texelOffsets texel_offsets
-    param_named_auto pNear near_clip_distance
-    param_named_auto pFar far_clip_distance
-  }
-}
-
-fragment_program Gazebo/DepthMapFS glsl
-{
-  source DepthMap.frag
-
-  default_params
-  {
-  }
-}
-
 // A really basic ambient pass program, support for one texture coodinate set
 vertex_program AmbientOneTexture glsl
 {
-  source AmbientOneTexture.glsl
+  source ambient_one_texture_vp.glsl
 
   default_params
   {
@@ -32,109 +12,9 @@
   }
 }
 
-vertex_program Ogre/DepthShadowmap/CasterVP glsl
-{
-    source DepthShadowmapCasterVp.glsl
 
-  preprocessor_defines LINEAR_RANGE=0
 
-    default_params
-    {
-        param_named_auto worldViewProj worldviewproj_matrix
-    param_named_auto texelOffsets texel_offsets
-    //param_named_auto depthRange scene_depth_range
-    }
-}
 
-
-fragment_program Ogre/DepthShadowmap/CasterFP glsl
-{
-    source DepthShadowmapCasterFp.glsl
-
-  preprocessor_defines LINEAR_RANGE=0
-
-    default_params
-    {
-    }
-}
-
-
-vertex_program Ogre/DepthShadowmap/ReceiverVP glsl
-{
-    source DepthShadowmapReceiverVp.glsl
-
-  preprocessor_defines LINEAR_RANGE=0
-
-    default_params
-    {
-        param_named_auto world world_matrix
-        param_named_auto worldIT inverse_transpose_world_matrix
-    param_named_auto worldViewProj worldviewproj_matrix
-    param_named_auto texViewProj texture_viewproj_matrix
-    param_named_auto lightPosition light_position 0
-    param_named_auto lightColour light_diffuse_colour 0
-    //param_named_auto shadowDepthRange shadow_scene_depth_range 0
-    }
-}
-
-
-fragment_program Ogre/DepthShadowmap/ReceiverFP glsl
-{
-    source DepthShadowmapReceiverFp.glsl
-
-  preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=0
-
-  default_params
-    {
-    param_named shadowMap int 0
-        param_named inverseShadowmapSize float 0.0009765625
-    param_named fixedDepthBias float 0.0005
-    param_named gradientClamp float 0.0098
-    param_named gradientScaleBias float 0
-    //param_named shadowFuzzyWidth float 1
-    }
-}
-
-// Generic Shadow caster material (floating point shadowmap)
-material Ogre/DepthShadowmap/Caster/Float
-{
-  technique
-    {
-        pass
-        {
-            vertex_program_ref Ogre/DepthShadowmap/CasterVP
-            {
-            }
-            fragment_program_ref Ogre/DepthShadowmap/CasterFP
-            {
-            }
-        }
-    }
-}
-
-// Generic Shadow receiver material (floating point shadowmap)
-material Ogre/DepthShadowmap/Receiver/Float
-{
-  technique
-    {
-        pass
-        {
-            vertex_program_ref Ogre/DepthShadowmap/ReceiverVP
-            {
-            }
-            fragment_program_ref Ogre/DepthShadowmap/ReceiverFP
-            {
-            }
-            texture_unit ShadowMap
-            {
-                tex_address_mode clamp
-                filtering none
-            }
-        }
-    }
-}
-
-
 material Gazebo/White
 {
        receive_shadows on
@@ -894,56 +774,6 @@
 }
 
 
-
-
-
-//vertex_program ShadowCasterVP glsl
-//{
-//  source v-shadow-caster.cg
-//    entry_point main
-//    profiles arbvp1
-//
-//    default_params
-//    {
-//      param_named_auto p_ModelViewProjection worldviewproj_matrix
-//        param_named_auto p_AmbientLight ambient_light_colour
-//    }
-//}
-
-//fragment_program ShadowCasterFP glsl
-//{
-//  source f-shadow-caster.cg
-//    entry_point main
-//    profiles arbfp1
-//    // Store normalized (usefull to avoid overflowin) or non-normalized 
depth ?
-//    //compile_arguments -DSTORE_NORMALIZED_DEPTH
-//
-//    default_params
-//    {
-//      // Only used when storing normalized depth values
-//      //param_named_auto p_Near near_clip_distance
-//      //param_named_auto p_Far far_clip_distance
-//      param_named p_DepthOffset float 0.01
-//    }
-//}
-
-//material ShadowCaster
-//{
-//  technique default
-//  {
-//    // Z-write only pass
-//    pass Z-write
-//    {
-//      vertex_program_ref ShadowCasterVP
-//      {
-//      }
-//      fragment_program_ref ShadowCasterFP
-//      {
-//      }
-//    }
-//  }
-//}
-
 material Gazebo/Fish
 {
   technique
@@ -1100,22 +930,8 @@
   }
 }
 
-material Gazebo/DepthMap
-{
-  technique
-  {
-    pass
-    {
-      vertex_program_ref Gazebo/DepthMapVS
-      {
-      }
-      fragment_program_ref Gazebo/DepthMapFS
-      {
-      }
-    }
-  }
-}
 
+
 material Gazebo/PCBGreen
 {
        technique

Modified: code/gazebo/branches/wx/Media/materials/scripts/blur.material
===================================================================
--- code/gazebo/branches/wx/Media/materials/scripts/blur.material       
2010-09-20 21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/Media/materials/scripts/blur.material       
2010-09-21 20:46:40 UTC (rev 8915)
@@ -19,7 +19,7 @@
 
       texture_unit
       {
-        filtering none
+        filtering bilinear
       }
     }
   }

Modified: code/gazebo/branches/wx/Media/materials/scripts/shadow_caster.material
===================================================================
--- code/gazebo/branches/wx/Media/materials/scripts/shadow_caster.material      
2010-09-20 21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/Media/materials/scripts/shadow_caster.material      
2010-09-21 20:46:40 UTC (rev 8915)
@@ -1,27 +1,24 @@
-// declare the vertex shader (glsl)
-vertex_program shadow_caster_vs_glsl glsl
+vertex_program shadow_caster_vp_glsl glsl
 {
-  source pssm_vsm_caster_vp.glsl
+  source shadow_caster_vp.glsl
 
   default_params
   {
-    // pMat == projection matrix
-    param_named_auto pMat projection_matrix
-
-    // wvMat == world * view matrix
     param_named_auto wvMat worldview_matrix
+    param_named_auto pMat projection_matrix
+    param_named_auto wvpMat worldviewproj_matrix
+    param_named_auto texel_offsets texel_offsets
+    param_named_auto depth_range scene_depth_range 
   }
 }
 
-// declare the fragment shader (glsl)
-fragment_program shadow_caster_ps_glsl glsl
+fragment_program shadow_caster_fp_glsl glsl
 {
-  source pssm_vsm_caster_fp.glsl
+  source shadow_caster_fp.glsl
 
   default_params
   {
-    // this is the scene's depth range
-    param_named_auto depthRange scene_depth_range
+    //param_named_auto far far_clip_distance
   }
 }
 
@@ -30,14 +27,14 @@
 {
   technique
   {
-    // all this will do is write depth and depth\xB2 to red and green
+    // all this will do is write depth and depth*depth to red and green
     pass
     {
-      vertex_program_ref shadow_caster_vs_glsl
+      vertex_program_ref shadow_caster_vp_glsl
       {
       }
 
-      fragment_program_ref shadow_caster_ps_glsl
+      fragment_program_ref shadow_caster_fp_glsl
       {
       }
     }

Modified: 
code/gazebo/branches/wx/Media/materials/scripts/shadow_receiver.material
===================================================================
--- code/gazebo/branches/wx/Media/materials/scripts/shadow_receiver.material    
2010-09-20 21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/Media/materials/scripts/shadow_receiver.material    
2010-09-21 20:46:40 UTC (rev 8915)
@@ -1,30 +1,42 @@
-vertex_program receiver_vs_glsl glsl
+vertex_program receiver_vp_glsl glsl
 {
-  source pssm_vsm_receiver_vp.glsl
+  source shadow_receiver_vp.glsl
 
   default_params
   {
     param_named_auto wMat world_matrix
+    param_named_auto wvMat worldview_matrix
     param_named_auto wvpMat worldviewproj_matrix
-    param_named_auto tvpMat texture_viewproj_matrix 0
-    param_named_auto spotlightDir light_direction_object_space 0
+    param_named_auto inv_trans_wvMat inverse_transpose_worldview_matrix
+    param_named_auto shadow_depth_range shadow_scene_depth_range 0
+
+    param_named_auto lightWorldPos light_position_object_space 0
+    param_named_auto twvpMat texture_worldviewproj_matrix 0
+
+    param_named_auto spotDir light_direction_object_space 0
   }
 }
 
-fragment_program receiver_ps_glsl glsl
+fragment_program receiver_fp_glsl glsl
 {
-  source pssm_vsm_receiver_fp.glsl
+  source shadow_receiver_fp.glsl
 
   default_params
   {
-    param_named_auto lightDif0 light_receiver_colour 0
-    param_named_auto lightPos0 light_position 0
-    param_named_auto lightAtt0 light_attenuation 0
-    param_named_auto invSMSize inverse_texture_size 1
-    param_named_auto depthRange shadow_scene_depth_range 0
-    param_named_auto spotlightParams spotlight_params 0
-    param_named dMap int 0
+    param_named_auto invShadowMapSize inverse_texture_size 1
+    param_named_auto derived_light_diffuse_color derived_light_diffuse_colour 0
+    param_named_auto derived_light_specular_color 
derived_light_specular_colour 0
+    param_named_auto surface_shininess surface_shininess
+
+
+    param_named_auto light_position_view_space light_position_view_space 0
+    param_named_auto light_position_world_space light_position 0
+    param_named_auto light_direction_view_space light_direction_view_space 0
+    param_named_auto light_attenuation light_attenuation 0
+    param_named_auto spotlight_params spotlight_params 0
+
     param_named shadowMap int 1
+    param_named diffuseMap int 0
   }
 }
 
@@ -60,13 +72,13 @@
 
       ambient  0 0 0
       diffuse  1 1 1
-      specular 1 1 1 128
+      specular .5 .5 .5 128
 
-      vertex_program_ref receiver_vs_glsl
+      vertex_program_ref receiver_vp_glsl
       {
       }
 
-      fragment_program_ref receiver_ps_glsl
+      fragment_program_ref receiver_fp_glsl
       {
       }
 
@@ -82,6 +94,7 @@
         tex_address_mode border
         tex_border_colour 1 1 1
       }
+
     }
   }
 }

Modified: code/gazebo/branches/wx/server/physics/PlaneShape.cc
===================================================================
--- code/gazebo/branches/wx/server/physics/PlaneShape.cc        2010-09-20 
21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/server/physics/PlaneShape.cc        2010-09-21 
20:46:40 UTC (rev 8915)
@@ -50,7 +50,7 @@
   this->materialP = new ParamT<std::string>("material","",1);
   this->materialP->Callback( &PlaneShape::SetMaterial, this );
 
-  this->castShadowsP = new ParamT<bool>("castShadows", false, 0);
+  this->castShadowsP = new ParamT<bool>("castShadows", true, 0);
   this->castShadowsP->Callback( &PlaneShape::SetCastShadows, this );
   Param::End();
 }

Modified: code/gazebo/branches/wx/server/rendering/Light.cc
===================================================================
--- code/gazebo/branches/wx/server/rendering/Light.cc   2010-09-20 21:58:33 UTC 
(rev 8914)
+++ code/gazebo/branches/wx/server/rendering/Light.cc   2010-09-21 20:46:40 UTC 
(rev 8915)
@@ -46,7 +46,7 @@
   this->specularP = new ParamT<Color>("specularColor", Color(.1, .1, .1), 0);
   this->specularP->Callback(&Light::SetSpecularColor, this);
 
-  this->directionP  = new ParamT<Vector3>("direction", Vector3(0, 0, -1), 0);
+  this->directionP  = new ParamT<Vector3>("direction", Vector3(0, 0, 1), 0);
   this->directionP->Callback(&Light::SetDirection, this);
 
   this->attenuationP  = new ParamT<Vector3>("attenuation", Vector3(.1, 0.01, 
.001), 1);
@@ -55,7 +55,7 @@
   this->spotInnerAngleP = new ParamT<double>("innerAngle", 10, 0);
   this->spotInnerAngleP->Callback(&Light::SetSpotInnerAngle, this);
 
-  this->spotOutterAngleP = new ParamT<double>("outterAngle", 5, 0);
+  this->spotOutterAngleP = new ParamT<double>("outerAngle", 20, 0);
   this->spotOutterAngleP->Callback(&Light::SetSpotOutterAngle, this);
 
   this->spotFalloffP = new ParamT<double>("falloff", 1, 0);
@@ -139,14 +139,18 @@
   this->SetSpotOutterAngle(**this->spotOutterAngleP);
   this->SetSpotFalloff(**this->spotFalloffP);
 
+  //this->light->setSpotlightRange(Ogre::Radian(20), Ogre::Radian(40),32.0), 
+  //this->light->setSpotlightInnerAngle( Ogre::Radian(Ogre::Degree(20)) );
+  //this->light->setSpotlightOuterAngle( Ogre::Radian(Ogre::Degree(40)) ); 
+
   // TODO: More options for Spot lights, etc.
   //  options for spotlights
-  if ((**this->lightTypeP) == "spot")
+  /*if ((**this->lightTypeP) == "spot")
   {
     vec = node->GetVector3("spotCone", Vector3(30.0, 65.0, 1.0));
     this->light->setSpotlightRange(Ogre::Degree(vec.x), 
                                    Ogre::Degree(vec.y), vec.z);
-  }
+  }*/
 
   this->visualNode->AttachObject(light);
 
@@ -183,46 +187,87 @@
   this->line = OgreCreator::Instance()->CreateDynamicLine(
       OgreDynamicRenderable::OT_LINE_LIST);
 
-  float s=0.1;
-  this->line->AddPoint(Vector3(-s,-s,0));
-  this->line->AddPoint(Vector3(-s,s,0));
+  if ( **this->lightTypeP == "point" )
+  {
+    float s=0.1;
+    this->line->AddPoint(Vector3(-s,-s,0));
+    this->line->AddPoint(Vector3(-s,s,0));
 
-  this->line->AddPoint(Vector3(-s,s,0));
-  this->line->AddPoint(Vector3(s,s,0));
+    this->line->AddPoint(Vector3(-s,s,0));
+    this->line->AddPoint(Vector3(s,s,0));
 
-  this->line->AddPoint(Vector3(s,s,0));
-  this->line->AddPoint(Vector3(s,-s,0));
+    this->line->AddPoint(Vector3(s,s,0));
+    this->line->AddPoint(Vector3(s,-s,0));
 
-  this->line->AddPoint(Vector3(s,-s,0));
-  this->line->AddPoint(Vector3(-s,-s,0));
+    this->line->AddPoint(Vector3(s,-s,0));
+    this->line->AddPoint(Vector3(-s,-s,0));
 
 
-  this->line->AddPoint(Vector3(-s,-s,0));
-  this->line->AddPoint(Vector3(0,0,s));
+    this->line->AddPoint(Vector3(-s,-s,0));
+    this->line->AddPoint(Vector3(0,0,s));
 
-  this->line->AddPoint(Vector3(-s,s,0));
-  this->line->AddPoint(Vector3(0,0,s));
+    this->line->AddPoint(Vector3(-s,s,0));
+    this->line->AddPoint(Vector3(0,0,s));
 
-  this->line->AddPoint(Vector3(s,s,0));
-  this->line->AddPoint(Vector3(0,0,s));
+    this->line->AddPoint(Vector3(s,s,0));
+    this->line->AddPoint(Vector3(0,0,s));
 
-  this->line->AddPoint(Vector3(s,-s,0));
-  this->line->AddPoint(Vector3(0,0,s));
+    this->line->AddPoint(Vector3(s,-s,0));
+    this->line->AddPoint(Vector3(0,0,s));
 
 
 
-  this->line->AddPoint(Vector3(-s,-s,0));
-  this->line->AddPoint(Vector3(0,0,-s));
+    this->line->AddPoint(Vector3(-s,-s,0));
+    this->line->AddPoint(Vector3(0,0,-s));
 
-  this->line->AddPoint(Vector3(-s,s,0));
-  this->line->AddPoint(Vector3(0,0,-s));
+    this->line->AddPoint(Vector3(-s,s,0));
+    this->line->AddPoint(Vector3(0,0,-s));
 
-  this->line->AddPoint(Vector3(s,s,0));
-  this->line->AddPoint(Vector3(0,0,-s));
+    this->line->AddPoint(Vector3(s,s,0));
+    this->line->AddPoint(Vector3(0,0,-s));
 
-  this->line->AddPoint(Vector3(s,-s,0));
-  this->line->AddPoint(Vector3(0,0,-s));
+    this->line->AddPoint(Vector3(s,-s,0));
+    this->line->AddPoint(Vector3(0,0,-s));
 
+  }
+  else if ( this->light->getType() == Ogre::Light::LT_SPOTLIGHT )
+  {
+    double innerAngle = this->light->getSpotlightInnerAngle().valueRadians();
+    double outerAngle = this->light->getSpotlightOuterAngle().valueRadians();
+
+    double angles[2];
+    double range = 0.2;
+    angles[0] = range * tan(outerAngle);
+    angles[1] = range * tan(innerAngle);
+    for (unsigned int i=0; i < 2; i++)
+    {
+      this->line->AddPoint(Vector3(0,0,0));
+      this->line->AddPoint(Vector3(angles[i],angles[i], -range));
+
+      this->line->AddPoint(Vector3(0,0,0));
+      this->line->AddPoint(Vector3(-angles[i],-angles[i], -range));
+
+      this->line->AddPoint(Vector3(0,0,0));
+      this->line->AddPoint(Vector3(angles[i],-angles[i], -range));
+
+      this->line->AddPoint(Vector3(0,0,0));
+      this->line->AddPoint(Vector3(-angles[i],angles[i], -range));
+
+      this->line->AddPoint(Vector3(angles[i],angles[i], -range));
+      this->line->AddPoint(Vector3(-angles[i],angles[i], -range));
+
+      this->line->AddPoint(Vector3(-angles[i],angles[i], -range));
+      this->line->AddPoint(Vector3(-angles[i],-angles[i], -range));
+
+      this->line->AddPoint(Vector3(-angles[i],-angles[i], -range));
+      this->line->AddPoint(Vector3(angles[i],-angles[i], -range));
+
+      this->line->AddPoint(Vector3(angles[i],-angles[i], -range));
+      this->line->AddPoint(Vector3(angles[i],angles[i], -range));
+    }
+    
+  }
+
   this->line->setMaterial("Gazebo/WhiteEmissive");
   this->line->setVisibilityFlags(GZ_LASER_CAMERA);
 
@@ -366,8 +411,8 @@
 
   if (this->light->getType() == Ogre::Light::LT_SPOTLIGHT)
     this->light->setSpotlightRange(
-        Ogre::Radian(Ogre::Degree(**this->spotInnerAngleP)), 
-        Ogre::Radian(Ogre::Degree(**this->spotOutterAngleP)), 
+        Ogre::Degree(**this->spotInnerAngleP), 
+        Ogre::Degree(**this->spotOutterAngleP), 
         **this->spotFalloffP);
 }
 
@@ -380,10 +425,9 @@
 
   if (this->light->getType() == Ogre::Light::LT_SPOTLIGHT)
     this->light->setSpotlightRange(
-        Ogre::Radian(Ogre::Degree(**this->spotInnerAngleP)), 
-        Ogre::Radian(Ogre::Degree(**this->spotOutterAngleP)), 
+        Ogre::Degree(**this->spotInnerAngleP), 
+        Ogre::Degree(**this->spotOutterAngleP), 
         **this->spotFalloffP);
-
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -395,8 +439,8 @@
 
   if (this->light->getType() == Ogre::Light::LT_SPOTLIGHT)
     this->light->setSpotlightRange(
-        Ogre::Radian(Ogre::Degree(**this->spotInnerAngleP)), 
-        Ogre::Radian(Ogre::Degree(**this->spotOutterAngleP)), 
+        Ogre::Degree(**this->spotInnerAngleP), 
+        Ogre::Degree(**this->spotOutterAngleP), 
         **this->spotFalloffP);
 
 }

Modified: code/gazebo/branches/wx/server/rendering/OgreAdaptor.cc
===================================================================
--- code/gazebo/branches/wx/server/rendering/OgreAdaptor.cc     2010-09-20 
21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/server/rendering/OgreAdaptor.cc     2010-09-21 
20:46:40 UTC (rev 8915)
@@ -174,7 +174,7 @@
   }
 
   // Set default mipmap level (NB some APIs ignore this)
-  //Ogre::TextureManager::getSingleton().setDefaultNumMipmaps( 5 );
+  Ogre::TextureManager::getSingleton().setDefaultNumMipmaps( 5 );
   
   // init the resources
   Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

Modified: code/gazebo/branches/wx/server/rendering/OgreCamera.cc
===================================================================
--- code/gazebo/branches/wx/server/rendering/OgreCamera.cc      2010-09-20 
21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/server/rendering/OgreCamera.cc      2010-09-21 
20:46:40 UTC (rev 8915)
@@ -474,7 +474,7 @@
 
   if (camera)
   {
-    this->camera->setNearClipDistance(.01);
+    this->camera->setNearClipDistance(.001);
     this->camera->setFarClipDistance(1000);
   }
 }
@@ -1132,7 +1132,7 @@
 
   this->camera->setDirection(1,0,0);
 
-  this->camera->setNearClipDistance(.01);//**this->nearClipP);
+  this->camera->setNearClipDistance(.001);//**this->nearClipP);
   this->camera->setFarClipDistance(1000);//**this->farClipP);
 
   if (this->renderTarget)

Modified: code/gazebo/branches/wx/server/rendering/OgreCreator.cc
===================================================================
--- code/gazebo/branches/wx/server/rendering/OgreCreator.cc     2010-09-20 
21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/server/rendering/OgreCreator.cc     2010-09-21 
20:46:40 UTC (rev 8915)
@@ -106,7 +106,7 @@
     parent->AttachMesh(resultName);
     parent->SetMaterial(material);
 
-    parent->SetCastShadows(castShadows);
+    parent->SetCastShadows(true);
   }
   catch (Ogre::ItemIdentityException e)
   {

Modified: code/gazebo/branches/wx/server/rendering/Scene.cc
===================================================================
--- code/gazebo/branches/wx/server/rendering/Scene.cc   2010-09-20 21:58:33 UTC 
(rev 8914)
+++ code/gazebo/branches/wx/server/rendering/Scene.cc   2010-09-21 20:46:40 UTC 
(rev 8915)
@@ -159,8 +159,8 @@
 
   // Register this scene the the real time shaders system
   RTShaderSystem::Instance()->AddScene(this);
+
   this->ApplyShadows();
-//this->CreateDebugScene();
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -271,6 +271,51 @@
   for (iter = this->cameras.begin(); iter != this->cameras.end(); iter++)
     (*iter)->PostRender();
 
+  Ogre::HardwarePixelBufferSharedPtr pixelBuffer;
+  Ogre::RenderTexture *rTexture;
+  Ogre::Viewport* renderViewport;
+
+  // Get access to the buffer and make an image and write it to file
+  if (false && this->manager && !this->manager->getShadowTexture(0).isNull())
+  {
+    pixelBuffer = this->manager->getShadowTexture(0)->getBuffer();
+    rTexture = pixelBuffer->getRenderTarget();
+
+    Ogre::PixelFormat format = pixelBuffer->getFormat();
+    renderViewport = rTexture->getViewport(0);
+
+    size_t size = Ogre::PixelUtil::getMemorySize(1024, 1024, 1, format);
+
+    //// Allocate buffer
+    float *saveFrameBuffer = new float[1024*1024*3];
+
+    memset(saveFrameBuffer, 0, size);
+
+    Ogre::PixelBox box(1024, 1024, 1, format, saveFrameBuffer);
+
+    std::cout << "Depth[" << this->manager->getShadowTexture(0)->getDepth() << 
"]\n";
+    pixelBuffer->blitToMemory( box );
+
+    std::cout << "SIZE[" << size << "] [" << 1024 * 1024 * (4*3) << "]\n";
+
+    FILE *file = fopen("/tmp/nate.data","w");
+    for (unsigned int y = 0; y < 1024; y++)
+    {
+      for (unsigned int x=0;x<1024;x++)
+      {
+        float d = saveFrameBuffer[ y*(1024*3) + x*3 + 0];
+        float dd = saveFrameBuffer[ y*(1024*3)+ x*3 + 1];
+        fprintf(file, "[%f %f] ",d,dd);
+      }
+      fprintf(file,"\n");
+    }
+
+    fclose(file);
+
+    //exit(1);
+    delete [] saveFrameBuffer;
+  }
+
   //this->manager->_handleLodEvents();
 }
 
@@ -469,12 +514,13 @@
     this->manager->getManualObject(name)->setVisible(visible);
 }
 
+////////////////////////////////////////////////////////////////////////////////
 void Scene::ApplyShadows()
 {
-  // 3 shadow textures per light
+  // Allow a total of 4 shadow casters per scene
   const int numShadowTextures = 4;
 
-  this->manager->setShadowTextureSelfShadow(true);
+  this->manager->setShadowFarDistance(50);
 
   // use a vsm caster material
   this->manager->setShadowTextureCasterMaterial("shadow_caster");
@@ -483,24 +529,51 @@
   this->manager->setShadowTextureSize(512);
   this->manager->setShadowTexturePixelFormat(Ogre::PF_FLOAT16_RGB);
   this->manager->setShadowCasterRenderBackFaces(false);
+  this->manager->setShadowTextureSelfShadow(false);
+  
this->manager->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED);
 
-  /*const unsigned numShadowRTTs = this->manager->getShadowTextureCount();
-  for (unsigned i = 0; i < numShadowRTTs; ++i) 
-  {
-    Ogre::TexturePtr tex = this->manager->getShadowTexture(i);
-    Ogre::Viewport *vp = tex->getBuffer()->getRenderTarget()->getViewport(0);
-    vp->setBackgroundColour(Ogre::ColourValue(1, 1, 1, 1));
-    vp->setClearEveryFrame(true);
-    Ogre::CompositorManager::getSingleton().addCompositor(vp, "blur");
-    Ogre::CompositorManager::getSingleton().setCompositorEnabled(vp, "blur", 
true);
-  }*/
+  //const unsigned numShadowRTTs = this->manager->getShadowTextureCount();
+  //for (unsigned i = 0; i < numShadowRTTs; ++i) 
+  //{
+  //  Ogre::TexturePtr tex = this->manager->getShadowTexture(i);
+  //  Ogre::Viewport *vp = tex->getBuffer()->getRenderTarget()->getViewport(0);
+  //  vp->setBackgroundColour(Ogre::ColourValue(0, 0, 1, 1));
+  //  vp->setClearEveryFrame(true);
+  //  Ogre::CompositorManager::getSingleton().addCompositor(vp, "blur");
+  //  Ogre::CompositorManager::getSingleton().setCompositorEnabled(vp, "blur", 
true);
+  //}
 
-  
this->manager->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED);
-
   //Ogre::LiSPSMShadowCameraSetup *camSetup = new 
Ogre::LiSPSMShadowCameraSetup();
+  //Ogre::FocusedShadowCameraSetup *camSetup = new 
Ogre::FocusedShadowCameraSetup();
   //this->manager->setShadowCameraSetup(Ogre::ShadowCameraSetupPtr(camSetup));
 
+  // add the overlay elements to show the shadow maps:
+  // init overlay elements
+  Ogre::OverlayManager& mgr = Ogre::OverlayManager::getSingleton();
+  Ogre::Overlay* overlay = mgr.create("DebugOverlay");
 
+  for (size_t i = 0; i < 1; ++i) {
+    Ogre::TexturePtr tex = this->manager->getShadowTexture(i);
+
+    // Set up a debug panel to display the shadow
+    Ogre::MaterialPtr debugMat =Ogre:: MaterialManager::getSingleton().create(
+        "Ogre/DebugTexture" + Ogre::StringConverter::toString(i),
+        Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+    debugMat->getTechnique(0)->getPass(0)->setLightingEnabled(false);
+    Ogre::TextureUnitState *t = 
debugMat->getTechnique(0)->getPass(0)->createTextureUnitState(tex->getName());
+    t->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP);
+
+    Ogre::OverlayContainer* debugPanel = (Ogre::OverlayContainer*)
+      (Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", 
"Ogre/DebugTexPanel" + Ogre::StringConverter::toString(i)));
+    debugPanel->_setPosition(0.8, i*0.25);
+    debugPanel->_setDimensions(0.2, 0.24);
+    debugPanel->setMaterialName(debugMat->getName());
+    overlay->add2D(debugPanel);
+    overlay->show();
+  }
+
+
+  /* PSSM Stuff
   //this->manager->setShadowTextureCountPerLightType(Ogre::Light::LT_POINT, 
numShadowTextures);
   //this->manager->setShadowFarDistance(200);
   //this->manager->setShadowTextureConfig(0, 512, 512, Ogre::PF_FLOAT16_RGB);
@@ -508,7 +581,7 @@
   //this->manager->setShadowTextureConfig(2, 512, 512, Ogre::PF_FLOAT16_RGB);
 
   // shadow camera setup
-  /*Ogre::PSSMShadowCameraSetup* pssmSetup = new Ogre::PSSMShadowCameraSetup();
+  Ogre::PSSMShadowCameraSetup* pssmSetup = new Ogre::PSSMShadowCameraSetup();
   Ogre::PSSMShadowCameraSetup::SplitPointList splitPointList = 
pssmSetup->getSplitPoints();
 
   //pssmSetup->setCameraLightDirectionThreshold(Ogre::Degree(20));
@@ -538,45 +611,5 @@
   {
     
mat->getTechnique(i)->getPass(1)->getFragmentProgramParameters()->setNamedConstant("pssmSplitPoints",
 splitPoints);
   }
-
-  // add the overlay elements to show the shadow maps:
-  // init overlay elements
-  Ogre::OverlayManager& mgr = Ogre::OverlayManager::getSingleton();
-  Ogre::Overlay* overlay = mgr.create("DebugOverlay");
-
-  for (size_t i = 0; i < 3; ++i) {
-    Ogre::TexturePtr tex = this->manager->getShadowTexture(i);
-
-    // Set up a debug panel to display the shadow
-    Ogre::MaterialPtr debugMat =Ogre:: MaterialManager::getSingleton().create(
-        "Ogre/DebugTexture" + Ogre::StringConverter::toString(i),
-        Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
-    debugMat->getTechnique(0)->getPass(0)->setLightingEnabled(false);
-    Ogre::TextureUnitState *t = 
debugMat->getTechnique(0)->getPass(0)->createTextureUnitState(tex->getName());
-    t->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP);
-
-    Ogre::OverlayContainer* debugPanel = (Ogre::OverlayContainer*)
-      (Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", 
"Ogre/DebugTexPanel" + Ogre::StringConverter::toString(i)));
-    debugPanel->_setPosition(0.8, i*0.25);
-    debugPanel->_setDimensions(0.2, 0.24);
-    debugPanel->setMaterialName(debugMat->getName());
-    overlay->add2D(debugPanel);
-    overlay->show();
-  }
   */
 }
-
-void Scene::CreateDebugScene()
-{
-  // create our flash light
-  Ogre::Light *light = this->manager->createLight("flashLight");
-  light->setDiffuseColour(Ogre::ColourValue(1, 1, 1));
-  light->setType(Ogre::Light::LT_SPOTLIGHT);
-  light->setSpotlightInnerAngle(Ogre::Degree(55));
-  light->setSpotlightOuterAngle(Ogre::Degree(65));
-  light->setAttenuation(50, 1, 1, 1); // meter range.  the others our shader 
ignores      
-  light->setDirection(Ogre::Vector3(0, 0, -1));
-  Ogre::SceneNode *node = 
this->manager->getRootSceneNode()->createChildSceneNode("flashLightNode");
-  node->attachObject(light);
-  node->setPosition( 0,2,5);
-}

Modified: code/gazebo/branches/wx/server/rendering/Scene.hh
===================================================================
--- code/gazebo/branches/wx/server/rendering/Scene.hh   2010-09-20 21:58:33 UTC 
(rev 8914)
+++ code/gazebo/branches/wx/server/rendering/Scene.hh   2010-09-21 20:46:40 UTC 
(rev 8915)
@@ -96,8 +96,6 @@
 
     private: void ApplyShadows();
 
-    private: void CreateDebugScene();
-
     private: std::string name;
     private: ParamT<Color> *ambientP;
     private: ParamT<Color> *backgroundColorP;

Modified: code/gazebo/branches/wx/server/wx/SimulationFrame.cc
===================================================================
--- code/gazebo/branches/wx/server/wx/SimulationFrame.cc        2010-09-20 
21:58:33 UTC (rev 8914)
+++ code/gazebo/branches/wx/server/wx/SimulationFrame.cc        2010-09-21 
20:46:40 UTC (rev 8915)
@@ -433,7 +433,7 @@
   else if (id == SPOT)
   {
     this->renderPanel->SetCursor(*wxCROSS_CURSOR);
-    Events::createEntitySignal("spolight");
+    Events::createEntitySignal("spotlight");
   }
   else if (id == DIRECTIONAL)
   {
@@ -638,8 +638,8 @@
   this->toolbar->AddRadioTool(SPHERE, wxT("Sphere"), sphere_bitmap, 
wxNullBitmap, wxT("Create a sphere"));
   this->toolbar->AddRadioTool(CYLINDER, wxT("Cylinder"), cylinder_bitmap, 
wxNullBitmap, wxT("Create a cylinder"));
   this->toolbar->AddRadioTool(POINT, wxT("Point"), pointlight_bitmap, 
wxNullBitmap, wxT("Create a point light source"));
-  this->toolbar->AddRadioTool(POINT, wxT("Spot"), spotlight_bitmap, 
wxNullBitmap, wxT("Create a spot light"));
-  this->toolbar->AddRadioTool(POINT, wxT("Directional"), 
directionallight_bitmap, wxNullBitmap, wxT("Create a directional light"));
+  this->toolbar->AddRadioTool(SPOT, wxT("Spot"), spotlight_bitmap, 
wxNullBitmap, wxT("Create a spot light"));
+  this->toolbar->AddRadioTool(DIRECTIONAL, wxT("Directional"), 
directionallight_bitmap, wxNullBitmap, wxT("Create a directional light"));
   this->toolbar->Realize();
 
 #endif

Modified: code/gazebo/branches/wx/server/wx/SpotLightMaker.cc
===================================================================
--- code/gazebo/branches/wx/server/wx/SpotLightMaker.cc 2010-09-20 21:58:33 UTC 
(rev 8914)
+++ code/gazebo/branches/wx/server/wx/SpotLightMaker.cc 2010-09-21 20:46:40 UTC 
(rev 8915)
@@ -94,11 +94,15 @@
       <specularColor>0.1 0.1 0.1</specularColor>\
       <diffuseColor>0.8 0.8 0.8</diffuseColor>\
       <attenuation>0.5 0.01 0</attenuation>\
+      <innerAngle>20</innerAngle>\
+      <outerAngle>40</outerAngle>\
+      <falloff>1.0</falloff>\
       <range>20</range>\
     </light>\
     </model:renderable>";
 
   newModelStr <<  "</gazebo:world>";
 
+  std::cout << "Make spot light[" << newModelStr << "]\n"; 
   World::Instance()->InsertEntity(newModelStr.str());
 }

Modified: code/gazebo/branches/wx/worlds/empty.world
===================================================================
--- code/gazebo/branches/wx/worlds/empty.world  2010-09-20 21:58:33 UTC (rev 
8914)
+++ code/gazebo/branches/wx/worlds/empty.world  2010-09-21 20:46:40 UTC (rev 
8915)
@@ -59,43 +59,136 @@
   </model:physical>
 
   <model:physical name="sphere1_model">
-    <xyz>0 0 2.2</xyz>
+    <xyz>0 0 0.25</xyz>
     <rpy>0 0.0 0.0</rpy>
-    <static>false</static>
+    <static>true</static>
 
     <body:sphere name="sphere1_body">
-      <geom:sphere name="sphere1_geom">
-        <size>0.2</size>
+      <geom:box name="sphere1_geom">
+        <size>0.5 0.5 0.5</size>
         <mass>1.0</mass>
 
         <mu1>109999.0</mu1>
 
         <visual>
-          <size>.4 .4 .4</size>
+          <size>.5 .5 .5</size>
           <mesh>unit_sphere</mesh>
           <!--<mesh>hanoi_blue_disk.dae</mesh>-->
           <shader>pixel</shader>
           <material>Gazebo/GrayGrid</material>
         </visual>
-      </geom:sphere>
+      </geom:box>
     </body:sphere>
   </model:physical>
 
 
+  <!--
+  <model:physical name="sphere2_model">
+    <xyz>-1 0 0.25</xyz>
+    <rpy>0 0.0 0.0</rpy>
+    <static>true</static>
+
+    <body:sphere name="sphere1_body">
+      <geom:box name="sphere1_geom">
+        <size>0.2 0.2 0.5</size>
+        <mass>1.0</mass>
+
+        <mu1>109999.0</mu1>
+
+        <visual>
+          <size>.2 .2 .5</size>
+          <mesh>unit_box</mesh>
+          <shader>pixel</shader>
+          <material>Gazebo/GrayGrid</material>
+        </visual>
+      </geom:box>
+    </body:sphere>
+  </model:physical>
+
+
+  <model:physical name="sphere3_model">
+    <xyz>0 1 0.25</xyz>
+    <rpy>0 0.0 0.0</rpy>
+    <static>true</static>
+
+    <body:sphere name="sphere1_body">
+      <geom:box name="sphere1_geom">
+        <size>0.2 0.2 0.5</size>
+        <mass>1.0</mass>
+
+        <mu1>109999.0</mu1>
+
+        <visual>
+          <size>.2 .2 .5</size>
+          <mesh>unit_box</mesh>
+          <shader>pixel</shader>
+          <material>Gazebo/GrayGrid</material>
+        </visual>
+      </geom:box>
+    </body:sphere>
+  </model:physical>
+
+  <model:physical name="sphere4_model">
+    <xyz>0 -1 0.25</xyz>
+    <rpy>0 0.0 0.0</rpy>
+    <static>true</static>
+
+    <body:sphere name="sphere1_body">
+      <geom:box name="sphere1_geom">
+        <size>0.2 0.2 0.5</size>
+        <mass>1.0</mass>
+
+        <mu1>109999.0</mu1>
+
+        <visual>
+          <size>.2 .2 .5</size>
+          <mesh>unit_box</mesh>
+          <shader>pixel</shader>
+          <material>Gazebo/GrayGrid</material>
+        </visual>
+      </geom:box>
+    </body:sphere>
+  </model:physical>
+  -->
+
+
   <!-- White Point light -->
   <model:renderable name="point_white">
-    <xyz>0.0 2.0 5</xyz>
+    <xyz>0.0 0.0 2</xyz>
+    <rpy>0 0 0</rpy>
     <static>true</static>
     <light>
       <type>spot</type>
-      <diffuseColor>1.0 1.0 1.0 1.0</diffuseColor>
+      <diffuseColor>0.6 0.6 0.6 1.0</diffuseColor>
+      <specularColor>0 0 0 1.0</specularColor>
+      <attenuation>.1 0.2 0.001</attenuation>
+      <innerAngle>5</innerAngle>
+      <outerAngle>60</outerAngle>
+      <falloff>10.0</falloff>
+      <range>100</range>
+      <direction>0 -0 -1.0</direction>
+      <castShadows>true</castShadows>
+    </light>
+  </model:renderable>
+
+
+  <!-- White Point light -->
+  <!--<model:renderable name="point_white2">
+    <xyz>0.0 0.0 2</xyz>
+    <rpy>30 0 0</rpy>
+    <static>true</static>
+    <light>
+      <type>spot</type>
+      <diffuseColor>0.8 0.8 0.8 1.0</diffuseColor>
       <specularColor>.1 .1 .1 1.0</specularColor>
-      <attenuation>1 1 1</attenuation>
-      <spotCone>25 65 1.0</spotCone>
-      <range>50</range>
-      <direction>0.0 -.5 -0.5</direction>
+      <attenuation>.1 0 0</attenuation>
+      <innerAngle>20</innerAngle>
+      <outerAngle>40</outerAngle>
+      <falloff>1.0</falloff>
+      <range>100</range>
+      <direction>0 0 -1</direction>
       <castShadows>true</castShadows>
     </light>
   </model:renderable>
-
+  -->
 </gazebo:world>


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