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

Log Message:
-----------
Point lights no longer cast shadows

Modified Paths:
--------------
    code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_fp.glsl
    code/gazebo/branches/wx/Media/materials/scripts/shadow_receiver.material
    code/gazebo/branches/wx/server/rendering/Light.cc

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-21 20:52:53 UTC (rev 8916)
+++ code/gazebo/branches/wx/Media/materials/programs/shadow_receiver_fp.glsl    
2010-09-21 21:33:15 UTC (rev 8917)
@@ -9,6 +9,8 @@
 uniform vec4 light_attenuation;
 uniform vec4 spotlight_params;
 
+uniform float light_casts_shadows;
+
 uniform sampler2D shadowMap;
 uniform sampler2D diffuseMap;
 
@@ -56,6 +58,7 @@
 void main()
 {
   float spot = 1.0;
+  float shadowFactor = 1.0;
   float specular = 0.0;
 
   // Normalized fragment normal
@@ -108,9 +111,11 @@
 
   
//////////////////////////////////////////////////////////////////////////////
   // COMPUTE SHADOW CONTRIBUTION
-  float shadowAmount = ShadowPCF();
+  //shadowFactor = ShadowPCF();
+  if (light_casts_shadows)
+    shadowFactor = ShadowPCF();
 
   vec4 specularContrib = specular * derived_light_specular_color;
 
-  gl_FragColor = (diffuseContrib + specularContrib) * shadowAmount * spot;
+  gl_FragColor = (diffuseContrib+ specularContrib) * spot * shadowFactor;
 }

Modified: 
code/gazebo/branches/wx/Media/materials/scripts/shadow_receiver.material
===================================================================
--- code/gazebo/branches/wx/Media/materials/scripts/shadow_receiver.material    
2010-09-21 20:52:53 UTC (rev 8916)
+++ code/gazebo/branches/wx/Media/materials/scripts/shadow_receiver.material    
2010-09-21 21:33:15 UTC (rev 8917)
@@ -35,6 +35,7 @@
     param_named_auto light_attenuation light_attenuation 0
     param_named_auto spotlight_params spotlight_params 0
 
+    param_named_auto light_casts_shadows light_casts_shadows 0
     param_named shadowMap int 1
     param_named diffuseMap int 0
   }
@@ -72,7 +73,7 @@
 
       ambient  0 0 0
       diffuse  1 1 1
-      specular .5 .5 .5 128
+      specular 1 1 1 128
 
       vertex_program_ref receiver_vp_glsl
       {

Modified: code/gazebo/branches/wx/server/rendering/Light.cc
===================================================================
--- code/gazebo/branches/wx/server/rendering/Light.cc   2010-09-21 20:52:53 UTC 
(rev 8916)
+++ code/gazebo/branches/wx/server/rendering/Light.cc   2010-09-21 21:33:15 UTC 
(rev 8917)
@@ -396,10 +396,15 @@
 /// Set cast shadowsj
 void Light::SetCastShadows(const bool &cast)
 {
-  if (**this->castShadowsP != cast)
-    this->castShadowsP->SetValue( cast );
+  if (this->light->getType() == Ogre::Light::LT_POINT)
+    this->light->setCastShadows(false);
+  else
+  {
+    if (**this->castShadowsP != cast)
+      this->castShadowsP->SetValue( cast );
 
-  this->light->setCastShadows(cast);
+    this->light->setCastShadows(cast);
+  }
 }
 
 
////////////////////////////////////////////////////////////////////////////////


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