Revision: 6475
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6475&view=rev
Author:   robotos
Date:     2008-06-05 04:01:41 -0700 (Thu, 05 Jun 2008)

Log Message:
-----------
Very experimental RenderEngine class. It doesn't look good and we haven't 
agreed on that. I may revert that change.
Other changes include moving the XML loading from OgreVisual (as that class is 
broader than just <visual>), moving 
GetUniqueName from Entity to OgreVisual, moving loading of the Gui to the Gui 
factory (I guess moving it to the Gui 
class would be better), all the CreateOgre methods have the same behaviour. 
My system is too unstable now to make extensive test on these changes, I upload 
it to try to work with other laptop.
I hope it does not brake anything. 

Modified Paths:
--------------
    code/gazebo/trunk/server/Entity.cc
    code/gazebo/trunk/server/Entity.hh
    code/gazebo/trunk/server/Model.cc
    code/gazebo/trunk/server/Simulator.cc
    code/gazebo/trunk/server/Simulator.hh
    code/gazebo/trunk/server/World.cc
    code/gazebo/trunk/server/gui/DummyGui.cc
    code/gazebo/trunk/server/gui/Gui.hh
    code/gazebo/trunk/server/gui/GuiFactory.cc
    code/gazebo/trunk/server/gui/GuiFactory.hh
    code/gazebo/trunk/server/gui/StatusBar.cc
    code/gazebo/trunk/server/physics/Geom.cc
    code/gazebo/trunk/server/physics/Geom.hh
    code/gazebo/trunk/server/physics/HeightmapGeom.cc
    code/gazebo/trunk/server/physics/PlaneGeom.cc
    code/gazebo/trunk/server/physics/TrimeshGeom.cc
    code/gazebo/trunk/server/rendering/OgreAdaptor.cc
    code/gazebo/trunk/server/rendering/OgreAdaptor.hh
    code/gazebo/trunk/server/rendering/OgreCreator.cc
    code/gazebo/trunk/server/rendering/OgreCreator.hh
    code/gazebo/trunk/server/rendering/OgreVisual.cc
    code/gazebo/trunk/server/rendering/OgreVisual.hh
    code/gazebo/trunk/server/rendering/SConscript

Added Paths:
-----------
    code/gazebo/trunk/server/rendering/RenderEngine.cc
    code/gazebo/trunk/server/rendering/RenderEngine.hh

Modified: code/gazebo/trunk/server/Entity.cc
===================================================================
--- code/gazebo/trunk/server/Entity.cc  2008-06-05 06:29:49 UTC (rev 6474)
+++ code/gazebo/trunk/server/Entity.cc  2008-06-05 11:01:41 UTC (rev 6475)
@@ -129,16 +129,6 @@
   return this->name;
 }
 
-////////////////////////////////////////////////////////////////////////////////
-// Return an unique name for the entity
-std::string Entity::GetUniqueName() const
-{
-  std::ostringstream str;
-  str << this->name;
-  str << "_";
-  str << this->id;
-  return str.str();
-}
 
 
////////////////////////////////////////////////////////////////////////////////
 // Set whether this entity is static: immovable

Modified: code/gazebo/trunk/server/Entity.hh
===================================================================
--- code/gazebo/trunk/server/Entity.hh  2008-06-05 06:29:49 UTC (rev 6474)
+++ code/gazebo/trunk/server/Entity.hh  2008-06-05 11:01:41 UTC (rev 6475)
@@ -93,10 +93,6 @@
   /// \return Name of the entity
   public: std::string GetName() const;
 
-  /// \brief Return an unique name <name>_<id> for the entity
-  /// \return Unique name for the entity
-  public: std::string GetUniqueName() const;
-
   /// \brief Set whether this entity is static: immovable
   /// \param s Bool, true = static
   public: void SetStatic(bool s);

Modified: code/gazebo/trunk/server/Model.cc
===================================================================
--- code/gazebo/trunk/server/Model.cc   2008-06-05 06:29:49 UTC (rev 6474)
+++ code/gazebo/trunk/server/Model.cc   2008-06-05 11:01:41 UTC (rev 6475)
@@ -384,8 +384,6 @@
   origPose = this->pose;
   this->pose = setPose;
 
-  //OgreAdaptor::Instance()->SetSceneNodePose(this->sceneNode, this->pose);
-
   for (iter=this->bodies.begin(); iter!=this->bodies.end(); iter++)
   {
     if (!iter->second)
@@ -668,7 +666,7 @@
 
   if ((childNode = node->GetChild("light")))
   {
-    OgreCreator::CreateLight(childNode, body);
+    OgreCreator::CreateLight(childNode, body->GetVisualNode());
   }
 
 }

Modified: code/gazebo/trunk/server/Simulator.cc
===================================================================
--- code/gazebo/trunk/server/Simulator.cc       2008-06-05 06:29:49 UTC (rev 
6474)
+++ code/gazebo/trunk/server/Simulator.cc       2008-06-05 11:01:41 UTC (rev 
6475)
@@ -39,7 +39,7 @@
 #include "gazebo.h"
 #include "PhysicsEngine.hh"
 #include "OgreAdaptor.hh"
-#include "OgreCreator.hh"
+#include "RenderEngine.hh"
 #include "GazeboMessage.hh"
 #include "Global.hh"
 
@@ -52,6 +52,7 @@
 Simulator::Simulator()
 : xmlFile(NULL),
   gui(NULL),
+  renderEngine(NULL),
   gazeboConfig(NULL),
   loaded(false),
   pause(false),
@@ -88,6 +89,8 @@
   GZ_DELETE (this->gazeboConfig)
   gazebo::World::Instance()->Close();
   gazebo::OgreAdaptor::Instance()->Close();
+
+  //GZ_DELETE(this->renderEngine);
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -127,29 +130,30 @@
     gzthrow("Error loading the Gazebo configuration file, check the .gazeborc 
file on your HOME directory \n" << e); 
   }
 
-    //Create and initialize the Gui
+  //Create and initialize the Gui
   try
   {
-    this->LoadGui(rootNode);
+    this->gui=GuiFactory::NewGui(rootNode);
+    this->gui->Init();
   }
   catch (GazeboError e)
   {
     gzthrow( "Error loading the GUI\n" << e);
   }
 
-    //Initialize RenderingEngine
+  //Initialize RenderEngine //create factory
+  //this->renderEngine = new OgreAdaptor();
   try
   {
-    gazebo::OgreAdaptor::Instance()->Init(rootNode);
+    OgreAdaptor::Instance()->Init(rootNode);
+    this->renderEngine = (RenderEngine *) OgreAdaptor::Instance();
+    //this->renderEngine->Init();
   }
   catch (gazebo::GazeboError e)
   {
-    gzthrow("Failed to Initialize the OGRE Rendering system\n" << e );
- }
+    gzthrow("Failed to Initialize the Rendering engine subsystem\n" << e );
+  }
 
-    //Preload basic shapes that can be used anywhere
-  OgreCreator::CreateBasicShapes();
-
     //Create the world
   try
   {
@@ -169,10 +173,10 @@
 {
   // Saving in the preferred order
   XMLConfigNode* root=xmlFile->GetRootNode();
-  gazebo::GazeboMessage::Instance()->Save(root);
+  GazeboMessage::Instance()->Save(root);
   World::Instance()->GetPhysicsEngine()->Save(root);
+  this->GetRenderEngine()->Save(root);
   this->SaveGui(root);
-  gazebo::OgreAdaptor::Instance()->Save(root);
   World::Instance()->Save(root);
 
   if (xmlFile->Save(filename)<0)
@@ -200,7 +204,7 @@
 {
   gazebo::World::Instance()->Fini();
 }
-
+/*
 
////////////////////////////////////////////////////////////////////////////////
 /// Main simulation loop, when this loop ends the simulation finish
 void Simulator::MainLoop()
@@ -242,7 +246,7 @@
     // Update the rendering
     if (currTime - this->prevRenderTime > 0.02)
     {
-      gazebo::OgreAdaptor::Instance()->Render(); 
+      this->GetRenderEngine()->Render(); 
       this->prevRenderTime = this->GetRealTime();
     }
 
@@ -258,13 +262,13 @@
     }
   }
 }
-
+*/
 
////////////////////////////////////////////////////////////////////////////////
 /// Main simulation loop, when this loop ends the simulation finish
-/*void Simulator::MainLoop()
+void Simulator::MainLoop()
 {
   double maxPhysicsUpdateTime = 
World::Instance()->GetPhysicsEngine()->GetUpdateRate();
-  double maxRenderUpdateTime = OgreAdaptor::Instance()->GetUpdateRate();
+  double maxRenderUpdateTime = this->GetRenderEngine()->GetUpdateRate();
   double step = World::Instance()->GetPhysicsEngine()->GetStepTime();
  
   if (maxPhysicsUpdateTime == 0)
@@ -303,11 +307,11 @@
       // surpassed what we have already advanced.
    // If maxPhysicsUpdateTime is negative, we update if we are below the times 
rendering was updated * the multiplier of the userPause
    // note that the multiplier defined in the file is inverted when read so 
for instance -2 will become -0.5
-    if ((maxPhysicsUpdateTime >= 0) && ((this->GetRealTime() - 
this->checkpoint) > (maxPhysicsUpdateTime * this->physicsUpdates)) || \
+    if (((maxPhysicsUpdateTime >= 0) && ((this->GetRealTime() - 
this->checkpoint) > (maxPhysicsUpdateTime * this->physicsUpdates))) || \
         ((maxPhysicsUpdateTime < 0) && (this->physicsUpdates < 
(-maxPhysicsUpdateTime * this->renderUpdates)))) 
     {
 
-      if (!this->GetUserPause() && !this->GetUserStep() ||
+      if ((!this->GetUserPause() && !this->GetUserStep()) ||
           (this->GetUserStep() && this->GetUserStepInc()))
       {
         this->simTime += step;
@@ -331,7 +335,7 @@
     if (((maxRenderUpdateTime >= 0) && ((this->GetRealTime() - 
this->checkpoint) > (maxRenderUpdateTime * this->renderUpdates))) || \
         ((maxRenderUpdateTime < 0) && (this->renderUpdates < 
(-maxRenderUpdateTime * this->physicsUpdates))))
     {
-      gazebo::OgreAdaptor::Instance()->Render(); 
+      this->GetRenderEngine()->Render(); 
       this->gui->Update();
       ++this->renderUpdates;
       updated=true;
@@ -351,7 +355,7 @@
       }
     }
   }
-}*/
+}
 
 
////////////////////////////////////////////////////////////////////////////////
 /// Gets our current GUI interface
@@ -367,6 +371,10 @@
   return this->gazeboConfig;
 }
 
+RenderEngine *Simulator::GetRenderEngine() const
+{
+  return this->renderEngine;
+}
 
 
////////////////////////////////////////////////////////////////////////////////
 // Return when this simulator is paused
@@ -479,45 +487,7 @@
 }
 
 
-
-
-//TODO: Move to Gui or create GuiEngine and move it there
-void Simulator::LoadGui(XMLConfigNode *rootNode)
-{
-  gazebo::XMLConfigNode *childNode;
-
-  childNode = rootNode->GetChild("gui");
-
-  if (childNode)
-  {
-    int width = childNode->GetTupleInt("size",0,640);
-    int height = childNode->GetTupleInt("size",1,480);
-    int x = childNode->GetTupleInt("pos",0,0);
-    int y = childNode->GetTupleInt("pos",1,0);
-    std::string type = childNode->GetString("type","fltk",1);
- 
-    gzmsg(1) << "Creating GUI:\n\tType[" << type << "] Pos[" << x << " " << y 
<< "] Size[" << width << " " << height << "]\n";
-    if (type != "fltk")
-    {
-      gzthrow("The only GUI available is 'fltk', for no-GUI simulation, delete 
the 'gui' tag and its children");
-    }
-
-    // Create the GUI
-    this->gui = GuiFactory::NewGui(type, x, y, width, height, type+"::Gazebo");
-
-    // Initialize the GUI
-    this->gui->Init();
-
-  }
-  else
-  {
-    // Create a dummy GUI
-    gzmsg(1) <<"Creating a dummy GUI";
-    this->gui = GuiFactory::NewGui(std::string("dummy"), 0, 0, 0, 0, 
std::string());
-  }
-}
-
-
+// Move to GuiFactory?
 void Simulator::SaveGui(XMLConfigNode *node)
 {
   Vector2<int> size;
@@ -532,3 +502,4 @@
   }
 
 }
+

Modified: code/gazebo/trunk/server/Simulator.hh
===================================================================
--- code/gazebo/trunk/server/Simulator.hh       2008-06-05 06:29:49 UTC (rev 
6474)
+++ code/gazebo/trunk/server/Simulator.hh       2008-06-05 11:01:41 UTC (rev 
6475)
@@ -43,6 +43,7 @@
   class XMLConfig;
   class XMLConfigNode;
   class GazeboConfig;
