18 #ifndef _GAZEBO_RENDERING_SCENE_HH_
19 #define _GAZEBO_RENDERING_SCENE_HH_
25 #include <boost/enable_shared_from_this.hpp>
26 #include <boost/shared_ptr.hpp>
30 #include <ignition/math/Vector2.hh>
31 #include <ignition/math/Vector3.hh>
35 #include "gazebo/gazebo_config.h"
74 class GZ_RENDERING_VISIBLE
Scene :
75 public boost::enable_shared_from_this<Scene>
78 GZ_SKYX_ALL = 0x0FFFFFFF,
79 GZ_SKYX_CLOUDS = 0x0000001,
80 GZ_SKYX_MOON = 0x0000002,
92 public:
Scene(
const std::string &_name,
93 const bool _enableVisualizations =
false,
94 const bool _isServer =
false);
97 public:
virtual ~
Scene();
101 public:
void Load(sdf::ElementPtr _scene);
110 public:
void PreRender();
115 public: Ogre::SceneManager *GetManager() const GAZEBO_DEPRECATED(7.0);
119 public: Ogre::SceneManager *OgreSceneManager() const;
124 public: std::
string GetName() const GAZEBO_DEPRECATED(7.0);
128 public: std::
string Name() const;
132 public:
void SetAmbientColor(const common::Color &_color);
137 public: common::Color GetAmbientColor() const GAZEBO_DEPRECATED(7.0);
141 public: common::Color AmbientColor() const;
145 public:
void SetBackgroundColor(const common::Color &_color);
150 public: common::Color GetBackgroundColor() const GAZEBO_DEPRECATED(7.0);
154 public: common::Color BackgroundColor() const;
161 public:
void CreateGrid(const uint32_t _cellCount,
162 const
float _cellLength, const
float _lineWidth,
163 const common::Color &_color);
168 public:
Grid *GetGrid(uint32_t _index) const;
173 public: uint32_t GetGridCount() const GAZEBO_DEPRECATED(7.0);
177 public: uint32_t GridCount() const;
184 public:
CameraPtr CreateCamera(const std::
string &_name,
185 const
bool _autoRender = true);
193 const
bool _autoRender = true);
196 public: OculusCameraPtr CreateOculusCamera(
const std::string &_name);
204 public: uint32_t GetOculusCameraCount() const GAZEBO_DEPRECATED(7.0);
208 public: uint32_t OculusCameraCount() const;
216 public:
DepthCameraPtr CreateDepthCamera(
const std::string &_name,
217 const bool _autoRender =
true);
224 public:
GpuLaserPtr CreateGpuLaser(
const std::string &_name,
225 const bool _autoRender =
true);
230 public: uint32_t GetCameraCount() const GAZEBO_DEPRECATED(7.0);
234 public: uint32_t CameraCount() const;
240 public:
CameraPtr GetCamera(const uint32_t _index) const;
245 public:
CameraPtr GetCamera(const std::
string &_name) const;
254 public:
UserCameraPtr CreateUserCamera(const std::
string &_name,
255 const
bool _stereoEnabled = false);
260 public: uint32_t GetUserCameraCount() const GAZEBO_DEPRECATED(7.0);
264 public: uint32_t UserCameraCount() const;
271 public:
UserCameraPtr GetUserCamera(const uint32_t _index) const;
275 public:
void RemoveCamera(const std::
string &_name);
280 public:
LightPtr GetLight(const std::
string &_name) const;
285 public: uint32_t GetLightCount() const GAZEBO_DEPRECATED(7.0);
289 public: uint32_t LightCount() const;
295 public:
LightPtr GetLight(const uint32_t _index) const;
300 public:
VisualPtr GetVisual(const std::
string &_name) const;
305 public:
VisualPtr GetVisual(const uint32_t _id) const;
310 public:
void SelectVisual(const std::
string &_name,
311 const std::
string &_mode);
321 const math::Vector2i &_mousePos,
322 std::
string &_mod) GAZEBO_DEPRECATED(7.0);
331 const ignition::math::Vector2i &_mousePos,
336 public:
void SnapVisualToNearestBelow(const std::
string &_visualName);
345 const math::Vector2i &_mousePos) GAZEBO_DEPRECATED(7.0);
353 const ignition::math::Vector2i &_mousePos);
362 const math::Vector2i &_mousePos) GAZEBO_DEPRECATED(7.0);
370 const ignition::math::Vector2i &_mousePos);
376 public:
VisualPtr GetVisualBelow(const std::
string &_visualName)
377 GAZEBO_DEPRECATED(7.0);
382 public:
VisualPtr VisualBelow(const std::
string &_visualName);
389 public:
void GetVisualsBelowPoint(const math::Vector3 &_pt,
390 std::vector<
VisualPtr> &_visuals) GAZEBO_DEPRECATED(7.0);
396 public:
void VisualsBelowPoint(const ignition::math::Vector3d &_pt,
405 public:
double GetHeightBelowPoint(const math::Vector3 &_pt)
406 GAZEBO_DEPRECATED(7.0);
412 public:
double HeightBelowPoint(const ignition::math::Vector3d &_pt);
420 public:
bool GetFirstContact(
CameraPtr _camera,
421 const math::Vector2i &_mousePos,
422 math::Vector3 &_position) GAZEBO_DEPRECATED(7.0);
429 public:
bool FirstContact(
CameraPtr _camera,
430 const ignition::math::Vector2i &_mousePos,
431 ignition::math::Vector3d &_position);
434 public:
void PrintSceneGraph();
440 public:
void SetVisible(const std::
string &_name, const
bool _visible);
447 public:
void DrawLine(const math::Vector3 &_start,
448 const math::Vector3 &_end,
449 const std::
string &_name) GAZEBO_DEPRECATED(7.0);
455 public:
void DrawLine(const ignition::math::Vector3d &_start,
456 const ignition::math::Vector3d &_end,
457 const std::
string &_name);
466 public:
void SetFog(const std::
string &_type,
467 const common::Color &_color,
468 const
double _density, const
double _start,
474 public: uint32_t GetId() const GAZEBO_DEPRECATED(7.0);
478 public: uint32_t Id() const;
483 public: std::
string GetIdString() const GAZEBO_DEPRECATED(7.0);
487 public: std::
string IdString() const;
491 public:
void SetShadowsEnabled(const
bool _value);
496 public:
bool GetShadowsEnabled() const GAZEBO_DEPRECATED(7.0);
500 public:
bool ShadowsEnabled() const;
508 public:
void RemoveVisual(
VisualPtr _vis);
512 public:
void RemoveVisual(const uint32_t _id);
519 public:
void SetVisualId(
VisualPtr _vis, const uint32_t _id);
523 public:
void AddLight(
LightPtr _light);
527 public:
void RemoveLight(
LightPtr _light);
531 public:
void SetGrid(const
bool _enabled);
535 public:
void ShowOrigin(const
bool _show);
540 public:
VisualPtr GetWorldVisual() const GAZEBO_DEPRECATED(7.0);
549 public: std::
string StripSceneName(const std::
string &_name) const;
556 public:
void Clear();
562 public:
VisualPtr GetSelectedVisual() const GAZEBO_DEPRECATED(7.0);
567 public:
VisualPtr SelectedVisual() const;
571 public:
void SetWireframe(const
bool _show);
575 public:
void SetTransparent(const
bool _show);
579 public:
void ShowCOMs(const
bool _show);
583 public:
void ShowInertias(const
bool _show);
587 public:
void ShowLinkFrames(const
bool _show);
591 public:
void ShowSkeleton(const
bool _show);
595 public:
void ShowJoints(const
bool _show);
599 public:
void ShowCollisions(const
bool _show);
603 public:
void ShowContacts(const
bool _show);
607 public:
void ShowClouds(const
bool _show);
612 public:
bool GetShowClouds() const GAZEBO_DEPRECATED(7.0);
616 public:
bool ShowClouds() const;
622 public:
void SetSkyXMode(const
unsigned int _mode);
626 public: SkyX::SkyX *GetSkyX() const;
631 public:
bool GetInitialized() const GAZEBO_DEPRECATED(7.0);
635 public:
bool Initialized() const;
643 public: common::Time GetSimTime() const GAZEBO_DEPRECATED(7.0);
650 public: common::Time SimTime() const;
655 public: uint32_t GetVisualCount() const GAZEBO_DEPRECATED(7.0);
659 public: uint32_t VisualCount() const;
662 public:
void RemoveProjectors();
668 public:
void ToggleLayer(const int32_t _layer);
671 private:
void SetSky();
674 private:
void InitDeferredShading();
682 private: Ogre::Entity *OgreEntityAt(
CameraPtr _camera,
683 const ignition::math::Vector2i &_mousePos,
684 const
bool _ignoreSelectionObj);
696 private:
void MeshInformation(const Ogre::Mesh *_mesh,
697 size_t &_vertexCount,
698 Ogre::Vector3* &_vertices,
701 const ignition::math::Vector3d &_position,
702 const ignition::math::Quaterniond &_orient,
703 const ignition::math::Vector3d &_scale);
708 private:
void PrintSceneGraphHelper(const std::
string &_prefix,
714 private:
void OnScene(ConstScenePtr &_msg);
718 private:
void OnResponse(ConstResponsePtr &_msg);
722 private:
void OnRequest(ConstRequestPtr &_msg);
726 private:
void OnJointMsg(ConstJointPtr &_msg);
730 private:
bool ProcessSensorMsg(ConstSensorPtr &_msg);
734 private:
bool ProcessJointMsg(ConstJointPtr &_msg);
738 private:
bool ProcessLinkMsg(ConstLinkPtr &_msg);
742 private:
bool ProcessSceneMsg(ConstScenePtr &_msg);
746 private:
bool ProcessModelMsg(const msgs::Model &_msg);
750 private:
void OnSensorMsg(ConstSensorPtr &_msg);
754 private:
void OnVisualMsg(ConstVisualPtr &_msg);
760 private:
bool ProcessVisualMsg(ConstVisualPtr &_msg,
765 private:
void OnLightFactoryMsg(ConstLightPtr &_msg);
769 private:
void OnLightModifyMsg(ConstLightPtr &_msg);
773 private:
bool ProcessLightFactoryMsg(ConstLightPtr &_msg);
777 private:
bool ProcessLightModifyMsg(ConstLightPtr &_msg);
781 private:
void ProcessRequestMsg(ConstRequestPtr &_msg);
785 private:
void OnSkyMsg(ConstSkyPtr &_msg);
789 private:
void OnModelMsg(ConstModelPtr &_msg);
793 private:
void OnPoseMsg(ConstPosesStampedPtr &_msg);
797 private:
void OnSkeletonPoseMsg(ConstPoseAnimationPtr &_msg);
802 private:
void CreateCOMVisual(ConstLinkPtr &_msg,
VisualPtr _linkVisual);
807 private:
void CreateCOMVisual(sdf::ElementPtr _elem,
813 private:
void CreateInertiaVisual(ConstLinkPtr &_msg,
819 private:
void CreateInertiaVisual(sdf::ElementPtr _elem,
825 private:
void CreateLinkFrameVisual(ConstLinkPtr &_msg,
831 private:
void RemoveVisualizations(
VisualPtr _vis);
835 private: std::unique_ptr<ScenePrivate> dataPtr;
boost::shared_ptr< UserCamera > UserCameraPtr
Definition: RenderTypes.hh:92
boost::shared_ptr< GpuLaser > GpuLaserPtr
Definition: RenderTypes.hh:104
SkyXMode
Definition: Scene.hh:77
Forward declarations for transport.
A renderable object.
Definition: Visual.hh:59
Displays a grid of cells, drawn with lines.
Definition: Grid.hh:53
boost::shared_ptr< DepthCamera > DepthCameraPtr
Definition: RenderTypes.hh:96
Rendering a terrain using heightmap information.
Definition: Heightmap.hh:68
Representation of an entire scene graph.
Definition: Scene.hh:74
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:112
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< WideAngleCamera > WideAngleCameraPtr
Definition: RenderTypes.hh:100
boost::shared_ptr< Light > LightPtr
Definition: RenderTypes.hh:84
boost::shared_ptr< Camera > CameraPtr
Definition: RenderTypes.hh:88