Revision: 7499
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7499&view=rev
Author:   hsujohnhsu
Date:     2009-03-17 00:58:27 +0000 (Tue, 17 Mar 2009)

Log Message:
-----------
more for headless mode.

Modified Paths:
--------------
    code/gazebo/branches/ogre-1.4.9/server/physics/RayGeom.cc

Modified: code/gazebo/branches/ogre-1.4.9/server/physics/RayGeom.cc
===================================================================
--- code/gazebo/branches/ogre-1.4.9/server/physics/RayGeom.cc   2009-03-17 
00:56:44 UTC (rev 7498)
+++ code/gazebo/branches/ogre-1.4.9/server/physics/RayGeom.cc   2009-03-17 
00:58:27 UTC (rev 7499)
@@ -33,6 +33,7 @@
 #include "Body.hh"
 #include "Global.hh"
 #include "RayGeom.hh"
+#include "Simulator.hh"
 
 using namespace gazebo;
 
@@ -47,7 +48,7 @@
   // Create default ray with unit length
   this->SetGeom( dCreateRay( this->spaceId, 1.0 ),  false );
 
-  if (displayRays)
+  if (Simulator::Instance()->GetRenderEngineEnabled() && displayRays)
   {
     this->line = new OgreDynamicLines(OgreDynamicRenderable::OT_LINE_LIST);
 
@@ -71,11 +72,12 @@
 // Destructor
 RayGeom::~RayGeom()
 {
-  if (this->line)
-  {
-    delete this->line;
-    this->line = NULL;
-  }
+  if (Simulator::Instance()->GetRenderEngineEnabled())
+    if (this->line)
+    {
+      delete this->line;
+      this->line = NULL;
+    }
 }
 
 void RayGeom::Update()
@@ -119,13 +121,14 @@
   dGeomRaySetLength( this->geomId,
                      this->globalStartPos.Distance(this->globalEndPos) );
 
-  if (this->line)
-  {
-    // Set the line's position relative to it's parent scene node
-    this->line->SetPoint(0, this->relativeStartPos);
-    this->line->SetPoint(1, this->relativeEndPos);
-    this->line->Update();
-  }
+  if (Simulator::Instance()->GetRenderEngineEnabled())
+    if (this->line)
+    {
+      // Set the line's position relative to it's parent scene node
+      this->line->SetPoint(0, this->relativeStartPos);
+      this->line->SetPoint(1, this->relativeEndPos);
+      this->line->Update();
+    }
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -151,14 +154,15 @@
   //dGeomRaySetLength( this->geomId, len );
   this->contactLen=len;
 
-  if (this->line)
-  {
-    Vector3 dir = this->relativeEndPos - this->relativeStartPos;
-    dir.Normalize();
+  if (Simulator::Instance()->GetRenderEngineEnabled())
+    if (this->line)
+    {
+      Vector3 dir = this->relativeEndPos - this->relativeStartPos;
+      dir.Normalize();
 
-    this->line->SetPoint(1,  dir * len + this->relativeStartPos);
-    this->line->Update();
-  }
+      this->line->SetPoint(1,  dir * len + this->relativeStartPos);
+      this->line->Update();
+    }
 }
 
 


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

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to