+  class RenderEngine;
 
 /// \brief The World
 /*
@@ -79,8 +80,11 @@
     public: Gui *GetUI() const;
 
     /// \brief Gets the local configuration for this computer
-    public: gazebo::GazeboConfig *GetGazeboConfig() const;
+    public: GazeboConfig *GetGazeboConfig() const;
 
+    /// \brief Gets our current GUI interface
+    public: RenderEngine *GetRenderEngine() const;
+
     /// \brief Returns the state of the simulation true if paused
     public: bool IsPaused() const;
 
@@ -141,13 +145,14 @@
 
   
     ///pointer to the XML Data
-    private: gazebo::XMLConfig *xmlFile;
+    private: XMLConfig *xmlFile;
 
     /// Pointer to the selected Gui 
     private: Gui *gui;
 
+    private: RenderEngine *renderEngine;
 /// Pointer to the selected Gui 
-    private: gazebo::GazeboConfig *gazeboConfig;
+    private: GazeboConfig *gazeboConfig;
 
     /// Flag to know if we have a simulation loaded
     private: bool loaded;

Modified: code/gazebo/trunk/server/World.cc
===================================================================
--- code/gazebo/trunk/server/World.cc   2008-06-05 06:29:49 UTC (rev 6474)
+++ code/gazebo/trunk/server/World.cc   2008-06-05 11:01:41 UTC (rev 6475)
@@ -48,9 +48,8 @@
 // Private constructor
 World::World()
 {
-  this->server=0;
-  this->simIface=0;
-
+  this->server = NULL;
+  this->simIface = NULL;
   this->showBoundingBoxes = false;
   this->showJoints = false;
   this->wireframe = false;

Modified: code/gazebo/trunk/server/gui/DummyGui.cc
===================================================================
--- code/gazebo/trunk/server/gui/DummyGui.cc    2008-06-05 06:29:49 UTC (rev 
6474)
+++ code/gazebo/trunk/server/gui/DummyGui.cc    2008-06-05 11:01:41 UTC (rev 
6475)
@@ -18,7 +18,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-/* Desc: FLTK Mainwindow
+/* Desc: Dummy Mainwindow
  * Author: Renaud Barate
  * Date: 16 Feb 2008
  */

Modified: code/gazebo/trunk/server/gui/Gui.hh
===================================================================
--- code/gazebo/trunk/server/gui/Gui.hh 2008-06-05 06:29:49 UTC (rev 6474)
+++ code/gazebo/trunk/server/gui/Gui.hh 2008-06-05 11:01:41 UTC (rev 6475)
@@ -48,10 +48,10 @@
     /// \brief Destructor
     public: virtual ~Gui() { }
   
-  /// \brief Initalize the gui
+    /// \brief Initalize the gui
     public: virtual void Init()=0;
  
-   /// \brief Updates the gui
+    /// \brief Updates the gui
     public: virtual void Update()=0;
 
     /// \brief Get the width of the gui's rendering window
@@ -71,6 +71,7 @@
 
     /// \brief Get the display
     public: virtual Display *GetDisplay() const=0;
+
   };
 
   class GLWindow;

Modified: code/gazebo/trunk/server/gui/GuiFactory.cc
===================================================================
--- code/gazebo/trunk/server/gui/GuiFactory.cc  2008-06-05 06:29:49 UTC (rev 
6474)
+++ code/gazebo/trunk/server/gui/GuiFactory.cc  2008-06-05 11:01:41 UTC (rev 
6475)
@@ -24,12 +24,12 @@
  * Date: 03 Aug 2007
  * SVN info: $Id$
  */
-#include <FL/Fl_Menu_Item.H>
-#include <FL/Fl_Menu_Bar.H>
 
 #include "GazeboError.hh"
+#include "GazeboMessage.hh"
 #include "Gui.hh"
 #include "GuiFactory.hh"
+#include "XMLConfig.hh"
 
 using namespace gazebo;
 
@@ -49,7 +49,7 @@
 
 
////////////////////////////////////////////////////////////////////////////////
 // Create a new instance of a gui.
-Gui *GuiFactory::NewGui(const std::string &classname, int x, int y, int w, int 
h, const std::string &label)
+Gui *GuiFactory::CreateGui(const std::string &classname, int x, int y, int w, 
int h, const std::string &label)
 {
   if (guis[classname])
   {
@@ -57,11 +57,45 @@
   }
   else
   {
-    std::ostringstream stream;
-    stream << "Unable to make a GUI of type " << classname;
-    gzthrow(stream.str());
+      gzthrow("Unable to make a GUI of type " << classname);
   }
 
   return NULL;
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// Parse the XML config file and load the correct GUI with correct parameters
+Gui* GuiFactory::NewGui(XMLConfigNode *rootNode)
+{
+  XMLConfigNode *childNode;
+  Gui *gui = NULL;
+  
+  childNode = rootNode->GetChild("gui");
+  
+  if (childNode)
+  {
+    int width = childNode->GetTupleInt("size",0,640);
+    int height = childNode->GetTupleInt("size",1,480);
+    int x = childNode->GetTupleInt("pos",0,0);
+    int y = childNode->GetTupleInt("pos",1,0);
+    std::string type = childNode->GetString("type","fltk",1);
+ 
+    gzmsg(1) << "Creating GUI:\n\tType[" << type << "] Pos[" << x << " " << y 
<< "] Size[" << width << " " << height << "]\n";
+    if (type != "fltk")
+    {
+      gzthrow("The only GUI available is 'fltk', for no-GUI simulation, delete 
the 'gui' tag and its children");
+    }
+
+    // Create the GUI
+    gui = GuiFactory::CreateGui(type, x, y, width, height, type+"::Gazebo");
+  }
+  else
+  {
+    // Create a dummy GUI
+    gzmsg(1) <<"Creating a dummy GUI";
+    gui = GuiFactory::CreateGui(std::string("dummy"), 0, 0, 0, 0, 
std::string());
+  }
+  return gui;
+ 
+}
+

Modified: code/gazebo/trunk/server/gui/GuiFactory.hh
===================================================================
--- code/gazebo/trunk/server/gui/GuiFactory.hh  2008-06-05 06:29:49 UTC (rev 
6474)
+++ code/gazebo/trunk/server/gui/GuiFactory.hh  2008-06-05 11:01:41 UTC (rev 
6475)
@@ -50,8 +50,11 @@
                 GuiFactoryFn factoryfn);
 
     /// \brief Create a new instance of a gui.  
-    public: static Gui *NewGui(const std::string &classname, int x, int y, int 
w, int h, const std::string &label);
+    public: static Gui *CreateGui(const std::string &classname, int x, int y, 
int w, int h, const std::string &label);
 
+    /// \brief Read from XML the correct gui configuration and create it
+    public: static Gui *NewGui(XMLConfigNode *rootNode);
+    
     /// \brief A list of registered  classes
     private: static std::map<std::string, GuiFactoryFn> guis;
   };

