Revision: 8537
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8537&view=rev
Author:   natepak
Date:     2010-01-28 21:00:20 +0000 (Thu, 28 Jan 2010)

Log Message:
-----------
Fixed ShowJoints with per pixel rendering

Modified Paths:
--------------
    code/gazebo/trunk/server/rendering/OgreVisual.cc
    code/gazebo/trunk/server/rendering/OgreVisual.hh

Modified: code/gazebo/trunk/server/rendering/OgreVisual.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreVisual.cc    2010-01-28 18:55:36 UTC 
(rev 8536)
+++ code/gazebo/trunk/server/rendering/OgreVisual.cc    2010-01-28 21:00:20 UTC 
(rev 8537)
@@ -450,6 +450,7 @@
 
   try
   {
+    this->origMaterialName = materialName;
     // Get the original material
     this->origMaterial= Ogre::MaterialManager::getSingleton().getByName 
(materialName);;
   }
@@ -469,12 +470,12 @@
 
 
   // Create a custom material name
-  std::string myMaterialName = this->sceneNode->getName() + "_MATERIAL_" + 
materialName;
+  this->myMaterialName = this->sceneNode->getName() + "_MATERIAL_" + 
materialName;
 
   // Clone the material. This will allow us to change the look of each geom
   // individually.
-  if (Ogre::MaterialManager::getSingleton().resourceExists(myMaterialName))
-    this->myMaterial = 
(Ogre::MaterialPtr)(Ogre::MaterialManager::getSingleton().getByName(myMaterialName));
+  if 
(Ogre::MaterialManager::getSingleton().resourceExists(this->myMaterialName))
+    this->myMaterial = 
(Ogre::MaterialPtr)(Ogre::MaterialManager::getSingleton().getByName(this->myMaterialName));
   else
     this->myMaterial = this->origMaterial->clone(myMaterialName);
 
@@ -499,9 +500,9 @@
       Ogre::MovableObject *obj = this->sceneNode->getAttachedObject(i);
 
       if (dynamic_cast<Ogre::Entity*>(obj))
-        ((Ogre::Entity*)obj)->setMaterialName(myMaterialName);
+        ((Ogre::Entity*)obj)->setMaterialName(this->myMaterialName);
       else
-        ((Ogre::SimpleRenderable*)obj)->setMaterial(myMaterialName);
+        ((Ogre::SimpleRenderable*)obj)->setMaterial(this->myMaterialName);
     }
 
   }
@@ -541,7 +542,6 @@
 
   Ogre::Material::TechniqueIterator techniqueIt = 
this->myMaterial->getTechniqueIterator();
 
-
   while ( techniqueIt.hasMoreElements() )
   {
     t = techniqueIt.getNext ();
@@ -551,14 +551,13 @@
 
     while (passIt.hasMoreElements ())
     {
-      sc = this->origMaterial->getTechnique(i)->getPass(j)->getDiffuse();
+      sc = this->myMaterial->getTechnique(i)->getPass(j)->getDiffuse();
 
       if (this->transparency >0.0)
         passIt.peekNext ()->setDepthWriteEnabled (false);
       else
         passIt.peekNext ()->setDepthWriteEnabled (true);
 
-
       switch (this->sceneBlendType)
       {
         case Ogre::SBT_ADD:
@@ -572,8 +571,9 @@
         case Ogre::SBT_TRANSPARENT_ALPHA:
         default:
           dc = sc;
-          dc.a = sc.a * (1.0f - this->transparency);
-          
passIt.peekNext()->setAmbient(this->origMaterial->getTechnique(i)->getPass(j)->getAmbient());
+          //dc.a = sc.a * (1.0f - this->transparency);
+          dc.a =  (1.0f - this->transparency);
+          
passIt.peekNext()->setAmbient(this->myMaterial->getTechnique(i)->getPass(j)->getAmbient());
           break;
       }
       passIt.peekNext ()->setDiffuse (dc);

Modified: code/gazebo/trunk/server/rendering/OgreVisual.hh
===================================================================
--- code/gazebo/trunk/server/rendering/OgreVisual.hh    2010-01-28 18:55:36 UTC 
(rev 8536)
+++ code/gazebo/trunk/server/rendering/OgreVisual.hh    2010-01-28 21:00:20 UTC 
(rev 8537)
@@ -165,6 +165,8 @@
 
     private: Ogre::MaterialPtr origMaterial;
     private: Ogre::MaterialPtr myMaterial;
+    private: std::string myMaterialName;
+    private: std::string origMaterialName;
     private: Ogre::SceneBlendType sceneBlendType;
 
     private: Ogre::SceneNode *parentNode;


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

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to