24 #include <boost/enable_shared_from_this.hpp>
25 #include <boost/shared_ptr.hpp>
26 #include <boost/unordered/unordered_map.hpp>
27 #include <boost/thread/recursive_mutex.hpp>
43 class BasicController;
79 class Scene :
public boost::enable_shared_from_this<Scene>
96 public: Scene(
const std::string &_name,
97 bool _enableVisualizations =
false,
98 bool _isServer =
false);
105 public:
void Load(sdf::ElementPtr _scene);
118 public: Ogre::SceneManager *
GetManager()
const;
122 public: std::string
GetName()
const;
145 public:
void CreateGrid(uint32_t _cellCount,
float _cellLength,
151 public: Grid *
GetGrid(uint32_t _index)
const;
163 bool _autoRender =
true);
171 bool _autoRender =
true);
179 bool _autoRender =
true);
247 const std::string &_mode);
290 std::vector<VisualPtr> &_visuals);
315 public:
void SetVisible(
const std::string &_name,
bool _visible);
323 const std::string &_name);
332 public:
void SetFog(
const std::string &_type,
334 double _density,
double _start,
double _end);
338 public: uint32_t
GetId()
const;
362 public:
void SetGrid(
bool _enabled);
371 public: std::string
StripSceneName(
const std::string &_name)
const;
378 public:
void Clear();
446 private:
void SetSky();
449 private:
void InitDeferredShading();
457 private: Ogre::Entity *GetOgreEntityAt(
CameraPtr _camera,
459 bool _ignorSelectionObj);
471 private:
void GetMeshInformation(
const Ogre::Mesh *_mesh,
472 size_t &_vertexCount,
473 Ogre::Vector3* &_vertices,
476 const Ogre::Vector3 &_position,
477 const Ogre::Quaternion &_orient,
478 const Ogre::Vector3 &_scale);
483 private:
void PrintSceneGraphHelper(
const std::string &_prefix,
489 private:
void OnScene(ConstScenePtr &_msg);
493 private:
void OnResponse(ConstResponsePtr &_msg);
497 private:
void OnRequest(ConstRequestPtr &_msg);
501 private:
void OnJointMsg(ConstJointPtr &_msg);
505 private:
bool ProcessSensorMsg(ConstSensorPtr &_msg);
509 private:
bool ProcessJointMsg(ConstJointPtr &_msg);
513 private:
bool ProcessLinkMsg(ConstLinkPtr &_msg);
517 private:
bool ProcessSceneMsg(ConstScenePtr &_msg);
521 private:
bool ProcessModelMsg(
const msgs::Model &_msg);
525 private:
void OnSensorMsg(ConstSensorPtr &_msg);
529 private:
void OnVisualMsg(ConstVisualPtr &_msg);
533 private:
bool ProcessVisualMsg(ConstVisualPtr &_msg);
537 private:
void OnLightMsg(ConstLightPtr &_msg);
541 private:
bool ProcessLightMsg(ConstLightPtr &_msg);
545 private:
void ProcessRequestMsg(ConstRequestPtr &_msg);
549 private:
void OnSelectionMsg(ConstSelectionPtr &_msg);
553 private:
void OnSkyMsg(ConstSkyPtr &_msg);
557 private:
void OnModelMsg(ConstModelPtr &_msg);
561 private:
void OnPoseMsg(ConstPosesStampedPtr &_msg);
565 private:
void OnSkeletonPoseMsg(ConstPoseAnimationPtr &_msg);
570 private:
void CreateCOMVisual(ConstLinkPtr &_msg,
VisualPtr _linkVisual);
575 private:
void CreateCOMVisual(sdf::ElementPtr _elem,
579 private: std::string name;
582 private: sdf::ElementPtr sdf;
585 private: std::vector<CameraPtr> cameras;
588 private: std::vector<UserCameraPtr> userCameras;
591 private: Ogre::SceneManager *manager;
594 private: Ogre::RaySceneQuery *raySceneQuery;
597 private: std::vector<Grid *> grids;
600 private:
static uint32_t idCounter;
603 private: uint32_t id;
606 private: std::string idString;
610 typedef std::list<boost::shared_ptr<msgs::Visual const> > VisualMsgs_L;
613 private: VisualMsgs_L visualMsgs;
617 typedef std::list<boost::shared_ptr<msgs::Light const> > LightMsgs_L;
620 private: LightMsgs_L lightMsgs;
624 typedef std::map<uint32_t, msgs::Pose> PoseMsgs_M;
627 private: PoseMsgs_M poseMsgs;
631 typedef std::list<boost::shared_ptr<msgs::Scene const> > SceneMsgs_L;
634 private: SceneMsgs_L sceneMsgs;
638 typedef std::list<boost::shared_ptr<msgs::Joint const> > JointMsgs_L;
641 private: JointMsgs_L jointMsgs;
645 typedef std::list<boost::shared_ptr<msgs::Link const> > LinkMsgs_L;
648 private: LinkMsgs_L linkMsgs;
652 typedef std::list<boost::shared_ptr<msgs::Model const> > ModelMsgs_L;
654 private: ModelMsgs_L modelMsgs;
658 typedef std::list<boost::shared_ptr<msgs::Sensor const> > SensorMsgs_L;
661 private: SensorMsgs_L sensorMsgs;
665 typedef std::list<boost::shared_ptr<msgs::Request const> > RequestMsgs_L;
667 private: RequestMsgs_L requestMsgs;
671 typedef std::map<uint32_t, VisualPtr> Visual_M;
674 private: Visual_M visuals;
678 typedef std::map<std::string, LightPtr> Light_M;
681 private: Light_M lights;
685 typedef std::list<boost::shared_ptr<msgs::PoseAnimation const> >
688 private: SkeletonPoseMsgs_L skeletonPoseMsgs;
691 private: boost::shared_ptr<msgs::Selection const> selectionMsg;
694 private: boost::mutex *receiveMutex;
697 private: boost::recursive_mutex poseMsgMutex;
748 private: std::vector<event::ConnectionPtr> connections;
761 private: std::string selectionMode;
764 private: msgs::Request *requestMsg;
767 private:
bool enableVisualizations;
770 private: Heightmap *terrain;
773 private: std::map<std::string, Projector *> projectors;
779 private: SkyX::BasicController *skyxController;
782 private:
bool showCOMs;
785 private:
bool showCollisions;
788 private:
bool showJoints;
791 private:
bool transparent;
794 private:
bool wireframe;
797 private:
bool initialized;
808 private: uint32_t contactVisId;
812 typedef boost::unordered_map<std::string,
813 boost::shared_ptr<msgs::Joint const> > JointMsgs_M;
816 private: JointMsgs_M joints;