Modified: code/gazebo/trunk/server/gui/StatusBar.cc
===================================================================
--- code/gazebo/trunk/server/gui/StatusBar.cc   2008-06-05 06:29:49 UTC (rev 
6474)
+++ code/gazebo/trunk/server/gui/StatusBar.cc   2008-06-05 11:01:41 UTC (rev 
6475)
@@ -25,12 +25,11 @@
  */
 
 #include <stdio.h>
-#include <Ogre.h>
 #include <FL/Fl_Value_Output.H>
 #include <FL/Fl_Output.H>
 
 #include "Simulator.hh"
-#include "OgreAdaptor.hh"
+#include "RenderEngine.hh"
 #include "StatusBar.hh"
 
 using namespace gazebo;
@@ -75,9 +74,7 @@
 /// Update the toolbar data
 void StatusBar::Update()
 {
-  float lastFPS, avgFPS, bestFPS, worstFPS;
-  OgreAdaptor::Instance()->window->getStatistics(lastFPS, avgFPS, bestFPS, 
worstFPS);
-
+  float avgFPS = Simulator::Instance()->GetRenderEngine()->GetAverageFPS();
   this->iterations->value(Simulator::Instance()->GetIterations());
   this->fps->value(avgFPS);
 

Modified: code/gazebo/trunk/server/physics/Geom.cc
===================================================================
--- code/gazebo/trunk/server/physics/Geom.cc    2008-06-05 06:29:49 UTC (rev 
6474)
+++ code/gazebo/trunk/server/physics/Geom.cc    2008-06-05 11:01:41 UTC (rev 
6475)
@@ -27,6 +27,7 @@
 #include <sstream>
 
 #include "OgreVisual.hh"
+#include "OgreCreator.hh"
 #include "Global.hh"
 #include "GazeboMessage.hh"
 #include "ContactParams.hh"
@@ -123,7 +124,7 @@
   while (childNode)
   {
     OgreVisual *visual = new OgreVisual(this->visualNode);
-    visual->Load(childNode);
+    OgreCreator::CreateVisual(childNode,visual);
     this->visuals.push_back(visual);
     childNode = childNode->GetNext("visual");
   }
@@ -448,27 +449,6 @@
 }
 
 
