Revision: 8555
http://playerstage.svn.sourceforge.net/playerstage/?rev=8555&view=rev
Author: hsujohnhsu
Date: 2010-02-17 22:13:05 +0000 (Wed, 17 Feb 2010)
Log Message:
-----------
support for x-less mode
Modified Paths:
--------------
code/gazebo/trunk/server/physics/PhysicsEngine.cc
Modified: code/gazebo/trunk/server/physics/PhysicsEngine.cc
===================================================================
--- code/gazebo/trunk/server/physics/PhysicsEngine.cc 2010-02-17 22:06:44 UTC
(rev 8554)
+++ code/gazebo/trunk/server/physics/PhysicsEngine.cc 2010-02-17 22:13:05 UTC
(rev 8555)
@@ -33,6 +33,7 @@
#include "Material.hh"
#include "Shape.hh"
#include "PhysicsEngine.hh"
+#include "Simulator.hh" // disable X
using namespace gazebo;
@@ -47,35 +48,38 @@
Param::End();
this->mutex = new boost::recursive_mutex();
- this->visual =
OgreCreator::Instance()->CreateVisual("Physics_Engine_Visual");
- this->visual->SetVisible(false);
- this->contactLines.resize(100);
+ if (Simulator::Instance()->GetRenderEngineEnabled())
+ {
+ this->visual =
OgreCreator::Instance()->CreateVisual("Physics_Engine_Visual");
+ this->visual->SetVisible(false);
+ this->contactLines.resize(100);
- Material *mat = new Material();
- mat->SetName("ContactPointsMaterial");
- mat->SetPointSize(10);
- mat->SetAmbient(Color(1,1,0,1));
- mat->SetDiffuse(Color(1,1,0,1));
- mat->SetEmissive(Color(1,1,0,1));
- std::string matName = OgreCreator::CreateMaterial(mat);
+ Material *mat = new Material();
+ mat->SetName("ContactPointsMaterial");
+ mat->SetPointSize(10);
+ mat->SetAmbient(Color(1,1,0,1));
+ mat->SetDiffuse(Color(1,1,0,1));
+ mat->SetEmissive(Color(1,1,0,1));
+ std::string matName = OgreCreator::CreateMaterial(mat);
- unsigned int i=0;
- for (this->contactLinesIter = this->contactLines.begin();
- this->contactLinesIter != this->contactLines.end();
- this->contactLinesIter++, i++)
- {
- (*this->contactLinesIter) = OgreCreator::Instance()->CreateDynamicLine(
- OgreDynamicRenderable::OT_LINE_LIST);
- (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
- (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
- (*this->contactLinesIter)->setMaterial(matName);
- this->visual->AttachObject(*this->contactLinesIter);
- }
+ unsigned int i=0;
+ for (this->contactLinesIter = this->contactLines.begin();
+ this->contactLinesIter != this->contactLines.end();
+ this->contactLinesIter++, i++)
+ {
+ (*this->contactLinesIter) = OgreCreator::Instance()->CreateDynamicLine(
+ OgreDynamicRenderable::OT_LINE_LIST);
+ (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+ (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+ (*this->contactLinesIter)->setMaterial(matName);
+ this->visual->AttachObject(*this->contactLinesIter);
+ }
- World::Instance()->ConnectShowContactsSignal(
boost::bind(&PhysicsEngine::ShowVisual, this, _1) );
+ World::Instance()->ConnectShowContactsSignal(
boost::bind(&PhysicsEngine::ShowVisual, this, _1) );
- this->contactLinesIter = this->contactLines.begin();
- delete mat;
+ this->contactLinesIter = this->contactLines.begin();
+ delete mat;
+ }
}
////////////////////////////////////////////////////////////////////////////////
@@ -168,6 +172,8 @@
// Set whether to show contacts
void PhysicsEngine::ShowVisual(bool show)
{
+ if (!Simulator::Instance()->GetRenderEngineEnabled())
+ return;
this->visual->SetVisible(show);
if (show)
this->contactLinesIter = this->contactLines.begin();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit