Revision: 8703
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8703&view=rev
Author:   natepak
Date:     2010-05-21 16:24:35 +0000 (Fri, 21 May 2010)

Log Message:
-----------
Rendering performance improvements

Modified Paths:
--------------
    code/gazebo/branches/tbb/server/Simulator.cc
    code/gazebo/branches/tbb/server/gui/Gui.cc
    code/gazebo/branches/tbb/server/rendering/OgreAdaptor.cc
    code/gazebo/branches/tbb/server/rendering/OgreAdaptor.hh
    code/gazebo/branches/tbb/server/rendering/OgreCamera.cc
    code/gazebo/branches/tbb/server/rendering/OgreCreator.cc
    code/gazebo/branches/tbb/server/rendering/OgreCreator.hh
    code/gazebo/branches/tbb/server/rendering/UserCamera.cc

Modified: code/gazebo/branches/tbb/server/Simulator.cc
===================================================================
--- code/gazebo/branches/tbb/server/Simulator.cc        2010-05-21 13:42:52 UTC 
(rev 8702)
+++ code/gazebo/branches/tbb/server/Simulator.cc        2010-05-21 16:24:35 UTC 
(rev 8703)
@@ -30,6 +30,8 @@
 #include <boost/bind.hpp>
 #include <boost/thread/recursive_mutex.hpp>
 
+#include "OgreCamera.hh"
+#include "CameraManager.hh"
 #include "Timer.hh"
 #include "Body.hh"
 #include "Geom.hh"
@@ -70,10 +72,10 @@
   </rendering:gui>\
   <rendering:ogre>\
     <ambient>1 1 1 1</ambient>\
-    <shadowTechnique>stencilModulative</shadowTechnique>\
+    <shadows>false</shadows>\
     <grid>false</grid>\
   </rendering:ogre>\
-   <model:physical name=\"plane1_model\">\
+  <model:physical name=\"plane1_model\">\
     <xyz>0 0 0</xyz>\
     <rpy>0 0 0</rpy>\
     <static>true</static>\
@@ -81,7 +83,7 @@
       <geom:plane name=\"plane1_geom\">\
         <normal>0 0 1</normal>\
         <size>100 100</size>\
-        <segments>10 10</segments>\
+        <segments>1 1</segments>\
         <uvTile>100 100</uvTile>\
         <material>Gazebo/GrayGrid</material>\
         <mu1>109999.0</mu1>\
@@ -454,6 +456,8 @@
   return this->gazeboConfig;
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// Get rendering engine
 OgreAdaptor *Simulator::GetRenderEngine() const
 {
   if (this->renderEngineEnabled)

Modified: code/gazebo/branches/tbb/server/gui/Gui.cc
===================================================================
--- code/gazebo/branches/tbb/server/gui/Gui.cc  2010-05-21 13:42:52 UTC (rev 
8702)
+++ code/gazebo/branches/tbb/server/gui/Gui.cc  2010-05-21 16:24:35 UTC (rev 
8703)
@@ -195,8 +195,6 @@
     this->timeSlider->value(1.0);
 
   Fl::check();
-
-  //Fl::wait(0.3);
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/gazebo/branches/tbb/server/rendering/OgreAdaptor.cc
===================================================================
--- code/gazebo/branches/tbb/server/rendering/OgreAdaptor.cc    2010-05-21 
13:42:52 UTC (rev 8702)
+++ code/gazebo/branches/tbb/server/rendering/OgreAdaptor.cc    2010-05-21 
16:24:35 UTC (rev 8703)
@@ -75,7 +75,6 @@
   Param::Begin(&this->parameters);
   this->ambientP = new ParamT<Vector4>("ambient",Vector4(.1,.1,.1,.1),0);
   this->shadowsP = new ParamT<bool>("shadows", true, 0);
-  this->drawGridP = new ParamT<bool>("grid", true, 0);
   this->skyMaterialP = new ParamT<std::string>("material","",1);
   this->backgroundColorP = new 
ParamT<Vector3>("backgroundColor",Vector3(0.5,0.5,0.5), 0);
 
@@ -96,7 +95,6 @@
   delete this->ambientP;
   delete this->shadowsP;
   delete this->backgroundColorP;
-  delete this->drawGridP;
   delete this->skyMaterialP;
 
 }