////////////////////////////////////////////////////////////////////////////////
-/// Set the transparency
-void Geom::SetTransparency( float trans )
-{
-  std::vector<OgreVisual*>::iterator iter;
-
-  for (iter = this->visuals.begin(); iter != this->visuals.end(); iter++)
-  {
-    (*iter)->SetTransparency(trans);
-  }
-
-  this->transparency = trans;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-///  Get the value of the transparency
-float Geom::GetTransparency() const
-{
-  return this->transparency;
-}
-
-////////////////////////////////////////////////////////////////////////////////
 /// Set the visibility of the Bounding box of this geometry
 void Geom::ShowBoundingBox(bool show)
 {
@@ -482,9 +462,9 @@
 void Geom::ShowJoints(bool show)
 {
   if (show)
-    this->SetTransparency(0.6);
+    this->visualNode->SetTransparency(0.6);
   else
-    this->SetTransparency(0);
+    this->visualNode->SetTransparency(0);
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/gazebo/trunk/server/physics/Geom.hh
===================================================================
--- code/gazebo/trunk/server/physics/Geom.hh    2008-06-05 06:29:49 UTC (rev 
6474)
+++ code/gazebo/trunk/server/physics/Geom.hh    2008-06-05 11:01:41 UTC (rev 
6475)
@@ -126,17 +126,11 @@
   
     /// \brief Get the laser retro reflectiveness 
     public: float GetLaserRetro() const;
-
-    /// \brief Set the transparency
-    public: void SetTransparency( float trans );
-
-    /// \brief Get the value of the transparency
-    public: float GetTransparency() const;
-  
-/// \brief Set the visibility of the bounding box
+ 
+    /// \brief Set the visibility of the bounding box
     public: void ShowBoundingBox(bool show);
 
-/// \brief Set the visibility of the joints
+    /// \brief Set the visibility of the joints
     public: void ShowJoints(bool show);
 
    /// \brief Set the visibility of the physical entity of this geom

Modified: code/gazebo/trunk/server/physics/HeightmapGeom.cc
===================================================================
--- code/gazebo/trunk/server/physics/HeightmapGeom.cc   2008-06-05 06:29:49 UTC 
(rev 6474)
+++ code/gazebo/trunk/server/physics/HeightmapGeom.cc   2008-06-05 11:01:41 UTC 
(rev 6475)
@@ -32,6 +32,8 @@
 
 #include "GazeboError.hh"
 #include "OgreAdaptor.hh"
+#include "Simulator.hh"
+#include "RenderEngine.hh"
 #include "Global.hh"
 #include "Body.hh"
 #include "HeightmapGeom.hh"
@@ -50,7 +52,8 @@
 // Destructor
 HeightmapGeom::~HeightmapGeom()
 {
-  OgreAdaptor::Instance()->sceneMgr->destroyQuery(this->rayQuery);
+  OgreAdaptor *ogreAdaptor = (OgreAdaptor *) 
Simulator::Instance()->GetRenderEngine();
+  ogreAdaptor->sceneMgr->destroyQuery(this->rayQuery);
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -128,7 +131,15 @@
 {
   Ogre::Image tmpImage;
   int tileSize;
+  OgreAdaptor *ogreAdaptor;
 
+  if (Simulator::Instance()->GetRenderEngine()->GetType() != "ogre")
+  {
+    gzthrow("Heighmaps are only supported by the Ogre renderer");
+  }
+  else
+    ogreAdaptor = (OgreAdaptor  *)(Simulator::Instance()->GetRenderEngine());
+
   std::string imageFilename = node->GetString("image","",1);
   std::string worldTexture = node->GetString("worldTexture","",0);
   std::string detailTexture = node->GetString("detailTexture","",0);
@@ -143,7 +154,7 @@
   // Width and height must be the same
   if (tmpImage.getWidth() != tmpImage.getHeight())
   {
-    gzthrow("Hieghtmap image must be square\n");
+    gzthrow("Heightmap image must be square\n");
   }
 
   this->terrainVertSize = tmpImage.getWidth();
@@ -216,17 +227,17 @@
     new Ogre::MemoryDataStream(mstr,strlen(mstr)) );
 
   // Set the static terrain in Ogre
-  OgreAdaptor::Instance()->sceneMgr->setWorldGeometry(dataStream);
+  ogreAdaptor->sceneMgr->setWorldGeometry(dataStream);
 
   // HACK to make the terrain oriented properly
-  Ogre::SceneNode *tnode = 
OgreAdaptor::Instance()->sceneMgr->getSceneNode("Terrain");
+  Ogre::SceneNode *tnode = ogreAdaptor->sceneMgr->getSceneNode("Terrain");
   tnode->pitch(Ogre::Degree(90));
   tnode->translate(Ogre::Vector3(-this->terrainSize.x*0.5, 
this->terrainSize.y*0.5, 0));
 
   // Setup the ray scene query, which is used to determine the heights of
   // the vertices for ODE
   this->ray = Ogre::Ray(Ogre::Vector3::ZERO, Ogre::Vector3::NEGATIVE_UNIT_Y);
-  this->rayQuery = 
OgreAdaptor::Instance()->sceneMgr->createRayQuery(this->ray);
+  this->rayQuery = ogreAdaptor->sceneMgr->createRayQuery(this->ray);
   
this->rayQuery->setQueryTypeMask(Ogre::SceneManager::WORLD_GEOMETRY_TYPE_MASK);
   
this->rayQuery->setWorldFragmentType(Ogre::SceneQuery::WFT_SINGLE_INTERSECTION);
 

Modified: code/gazebo/trunk/server/physics/PlaneGeom.cc
===================================================================
--- code/gazebo/trunk/server/physics/PlaneGeom.cc       2008-06-05 06:29:49 UTC 
(rev 6474)
+++ code/gazebo/trunk/server/physics/PlaneGeom.cc       2008-06-05 11:01:41 UTC 
(rev 6475)
@@ -69,7 +69,7 @@
   double altitude = 0;
   Vector3 normal = node->GetVector3("normal",Vector3(0,0,1));
 
-  OgreCreator::CreatePlane(node,this);
+  OgreCreator::CreatePlane(node,this->GetVisualNode());
 
   this->SetGeom(dCreatePlane(this->spaceId, normal.x, normal.y, normal.z, 
altitude),false);
 

Modified: code/gazebo/trunk/server/physics/TrimeshGeom.cc
===================================================================
--- code/gazebo/trunk/server/physics/TrimeshGeom.cc     2008-06-05 06:29:49 UTC 
(rev 6474)
+++ code/gazebo/trunk/server/physics/TrimeshGeom.cc     2008-06-05 11:01:41 UTC 
(rev 6475)
@@ -31,6 +31,8 @@
 #include "Body.hh"
 #include "TrimeshGeom.hh"
 #include "GazeboError.hh"
+#include "Simulator.hh"
+#include "RenderEngine.hh"
 
 using namespace gazebo;
 
@@ -107,6 +109,10 @@
   int vindex = 0;
   int iindex = 0;
 
+  if (Simulator::Instance()->GetRenderEngine()->GetType() != "ogre")
+  {
+    gzthrow("Heighmaps are only supported by the Ogre renderer");
+  }
 
   this->meshName = node->GetString("mesh","",1);
 

Modified: code/gazebo/trunk/server/rendering/OgreAdaptor.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreAdaptor.cc   2008-06-05 06:29:49 UTC 
(rev 6474)
+++ code/gazebo/trunk/server/rendering/OgreAdaptor.cc   2008-06-05 11:01:41 UTC 
(rev 6475)
@@ -68,7 +68,7 @@
   this->camera=NULL;
   this->viewport=NULL;
   this->root=NULL;
-  this->renderSys = NULL;
+  this->type = "ogre";
 
 }
 
@@ -249,6 +249,10 @@
     }
   }
 
+  //Preload basic shapes that can be used anywhere
+  OgreCreator::LoadBasicShapes();
+
+
   /*
     Ogre::ManualObject* myManualObject =  
this->sceneMgr->createManualObject("manual1");
     Ogre::SceneNode* myManualObjectNode = 
this->sceneMgr->getRootSceneNode()->createChildSceneNode("manual1_node");
@@ -406,40 +410,43 @@
 // Setup render system
 void OgreAdaptor::SetupRenderSystem(bool create)
 {
+
+  Ogre::RenderSystem *renderSys;
+
   // Set parameters of render system (window size, etc.)
   //if (!this->root->restoreConfig())
   {
     Ogre::RenderSystemList *rsList = this->root->getAvailableRenderers();
     int c = 0;
 
-    this->renderSys = NULL;
+    renderSys = NULL;
 
     do
     {
       if (c == (int)rsList->size())
         break;
 
-      this->renderSys = rsList->at(c);
+      renderSys = rsList->at(c);
       c++;
     }
-    while (this->renderSys->getName().compare("OpenGL Rendering Subsystem")!= 
0);
+    while (renderSys->getName().compare("OpenGL Rendering Subsystem")!= 0);
 
-    if (this->renderSys == NULL)
+    if (renderSys == NULL)
     {
       gzthrow( "unable to find rendering system" );
     }
 
 
-    this->renderSys->setConfigOption("Full Screen","No");
-    this->renderSys->setConfigOption("FSAA","2");
+    renderSys->setConfigOption("Full Screen","No");
+    renderSys->setConfigOption("FSAA","2");
 
     // Set the preferred RRT mode. Options are: "PBuffer", "FBO", and "Copy", 
can be set in the .gazeborc file
-    this->renderSys->setConfigOption("RTT Preferred Mode", 
Simulator::Instance()->GetGazeboConfig()->GetRTTMode());
+    renderSys->setConfigOption("RTT Preferred Mode", 
Simulator::Instance()->GetGazeboConfig()->GetRTTMode());
 
     if (create && this->videoMode != "None")
     {
-      this->renderSys->setConfigOption("Video Mode",this->videoMode);
-      this->root->setRenderSystem(this->renderSys);
+      renderSys->setConfigOption("Video Mode",this->videoMode);
+      this->root->setRenderSystem(renderSys);
     }
     else
     {
@@ -487,17 +494,18 @@
 
 
////////////////////////////////////////////////////////////////////////////////
 // Render
-int OgreAdaptor::Render()
+void OgreAdaptor::Render()
 {
   OgreHUD::Instance()->Update();
-
   this->root->renderOneFrame();
-
-  return 0;
 }
 
-double OgreAdaptor::GetUpdateRate() const
+float OgreAdaptor::GetAverageFPS() const
 {
-  return this->updateRate;
+  float lastFPS, avgFPS, bestFPS, worstFPS;
+//  float avgFPS;
+  this->window->getStatistics(lastFPS, avgFPS, bestFPS, worstFPS);
+  return avgFPS;
+
 }
 

Modified: code/gazebo/trunk/server/rendering/OgreAdaptor.hh
===================================================================
--- code/gazebo/trunk/server/rendering/OgreAdaptor.hh   2008-06-05 06:29:49 UTC 
(rev 6474)
+++ code/gazebo/trunk/server/rendering/OgreAdaptor.hh   2008-06-05 11:01:41 UTC 
(rev 6475)
@@ -31,7 +31,7 @@
 #include <X11/Xutil.h>
 
 #include "SingletonT.hh"
-#include "Pose3d.hh"
+#include "RenderEngine.hh"
 
 namespace Ogre
 {
@@ -64,7 +64,7 @@
 class Entity;
 
 /// \brief Adptor to Ogre3d
-class OgreAdaptor : public SingletonT<OgreAdaptor>
+class OgreAdaptor : RenderEngine, public SingletonT<OgreAdaptor>
 {
 
   /// \brief Constructor
@@ -86,14 +86,13 @@
   /// \brief Initialize Ogre Rendering engine
   public: void Init(Display *display, XVisualInfo *visual, Window windowId, 
int width, int height); 
   /// \brief Render a single frame
-  public: int Render();
+  public: void Render();
 
-  /// \brief Gets the minimum time between renders, set by in the file to 
limit Framerate
-  public: double GetUpdateRate() const;
- 
   /// \brief Resize the rendering window
   public: void ResizeWindow(unsigned int w, unsigned int h);
 
+  public: float GetAverageFPS() const;
+
   private: void LoadPlugins();
   private: void SetupResources();
   private: void SetupRenderSystem(bool create);
@@ -120,8 +119,6 @@
   /// Pointer to the input reader
   public: Ogre::InputReader *inputDevice;
 
-  private: double updateRate;
-
   private: Ogre::LogManager *logManager;
 
   // Our custom frame listener
@@ -137,9 +134,9 @@
   private: int sceneType;
   private: std::string worldGeometry;
 
-  private: Vector3 terrainSize;
-  private: unsigned int terrainVertSize;
-  private: std::string terrainImage;
+  //private: Vector3 terrainSize;
+  //private: unsigned int terrainVertSize;
+  //private: std::string terrainImage;
   
   private: friend class DestroyerT<OgreAdaptor>;
   private: friend class SingletonT<OgreAdaptor>;

Modified: code/gazebo/trunk/server/rendering/OgreCreator.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreCreator.cc   2008-06-05 06:29:49 UTC 
(rev 6474)
+++ code/gazebo/trunk/server/rendering/OgreCreator.cc   2008-06-05 11:01:41 UTC 
(rev 6475)
@@ -27,6 +27,7 @@
 #include <Ogre.h>
 #include <iostream>
 
+#include "Global.hh"
 #include "Entity.hh"
 #include "XMLConfig.hh"
 #include "GazeboError.hh"
@@ -37,9 +38,10 @@
 #include "OgreSimpleShape.hh"
 #include "OgreCreator.hh"
 
-
 using namespace gazebo;
 
+unsigned int OgreCreator::lightCounter = 0;
+
 
////////////////////////////////////////////////////////////////////////////////
 // Constructor
 OgreCreator::OgreCreator()
@@ -54,7 +56,7 @@
 
 
////////////////////////////////////////////////////////////////////////////////
 // Create the basic shapes
-void OgreCreator::CreateBasicShapes()
+void OgreCreator::LoadBasicShapes()
 {
   // Create some basic shapes
   OgreSimpleShape::CreateSphere("unit_sphere",1.0, 32, 32);
@@ -65,7 +67,7 @@
 
 
////////////////////////////////////////////////////////////////////////////////
 // Create a plane
-OgreVisual *OgreCreator::CreatePlane(XMLConfigNode *node, Entity *parent)
+void OgreCreator::CreatePlane(XMLConfigNode *node, OgreVisual *parent)
 {
   Vector3 normal = node->GetVector3("normal",Vector3(0,1,0));
   Vector2<double> size = node->GetVector2d("size",Vector2<double>(1000, 1000));
@@ -78,35 +80,113 @@
   Vector3 perp = normal.GetPerpendicular();
 
   Ogre::Plane plane(Ogre::Vector3(normal.x, normal.y, normal.z), 0);
-
-  Ogre::MeshManager::getSingleton().createPlane(parent->GetUniqueName(),
+//FIXME: only one plane per parent
+//TODO:names and parents
+  Ogre::MeshManager::getSingleton().createPlane(parent->GetName() + "_PLANE",
       Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
       size.x, size.y,
       (int)segments.x, (int)segments.y,
       true,1,
       uvTile.x, uvTile.y,
       Ogre::Vector3(perp.x, perp.y, perp.z));
+  
+  //OgreVisual *visual = new OgreVisual(parent);
+  parent->AttachMesh(parent->GetName() + "_PLANE");
+  parent->SetMaterial(material);
+  parent->SetCastShadows(node->GetBool("castShadows",true,0));
 
-  OgreVisual *visual = new OgreVisual(parent->GetVisualNode());
-  visual->AttachMesh(parent->GetUniqueName());
-  visual->SetMaterial(material);
-  visual->SetCastShadows(node->GetBool("castShadows",true,0));
-
-  return visual;
+  //return visual;
 }
 
+void OgreCreator::CreateVisual(XMLConfigNode *node, OgreVisual *parent)
+{
+  std::ostringstream stream;
+  Pose3d pose;
+  Vector3 size;
+  Ogre::Vector3 meshSize;
+  Ogre::MovableObject *obj = NULL;
 
+  std::string meshName = node->GetString("mesh","",1);
 
+  // Read the desired position and rotation of the mesh
+  pose.pos = node->GetVector3("xyz", Vector3(0,0,0));
+  pose.rot = node->GetRotation("rpy", Quatern());
+
+  try
+  {
+    // Create the entity
+    stream << parent->GetName() << "_ENTITY";
+    obj = 
(Ogre::MovableObject*)parent->GetSceneNode()->getCreator()->createEntity(stream.str(),
 meshName);
+  }
+  catch (Ogre::Exception e)
+  {
+    std::cerr << "Ogre Error:" << e.getFullDescription() << "\n";
+    gzthrow("Unable to create a mesh from " + meshName);
+  }
+
+  // Set the pose of the scene node
+  parent->SetPose(pose);
+
+  // Attach the entity to the node
+  if (obj)
+  {
+    parent->AttachObject(obj);
+    obj->setVisibilityFlags(GZ_ALL_CAMERA);
+    meshSize = obj->getBoundingBox().getSize();
+  }
+  
+  // Get the desired size of the mesh
+  if (node->GetChild("size") != NULL)
+    size = node->GetVector3("size",Vector3(1,1,1));
+  else
+    size = Vector3(meshSize.x, meshSize.y, meshSize.z);
+
+  // Get and set teh desired scale of the mesh
+  if (node->GetChild("scale") != NULL)
+  {
+    Vector3 scale = node->GetVector3("scale",Vector3(1,1,1));
+    parent->SetScale(scale);
+  }
+  else
+  {
+    parent->SetScale(Vector3(size.x/meshSize.x, size.y/meshSize.y, 
size.z/meshSize.z));
+  }
+
+
+  // Set the material of the mesh
+  parent->SetMaterial(node->GetString("material",std::string(),1));
+
+  // Allow the mesh to cast shadows
+  parent->SetCastShadows(node->GetBool("castShadows",true,0));
+
+  parent->SetXML(node);
+}
+
+  
 
////////////////////////////////////////////////////////////////////////////////
-/// Create a light source and attach it to the entity
-void OgreCreator::CreateLight(XMLConfigNode *node, Entity *entity)
+/// Create a light source and attach it to the visual node
+/// Note that the properties here are not modified afterwards and thus, 
+/// we don't need a Light class. 
+void OgreCreator::CreateLight(XMLConfigNode *node, OgreVisual *parent)
 {
   Vector3 vec;
   double range,constant,linear,quad;
+  Ogre::Light *light;
 
   // Create the light
-  Ogre::Light 
*light(OgreAdaptor::Instance()->sceneMgr->createLight(entity->GetUniqueName()));
-
+  std::ostringstream stream;
+  stream << parent->GetName() << "_LIGHT" << lightCounter;
+  lightCounter++;
+  try
+  {
+    light = OgreAdaptor::Instance()->sceneMgr->createLight(stream.str());
+  } 
+  catch (Ogre::Exception e)
+  {
+    gzthrow("Ogre Error:" << e.getFullDescription() << "\n" << \
+             "Unable to create a light on " + parent->GetName());
+  }
+  
   // Set the light type
   std::string lightType = node->GetString("type","point",0);
   if (lightType == "point")
@@ -157,7 +237,7 @@
     light->setSpotlightRange(Ogre::Radian(Ogre::Degree(vec.x)), 
Ogre::Radian(Ogre::Degree(vec.y)), vec.z);
   }
 
-  entity->GetVisualNode()->AttachObject(light);
+  parent->AttachObject(light);
 }
 
 

Modified: code/gazebo/trunk/server/rendering/OgreCreator.hh
===================================================================
--- code/gazebo/trunk/server/rendering/OgreCreator.hh   2008-06-05 06:29:49 UTC 
(rev 6474)
+++ code/gazebo/trunk/server/rendering/OgreCreator.hh   2008-06-05 11:01:41 UTC 
(rev 6475)
@@ -55,15 +55,20 @@
     /// \brief Destructor
     public: virtual ~OgreCreator();
 
-    /// \brief Create some simple general shapes
-    public: static void CreateBasicShapes();
+    /// \brief Load some simple shapes on the render engine
+      public: static void LoadBasicShapes();
 
-    ///\brief Helper function to create a Plane
-    public: static OgreVisual *CreatePlane(XMLConfigNode *node, Entity 
*parent);
+    ///\brief Create a Plane
+    ///It adds itself to the Visual node parent, it will those change parent
+    ///properties if needed, to avoid this create a child visual node for the 
plane
+    public: static void CreatePlane(XMLConfigNode *node, OgreVisual *parent);
+    
+    ///\brief Create a visual entity
+    public: static void CreateVisual(XMLConfigNode *node, OgreVisual *parent);
+        
+    /// \brief Create a light source 
+    public: static void CreateLight(XMLConfigNode *node, OgreVisual *parent);
 
-    /// \brief Create a light source and attach it to the entity
-    public: static void CreateLight(XMLConfigNode *node, Entity *entity);
-
     /// \brief Helper function to create a camera
     public: static Ogre::Camera *CreateCamera(const std::string &name, double 
nearClip, double farClip, double hfov, Ogre::RenderTarget *renderTarget);
 
@@ -77,6 +82,7 @@
     public: static void CreateSky(XMLConfigNode *node);
     
     public: static void DrawGrid();
+    private: static unsigned int lightCounter;
 
 
 /// \}

Modified: code/gazebo/trunk/server/rendering/OgreVisual.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreVisual.cc    2008-06-05 06:29:49 UTC 
(rev 6474)
+++ code/gazebo/trunk/server/rendering/OgreVisual.cc    2008-06-05 11:01:41 UTC 
(rev 6475)
@@ -47,7 +47,9 @@
   this->sceneBlendType = Ogre::SBT_TRANSPARENT_ALPHA;
 
   // Create a unique name for the scene node
+  //FIXME: what if we add the capability to delete and add new children?
   stream << this->parentNode->getName() << "_VISUAL_" << 
this->parentNode->numChildren();
+  
 
   // Create the scene node
   this->sceneNode = this->parentNode->createChildSceneNode( stream.str() );
@@ -67,7 +69,17 @@
 }
 
 
////////////////////////////////////////////////////////////////////////////////
+// Sets the XML we will save the data to
+void OgreVisual::SetXML(XMLConfigNode *node)
+{
+  this->xmlNode=node;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////
 // Load the visual
+/*
 void OgreVisual::Load(XMLConfigNode *node)
 {
   std::ostringstream stream;
@@ -133,6 +145,7 @@
   // Allow the mesh to cast shadows
   this->SetCastShadows(node->GetBool("castShadows",true,0));
 }
+*/
 
 void OgreVisual::Save()
 {
@@ -141,7 +154,16 @@
   //TODO: A lot of information!
 }
 
+
 
////////////////////////////////////////////////////////////////////////////////
+// Return an unique name for the Visual
+std::string OgreVisual::GetName() const
+{
+  return this->sceneNode->getName();
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
 /// Attach a renerable object to the visual
 void OgreVisual::AttachObject( Ogre::MovableObject *obj)
 {
@@ -163,7 +185,7 @@
 
 
////////////////////////////////////////////////////////////////////////////////
 ///  Set the scale
-void OgreVisual::SetScale( Vector3 scale )
+void OgreVisual::SetScale(const Vector3 &scale )
 {
   Ogre::Vector3 vscale;
   vscale.x=scale.x;

Modified: code/gazebo/trunk/server/rendering/OgreVisual.hh
===================================================================
--- code/gazebo/trunk/server/rendering/OgreVisual.hh    2008-06-05 06:29:49 UTC 
(rev 6474)
+++ code/gazebo/trunk/server/rendering/OgreVisual.hh    2008-06-05 11:01:41 UTC 
(rev 6475)
@@ -28,6 +28,7 @@
 #define OGREVISUAL_HH
 
 #include <Ogre.h>
+#include <string>
 
 #include "Pose3d.hh"
 #include "Quatern.hh"
@@ -53,14 +54,18 @@
     /// \brief Attach a mesh to this visual by name
     public: void AttachMesh( const std::string &meshName );
 
-    /// \brief Load the visual
-    public: void Load(XMLConfigNode *node);
+    /// \brief Set the node we will save to.
+    public: void SetXML(XMLConfigNode *node);
 
     /// \brief Save the visual
     public: void Save();
+    
+    /// \brief Return an unique name for this object
+    /// \return Unique name for the object
+    public: std::string GetName() const;
 
     /// \brief Set the scale
-    public: void SetScale( Vector3 scale );
+    public: void SetScale( const Vector3 &scale );
 
     /// \brief Get the scale
     public: Vector3 GetScale();

Added: code/gazebo/trunk/server/rendering/RenderEngine.cc
===================================================================
--- code/gazebo/trunk/server/rendering/RenderEngine.cc                          
(rev 0)
+++ code/gazebo/trunk/server/rendering/RenderEngine.cc  2008-06-05 11:01:41 UTC 
(rev 6475)
@@ -0,0 +1,51 @@
+/*
+ *  Gazebo - Outdoor Multi-Robot Simulator
+ *  Copyright (C) 2003
+ *     Nate Koenig & Andrew Howard
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+/* Desc: Middleman between Rendering engine and Gazebo
+ * Author: Nate Koenig, Jordi Polo
+ * Date: 02 Jun 2008
+ */
+
+#include "RenderEngine.hh"
+
+using namespace gazebo;
+
+////////////////////////////////////////////////////////////////////////////////
+/// Constructor
+RenderEngine::RenderEngine()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// Destructor
+RenderEngine::~RenderEngine()
+{
+}
+
+double RenderEngine::GetUpdateRate() const
+{
+  return this->updateRate;
+}
+
+std::string RenderEngine::GetType() const
+{
+  return this->type;
+}
+

Added: code/gazebo/trunk/server/rendering/RenderEngine.hh
===================================================================
--- code/gazebo/trunk/server/rendering/RenderEngine.hh                          
(rev 0)
+++ code/gazebo/trunk/server/rendering/RenderEngine.hh  2008-06-05 11:01:41 UTC 
(rev 6475)
@@ -0,0 +1,81 @@
+/*
+ *  Gazebo - Outdoor Multi-Robot Simulator
+ *  Copyright (C) 2003  
+ *     Nate Koenig & Andrew Howard
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+/* Desc: Middleman between actual rendering engine and Gazebo
+ * Author: Nate Koenig, Jordi Polo
+ * Date: 02 Jun 2008
+ */
+
+#ifndef RENDERENGINE 
+#define RENDERENGINE
+
+#include <string>
+
+namespace gazebo
+{
+/// \addtogroup gazebo_rendering
+/// \{
+
+
+class XMLConfigNode;
+
+/// \brief Rendering engine for the simulation
+class RenderEngine 
+{
+
+  /// \brief Constructor
+  public: RenderEngine();
+
+  /// \brief Destructor
+  public: virtual ~RenderEngine();
+
+  /// \brief Closes the present rendering engine, frees the resources 
+  public: virtual void Close() = 0;
+
+  /// \brief Default initialization. 
+  ///  Let the rendering engine  create the window and rendering context
+  public: virtual void Init(XMLConfigNode *rootNode) = 0;
+
+  /// \brief Save rendering engine settings 
+  public: virtual void Save(XMLConfigNode *node) = 0;
+
+  /// \brief Render a single frame
+  public: virtual void Render() = 0;
+ 
+  /// \brief Resize the rendering window
+  public: virtual void ResizeWindow(unsigned int w, unsigned int h) = 0;
+
+  /// \brief Gets the average frame per second rate achieved
+  public: virtual float GetAverageFPS() const = 0;
+
+  /// \brief Gets the minimum time between renders, set by in the file to 
limit Framerate
+  public: double GetUpdateRate() const;
+
+  /// \brief Gets the type (name) of this Rendering Engine
+  public: std::string GetType() const;
+
+  protected: double updateRate;
+  protected: std::string type;
+  
+
+};
+
+}
+#endif

Modified: code/gazebo/trunk/server/rendering/SConscript
===================================================================
--- code/gazebo/trunk/server/rendering/SConscript       2008-06-05 06:29:49 UTC 
(rev 6474)
+++ code/gazebo/trunk/server/rendering/SConscript       2008-06-05 11:01:41 UTC 
(rev 6475)
@@ -1,10 +1,11 @@
 #Import variable
 Import('env staticObjs sharedObjs headers')
 
-sources = Split('OgreCreator.cc OgreAdaptor.cc OgreFrameListener.cc 
OgreDynamicRenderable.cc OgreDynamicLines.cc OgreSimpleShape.cc OgreHUD.cc 
MovableText.cc OgreVisual.cc')
+sources = Split('RenderEngine.cc OgreCreator.cc OgreAdaptor.cc 
OgreFrameListener.cc OgreDynamicRenderable.cc OgreDynamicLines.cc 
OgreSimpleShape.cc OgreHUD.cc MovableText.cc OgreVisual.cc')
 
 headers.append( 
           ['#/server/rendering/MovableText.hh',
+           '#/server/rendering/RenderEngine.hh',
            '#/server/rendering/OgreAdaptor.hh',
            '#/server/rendering/OgreCreator.hh',
            '#/server/rendering/OgreDynamicLines.hh',


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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to