Revision: 8991
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8991&view=rev
Author:   natepak
Date:     2010-12-01 21:25:14 +0000 (Wed, 01 Dec 2010)

Log Message:
-----------
Updates

Modified Paths:
--------------
    code/gazebo/branches/dev/server/CMakeLists.txt
    code/gazebo/branches/dev/server/Entity.cc
    code/gazebo/branches/dev/server/Entity.hh
    code/gazebo/branches/dev/server/Messages.hh
    code/gazebo/branches/dev/server/physics/Body.cc
    code/gazebo/branches/dev/server/physics/PhysicsEngine.cc
    code/gazebo/branches/dev/server/rendering/UserCamera.cc
    code/gazebo/branches/dev/server/rendering/Visual.cc
    code/gazebo/branches/dev/server/rendering/Visual.hh

Modified: code/gazebo/branches/dev/server/CMakeLists.txt
===================================================================
--- code/gazebo/branches/dev/server/CMakeLists.txt      2010-12-01 03:43:00 UTC 
(rev 8990)
+++ code/gazebo/branches/dev/server/CMakeLists.txt      2010-12-01 21:25:14 UTC 
(rev 8991)
@@ -98,6 +98,7 @@
              STLLoader.cc
              Plugin.cc
              Events.cc
+             Box.cc
 )
 
 SET (headers Common.hh
@@ -133,6 +134,7 @@
              Events.hh
              Plugin.hh
              Messages.hh
+             Box.hh
 )
 
 APPEND_TO_SERVER_HEADERS(${headers})

Modified: code/gazebo/branches/dev/server/Entity.cc
===================================================================
--- code/gazebo/branches/dev/server/Entity.cc   2010-12-01 03:43:00 UTC (rev 
8990)
+++ code/gazebo/branches/dev/server/Entity.cc   2010-12-01 21:25:14 UTC (rev 
8991)
@@ -25,6 +25,7 @@
  * SVN: $Id$
  */
 
+#include "Messages.hh"
 #include "Geom.hh"
 #include "Model.hh"
 #include "Body.hh"
@@ -53,20 +54,24 @@
   std::ostringstream visname;
   visname << "Entity_" << this->GetId() << "_VISUAL";
 
+  this->visualMsg = new VisualMsg();
+  this->visualMsg->id = visname.str();
+
   if (this->parent && this->parent->HasType(ENTITY))
   {
     Entity *ep = (Entity*)(this->parent);
-    //if (Simulator::Instance()->GetRenderEngineEnabled())
-    this->visualNode = new Visual(visname.str(), ep);
+    this->visualMsg->parentId = ep->GetName();
     this->SetStatic(ep->IsStatic());
   }
   else
   {
-    //if (Simulator::Instance()->GetRenderEngineEnabled())
-    this->visualNode = new Visual(visname.str(), this->GetWorld()->GetScene());
+    this->visualMsg = new VisualMsg();
   }
 
-  this->visualNode->SetOwner(this);
+  Simulator::Instance()->SendMessage( *this->visualMsg );
+
+  // NATY: put functionality back in
+  //this->visualNode->SetOwner(this);
 }
 
 void Entity::SetName(const std::string &name)
@@ -74,7 +79,8 @@
   Common::SetName(name);
   std::ostringstream visname;
   visname << name << "_VISUAL";
-  this->visualNode->SetName(visname.str());
+  this->visualMsg->id = visname.str();
+  Simulator::Instance()->SendMessage( *this->visualMsg );
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -110,33 +116,14 @@
     }
   }*/
 
-  if (Simulator::Instance()->GetRenderEngineEnabled())
-  {
-    if (this->visualNode)
-    {
-      delete this->visualNode;
-      this->visualNode = NULL;
-    }
-  }
-
-  this->visualNode = NULL;
+  this->visualMsg->action = VisualMsg::DELETE;
+  Simulator::Instance()->SendMessage( *this->visualMsg );
+  delete this->visualMsg;
+  this->visualMsg = NULL;
 }
 
-////////////////////////////////////////////////////////////////////////////////
-// Return this entitie's sceneNode
-Visual *Entity::GetVisualNode() const
-{
-  return this->visualNode;
-}
 
 
////////////////////////////////////////////////////////////////////////////////
-// Set the scene node
-void Entity::SetVisualNode(Visual *visualNode)
-{
-  this->visualNode = visualNode;
-}
-
-////////////////////////////////////////////////////////////////////////////////
 // Set whether this entity is static: immovable
 void Entity::SetStatic(const bool &s)
 {
@@ -172,6 +159,13 @@
 }
 
 