@@ -188,8 +186,8 @@
   else
   {
     this->sceneType= SCENE_EXT;
-    //this->sceneMgr = this->root->createSceneManager(Ogre::ST_EXTERIOR_FAR);
-    this->sceneMgr = this->root->createSceneManager(Ogre::ST_EXTERIOR_CLOSE);
+    this->sceneMgr = this->root->createSceneManager(Ogre::ST_EXTERIOR_FAR);
+    //this->sceneMgr = this->root->createSceneManager(Ogre::ST_EXTERIOR_CLOSE);
     //this->sceneMgr = this->root->createSceneManager(Ogre::ST_GENERIC);
   }
 
@@ -199,7 +197,6 @@
   this->ambientP->Load(node);
   this->shadowsP->Load(node);
   this->backgroundColorP->Load(node);
-  this->drawGridP->Load(node);
 
   ambient.r = (**(this->ambientP)).x;
   ambient.g = (**(this->ambientP)).y;
@@ -240,8 +237,6 @@
   if (node)
     OgreCreator::CreateFog(node->GetChild("fog"));
 
-  if (**(this->drawGridP))
-    OgreCreator::DrawGrid();
 
   // Set up the world geometry link
   if (this->sceneType==SCENE_BSP)
@@ -286,7 +281,6 @@
 {
   stream << prefix << "<rendering:ogre>\n";
   stream << prefix << "  " << *(this->ambientP) << "\n";
-  stream << prefix << "  " << *(this->drawGridP) << "\n";
 
   if ((**this->skyMaterialP).size())
   {
@@ -444,7 +438,6 @@
   ///           size of the first window created.
   ///   FBO seem to be the only good option
   renderSys->setConfigOption("RTT Preferred Mode", "FBO");
-
   renderSys->setConfigOption("FSAA", "2");
 
   /* Print out the list of options
@@ -471,7 +464,6 @@
   std::vector<OgreCamera*>::iterator iter;
 
   OgreCreator::Instance()->Update();
-
   this->root->_fireFrameStarted();
 
   // Draw all the non-user cameras
@@ -644,6 +636,3 @@
     this->PrintSceneGraphHelper( prefix, node->getChild(i) );
   }
 }
-
-
-

Modified: code/gazebo/branches/tbb/server/rendering/OgreAdaptor.hh
===================================================================
--- code/gazebo/branches/tbb/server/rendering/OgreAdaptor.hh    2010-05-21 
13:42:52 UTC (rev 8702)
+++ code/gazebo/branches/tbb/server/rendering/OgreAdaptor.hh    2010-05-21 
16:24:35 UTC (rev 8703)
@@ -176,6 +176,7 @@
 
     private: friend class DestroyerT<OgreAdaptor>;
     private: friend class SingletonT<OgreAdaptor>;
+
   };
   
  

Modified: code/gazebo/branches/tbb/server/rendering/OgreCamera.cc
===================================================================
--- code/gazebo/branches/tbb/server/rendering/OgreCamera.cc     2010-05-21 
13:42:52 UTC (rev 8702)
+++ code/gazebo/branches/tbb/server/rendering/OgreCamera.cc     2010-05-21 
16:24:35 UTC (rev 8703)
@@ -73,7 +73,7 @@
   this->userMovable = true;
 
   Param::Begin(&this->camParameters);
-  this->nearClipP = new ParamT<double>("nearClip",0.1,0);
+  this->nearClipP = new ParamT<double>("nearClip",0.01,0);
   this->farClipP = new ParamT<double>("farClip",50,0);
   this->saveFramesP = new ParamT<bool>("saveFrames",false,0);
   this->savePathnameP = new ParamT<std::string>("saveFramePath","",0);
@@ -230,7 +230,7 @@
   this->camera = OgreCreator::CreateCamera(this->cameraName, 
       **this->nearClipP, **this->farClipP, *(**this->hfovP), 
       this->renderTarget );
-
+ 
   // Create a scene node to control pitch motion
   this->pitchNode = this->sceneNode->createChildSceneNode( this->cameraName + 
"PitchNode");
   this->pitchNode->pitch(Ogre::Degree(0));
@@ -366,7 +366,6 @@
 
     this->lastUpdate = Simulator::Instance()->GetSimTime();
   }
-
 }
 
 
@@ -610,9 +609,7 @@
 /// Get the viewport up vector
 Vector3 OgreCamera::GetUp()
 {
-  //std::cout << "ogre cam position " <<  this->camera->getRealPosition() << 
std::endl;
   Ogre::Vector3 up = this->camera->getRealUp();
-  //std::cout << "ogre up " <<  up << std::endl;
   return Vector3(up.x,up.y,up.z);
 }
 
@@ -621,7 +618,6 @@
 Vector3 OgreCamera::GetRight()
 {
   Ogre::Vector3 right = this->camera->getRealRight();
-  //std::cout << "ogre right " <<  right << std::endl;
   return Vector3(right.x,right.y,right.z);
 }
 
@@ -1027,10 +1023,9 @@
 /// Set the direction of the camera
 void OgreCamera::SetDirection(Vector3 vec)
 {
-  /*this->pitchNode->setDirection(Ogre::Vector3(vec.x, vec.y, vec.z), 
Ogre::Node::TS_WORLD, Ogre::Vector3::NEGATIVE_UNIT_X);
+  this->pitchNode->setDirection(Ogre::Vector3(vec.x, vec.y, vec.z), 
Ogre::Node::TS_WORLD, Ogre::Vector3::NEGATIVE_UNIT_X);
   this->camera->setDirection(Ogre::Vector3(vec.x, vec.y, vec.z));
   Ogre::Quaternion q = this->camera->getOrientation();
-  */
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/gazebo/branches/tbb/server/rendering/OgreCreator.cc
===================================================================
--- code/gazebo/branches/tbb/server/rendering/OgreCreator.cc    2010-05-21 
13:42:52 UTC (rev 8702)
+++ code/gazebo/branches/tbb/server/rendering/OgreCreator.cc    2010-05-21 
16:24:35 UTC (rev 8703)
@@ -308,172 +308,6 @@
 
 
 
////////////////////////////////////////////////////////////////////////////////
-// Draw a grid on the ground
-void OgreCreator::DrawGrid()
-{
-  if (!Simulator::Instance()->GetRenderEngineEnabled())
-    return;
-
-  Ogre::ManualObject* gridObject =  
OgreAdaptor::Instance()->sceneMgr->createManualObject("__OGRE_GRID__");
-
-  gridObject->setCastShadows(false);
-
-  Ogre::SceneNode* gridObjectNode = 
OgreAdaptor::Instance()->sceneMgr->getRootSceneNode()->createChildSceneNode("__OGRE_GRID_NODE__");
-
-  Ogre::MaterialPtr gridObjectMaterialX = 
Ogre::MaterialManager::getSingleton().create("__OGRE_GRID_MATERIAL_X__","General");
-  gridObjectMaterialX->getTechnique(0)->setLightingEnabled(true);
-  gridObjectMaterialX->getTechnique(0)->getPass(0)->setDiffuse(0.2,0.2,0.2,1);
-  gridObjectMaterialX->getTechnique(0)->getPass(0)->setAmbient(0.2,0.2,0.2);
-  
//gridObjectMaterialX->getTechnique(0)->getPass(0)->setSelfIllumination(0.0,0.0,0.0);
-  gridObjectMaterialX->setReceiveShadows(false);
-
-  Ogre::MaterialPtr gridObjectMaterialY = 
Ogre::MaterialManager::getSingleton().create("__OGRE_GRID_MATERIAL_Y__","General");
-  gridObjectMaterialY->getTechnique(0)->setLightingEnabled(true);
-  gridObjectMaterialY->getTechnique(0)->getPass(0)->setDiffuse(0.2,0.2,0.2,1);
-  gridObjectMaterialY->getTechnique(0)->getPass(0)->setAmbient(0.2,0.2,0.2);
-  
//gridObjectMaterialY->getTechnique(0)->getPass(0)->setSelfIllumination(0.0,0.0,0.0);
-  gridObjectMaterialY->setReceiveShadows(false);
-
-
-  float d = 0.01;
-  int dim = 50;
-
-  // Vertex Values for a square box
-  float v[8][3] =
-  {
-    {-1, -1, -1}, {+1, -1, -1}, {+1, +1, -1}, {-1, +1, -1},
-    {-1, -1, +1}, {+1, -1, +1}, {+1, +1, +1}, {-1, +1, +1}
-  };
-
-  // Indices
-  int ind[36] =
-  {
-    // Bottom Face
-    0, 1, 2,
-    2, 3, 0,
-
-    // Top Face
-    4, 5, 7,
-    7, 5, 6,
-
-    // Front Face
-    0, 4, 7,
-    7, 3, 0,
-
-    // Back face
-    5, 1, 6,
-    6, 1, 2,
-
-    // Left face
-    0, 5, 4,
-    0, 1, 5,
-
-    // Right face
-    3, 7, 6,
-    6, 2, 3
-
-
-  };
-
-  gridObject->begin("__OGRE_GRID_MATERIAL_Y__", 
Ogre::RenderOperation::OT_TRIANGLE_LIST);
-
-  for (int y=-dim; y<dim; y++)
-  {
-    if (y%10 == 0)
-      d = 0.04;
-    else
-      d = 0.01;
-
-    // For each face
-    for (int i = 0; i < 36; i++)
-    {
-      gridObject->position(  v[ind[i]][0] * dim, 
-                           y+v[ind[i]][1] * 0.02, 
-                             v[ind[i]][2] * 0.01 );
-    }
-    char *name=new char[20];
-    char *text=new char[10];
-
-    sprintf(name,"(%d %d)_yaxis",0,y);
-    sprintf(text,"%d",y);
-
-    OgreMovableText* msg = new OgreMovableText();
-    try
-    {
-      msg->Load(name, text,"Arial",0.08);
-    }
-    catch (Ogre::Exception e)
-    {
-      std::ostringstream stream;
-      stream <<  "Unable to create the text. " << e.getDescription() 
<<std::endl;
-      gzthrow(stream.str() );
-    }
-    msg->SetTextAlignment(OgreMovableText::H_CENTER, OgreMovableText::V_ABOVE);
-
-    Ogre::SceneNode *textNode = 
OgreAdaptor::Instance()->sceneMgr->getRootSceneNode()->createChildSceneNode(std::string(name)+"_node");
-
-    textNode->attachObject(msg);
-    textNode->translate(0, y, 0.02);
-
-    delete [] name;
-    delete [] text;
-
-  }
-
-  gridObject->end();
-
-  gridObject->begin("__OGRE_GRID_MATERIAL_X__", 
Ogre::RenderOperation::OT_TRIANGLE_LIST);
-
-  for (int x=-dim; x<dim; x++)
-  {
-    if (x%10 == 0)
-      d = 0.04;
-    else
-      d = 0.01;
-
-    // For each face
-    for (int i = 0; i < 36; i++)
-    {
-      gridObject->position(x+v[ind[i]][0] * 0.02, 
-                             v[ind[i]][1] * dim, 
-                             v[ind[i]][2] * 0.01 );
-    }
-
-    char *name=new char[20];
-    char *text=new char[10];
-
-    sprintf(name,"(%d %d)_xaxis",x,0);
-    sprintf(text,"%d",x);
-
-    OgreMovableText* msg = new OgreMovableText();
-    try
-    {
-      msg->Load(name, text,"Arial",0.08);
-    }
-    catch (Ogre::Exception e)
-    {
-      std::ostringstream stream;
-      stream <<  "Unable to create the text. " << e.getDescription() 
<<std::endl;
-      gzthrow(stream.str() );
-    }
-    msg->SetTextAlignment(OgreMovableText::H_CENTER, OgreMovableText::V_ABOVE);
-
-    Ogre::SceneNode *textNode = 
OgreAdaptor::Instance()->sceneMgr->getRootSceneNode()->createChildSceneNode(std::string(name)+"_node");
-
-    textNode->attachObject(msg);
-    textNode->translate(x, 0, 0.02);
-
-    delete [] name;
-    delete [] text;
-  }
-
-  // etc
-  gridObject->end();
-  gridObjectNode->attachObject(gridObject);
-  
-}
-
-////////////////////////////////////////////////////////////////////////////////
 /// Draw a named line
 void OgreCreator::DrawLine(const Vector3 &start, const Vector3 &end, 
                            const std::string &name)
@@ -584,9 +418,6 @@
 
   params["parentWindowHandle"] = ogreHandle.str();
 
-  //params["vsync"] = "true";
-  params["FSAA"] = "2";
-
   std::ostringstream stream;
   stream << "OgreWindow(" << windowCounter++ << ")";
 
@@ -736,10 +567,9 @@
     (*titer)->Update();
 
   // Update the lines
-  for (iter = this->lines.begin(); iter != this->lines.end(); iter++)
-    (*iter)->Update();
+  //for (iter = this->lines.begin(); iter != this->lines.end(); iter++)
+    //(*iter)->Update();
 
-
   // We only need this loop because we are using threads. The physics engine
   // can't reliably set the pose of the visuals when it's running in a 
   // separate thread.

Modified: code/gazebo/branches/tbb/server/rendering/OgreCreator.hh
===================================================================
--- code/gazebo/branches/tbb/server/rendering/OgreCreator.hh    2010-05-21 
13:42:52 UTC (rev 8702)
+++ code/gazebo/branches/tbb/server/rendering/OgreCreator.hh    2010-05-21 
16:24:35 UTC (rev 8703)
@@ -116,9 +116,6 @@
     /// \brief Insert a mesh into Ogre 
     public: static void InsertMesh( const Mesh *mesh);
 
-    /// \brief Draw the uniform grid pattern
-    public: static void DrawGrid();
-
     /// \brief Draw a named line
     public: static void DrawLine(const Vector3 &start, const Vector3 &end, 
const std::string &name);
 

Modified: code/gazebo/branches/tbb/server/rendering/UserCamera.cc
===================================================================
--- code/gazebo/branches/tbb/server/rendering/UserCamera.cc     2010-05-21 
13:42:52 UTC (rev 8702)
+++ code/gazebo/branches/tbb/server/rendering/UserCamera.cc     2010-05-21 
16:24:35 UTC (rev 8703)
@@ -79,7 +79,7 @@
   OgreCamera::LoadCam(node);
 
   this->SetFOV( DTOR(60) );
-  this->SetClipDist(0.02, 50);
+  this->SetClipDist(.01, 40);
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -172,7 +172,6 @@
   this->viewport = this->window->addViewport(cam->GetOgreCamera());
 
   this->SetAspectRatio( Ogre::Real(this->viewport->getActualWidth()) / 
Ogre::Real(this->viewport->getActualHeight()) );
-
 }
 
 


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

------------------------------------------------------------------------------

_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to