////////////////////////////////////////////////////////////////////////////////
+/// Return the bounding box for the entity 
+Box Entity::GetBoundingBox() const
+{
+  return Box(Vector3(0,0,0), Vector3(1,1,1));
+}
+
+////////////////////////////////////////////////////////////////////////////////
 /// Get the absolute pose of the entity
 Pose3d Entity::GetWorldPose() const
 {
@@ -295,16 +289,7 @@
 // Handle a change of pose
 void Entity::PoseChange(bool notify)
 {
-  if (Simulator::Instance()->GetRenderEngineEnabled())
-  {
-    // NATY:: Not sure the reason for GetState
-    /*if (Simulator::Instance()->GetState() == Simulator::RUN &&
-        !this->IsStatic())
-      this->visualNode->SetDirty(true, this->GetRelativePose());
-    else
-    */
-      this->visualNode->SetPose(this->GetRelativePose());
-  }
+  Simulator::Instance()->SendMessage( msg );
 
   if (notify)
   {

Modified: code/gazebo/branches/dev/server/Entity.hh
===================================================================
--- code/gazebo/branches/dev/server/Entity.hh   2010-12-01 03:43:00 UTC (rev 
8990)
+++ code/gazebo/branches/dev/server/Entity.hh   2010-12-01 21:25:14 UTC (rev 
8991)
@@ -30,6 +30,7 @@
 #include <vector>
 #include <string>
 
+#include "Box.hh"
 #include "Common.hh"
 #include "Pose3d.hh"
 #include "Param.hh"
@@ -57,14 +58,6 @@
  
     public: void SetName(const std::string &name);
  
-    /// \brief Return this entity's sceneNode
-    /// \return Ogre scene node
-    public: Visual *GetVisualNode() const;
-  
-    /// \brief Set the scene node
-    /// \param sceneNode Ogre scene node
-    public: void SetVisualNode(Visual *visualNode);
- 
     /// \brief Set whether this entity is static: immovable
     /// \param s Bool, true = static
     public: void SetStatic(const bool &s);
@@ -72,7 +65,10 @@
     /// \brief Return whether this entity is static
     /// \return bool True = static
     public: bool IsStatic() const;
-  
+
+    /// \brief Return the bounding box for the entity 
+    public: Box GetBoundingBox() const;
+
     /// \brief Get the absolute pose of the entity
     public: virtual Pose3d GetWorldPose() const;
 

Modified: code/gazebo/branches/dev/server/Messages.hh
===================================================================
--- code/gazebo/branches/dev/server/Messages.hh 2010-12-01 03:43:00 UTC (rev 
8990)
+++ code/gazebo/branches/dev/server/Messages.hh 2010-12-01 21:25:14 UTC (rev 
8991)
@@ -10,7 +10,7 @@
 
 namespace gazebo
 {
-  enum MessageType{ INSERT_MODEL, VISUAL, POSE };
+  enum MessageType{ INSERT_MODEL_MSG, VISUAL_MSG, POSE_MSG };
 
   class Message
   {
@@ -25,7 +25,7 @@
 
   class InsertModelMsg : public Message
   {
-    public: InsertModelMsg() : Message(INSERT_MODEL) {}
+    public: InsertModelMsg() : Message(INSERT_MODEL_MSG) {}
     public: InsertModelMsg(const InsertModelMsg &m) : Message(m), 
             xmlStr(m.xmlStr) {}
     public: virtual Message *Clone() const 
@@ -38,7 +38,7 @@
     public: enum ActionType {UPDATE, DELETE};
     public: enum RenderType {MESH_RESOURCE, POINTS, LINE_LIST};
 
-    public: VisualMsg() : Message(VISUAL) {}
+    public: VisualMsg() : Message(VISUAL_MSG) {}
     public: VisualMsg(const VisualMsg &m) : Message(m) {}
     public: virtual Message *Clone() const 
             { VisualMsg *msg = new VisualMsg(*this); return msg; }
@@ -57,9 +57,9 @@
     public: std::vector<Vector3> points;
   };
 
-  /*class UpdatePoseMsg : public Message
+  class UpdatePoseMsg : public Message
   {
-    public: UpdatePoseMsg() : Message(UPDATE_POSE), id(0) {}
+    public: UpdatePoseMsg() : Message(POSE_MSG), id(0) {}
     public: UpdatePoseMsg(const UpdatePoseMsg &m) : Message(m), 
             id(m.id), pose(m.pose) {}
     public: virtual Message *Clone() const 
@@ -67,7 +67,7 @@
 
     public: std::string id;
     public: Pose3d pose;
-  };*/
+  };
 }
 
 #endif

Modified: code/gazebo/branches/dev/server/physics/Body.cc
===================================================================
--- code/gazebo/branches/dev/server/physics/Body.cc     2010-12-01 03:43:00 UTC 
(rev 8990)
+++ code/gazebo/branches/dev/server/physics/Body.cc     2010-12-01 21:25:14 UTC 
(rev 8991)
@@ -401,7 +401,7 @@
     {
       msg.points.clear();
 
-      msg.id = visname.str() + "_lineto_" + giter->first->GetName();
+      msg.id = visname.str() + "_lineto_" + giter->first;
       msg.points.push_back( Vector3(0,0,0) );
       msg.points.push_back(giter->second->GetRelativePose().pos);
 

Modified: code/gazebo/branches/dev/server/physics/PhysicsEngine.cc
===================================================================
--- code/gazebo/branches/dev/server/physics/PhysicsEngine.cc    2010-12-01 
03:43:00 UTC (rev 8990)
+++ code/gazebo/branches/dev/server/physics/PhysicsEngine.cc    2010-12-01 
21:25:14 UTC (rev 8991)
@@ -62,7 +62,7 @@
     this->visualMsg->parentId.clear();
     this->visualMsg->id = "physics_engine_visual";
     this->visualMsg->visible = false;
-    this->visualMsg->rtShader = false;
+    //this->visualMsg->rtShader = false;
     this->visualMsg->castShadows = false;
     this->visualMsg->action = VisualMsg::UPDATE;
 
@@ -197,7 +197,8 @@
 /// Add a contact visual
 void PhysicsEngine::AddContactVisual(Vector3 pos, Vector3 norm)
 {
-  if (!RenderState::GetShowContacts())
+  // NATY: put back in
+ /* if (!RenderState::GetShowContacts())
     return;
 
   Vector3 e1 = norm.GetPerpendicular(); e1.Normalize();
@@ -231,6 +232,7 @@
 
   if (this->contactLinesIter == this->contactLines.end())
     this->contactLinesIter = this->contactLines.begin();
+    */
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/gazebo/branches/dev/server/rendering/UserCamera.cc
===================================================================
--- code/gazebo/branches/dev/server/rendering/UserCamera.cc     2010-12-01 
03:43:00 UTC (rev 8990)
+++ code/gazebo/branches/dev/server/rendering/UserCamera.cc     2010-12-01 
21:25:14 UTC (rev 8991)
@@ -359,9 +359,8 @@
   key->setRotation(this->pitchNode->getOrientation());
 
   Vector3 min, max, size;
-  Visual *vis = entity->GetVisualNode();
-  OgreCreator::GetVisualBounds(vis, min,max);
-  size = max-min;
+  Box box = entity->GetBoundingBox();
+  size = box.max-box.min;
 
   double scale = std::max(std::max(size.x, size.y), size.z);
   scale += 0.5;

Modified: code/gazebo/branches/dev/server/rendering/Visual.cc
===================================================================
--- code/gazebo/branches/dev/server/rendering/Visual.cc 2010-12-01 03:43:00 UTC 
(rev 8990)
+++ code/gazebo/branches/dev/server/rendering/Visual.cc 2010-12-01 21:25:14 UTC 
(rev 8991)
@@ -52,7 +52,7 @@
 
 
////////////////////////////////////////////////////////////////////////////////
 // Constructor
-Visual::Visual(const std::string &name, Common *parent)
+Visual::Visual(const std::string &name, Visual *parent)
   : Common(parent)
 {
   this->SetName(name);
@@ -63,10 +63,8 @@
   stream << this->GetName() << "_VISUAL_" << visualCounter++;
 
   Ogre::SceneNode *pnode = NULL;
-  if (this->GetParent()->HasType(ENTITY))
-     pnode = ((Entity*)this->GetParent())->GetVisualNode()->GetSceneNode();
-  else if ( this->GetParent()->HasType(VISUAL))
-    pnode = ((Visual*)this->GetParent())->GetSceneNode();
+  if (parent)
+    pnode = parent->GetSceneNode();
   else
     gzerr(0) << "Create a visual, invalid parent!!!\n";
 

Modified: code/gazebo/branches/dev/server/rendering/Visual.hh
===================================================================
--- code/gazebo/branches/dev/server/rendering/Visual.hh 2010-12-01 03:43:00 UTC 
(rev 8990)
+++ code/gazebo/branches/dev/server/rendering/Visual.hh 2010-12-01 21:25:14 UTC 
(rev 8991)
@@ -62,7 +62,7 @@
   class Visual : public Common //, public Ogre::Any
   {
     /// \brief Constructor
-    public: Visual (const std::string &name, Common *parent);
+    public: Visual (const std::string &name, Visual *parent);
 
     /// \brief Constructor
     public: Visual (const std::string &name, Ogre::SceneNode *parent);


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

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to