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"
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();
119 public: Ogre::SceneManager *OgreSceneManager() const;
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);
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 ShowJoints(const
bool _show);
595 public:
void ShowCollisions(const
bool _show);
599 public:
void ShowContacts(const
bool _show);
603 public:
void ShowClouds(const
bool _show);
608 public:
bool GetShowClouds() const GAZEBO_DEPRECATED(7.0);
612 public:
bool ShowClouds() const;
618 public:
void SetSkyXMode(const
unsigned int _mode);
622 public: SkyX::SkyX *GetSkyX() const;
627 public:
bool GetInitialized() const GAZEBO_DEPRECATED(7.0);
631 public:
bool Initialized() const;
639 public: common::Time GetSimTime() const GAZEBO_DEPRECATED(7.0);
646 public: common::Time SimTime() const;
651 public: uint32_t GetVisualCount() const GAZEBO_DEPRECATED(7.0);
655 public: uint32_t VisualCount() const;
658 public:
void RemoveProjectors();
664 public:
void ToggleLayer(const int32_t _layer);
667 private:
void SetSky();
670 private:
void InitDeferredShading();
678 private: Ogre::Entity *OgreEntityAt(
CameraPtr _camera,
679 const ignition::math::Vector2i &_mousePos,
680 const
bool _ignoreSelectionObj);
692 private:
void MeshInformation(const Ogre::Mesh *_mesh,
693 size_t &_vertexCount,
694 Ogre::Vector3* &_vertices,
697 const ignition::math::Vector3d &_position,
698 const ignition::math::Quaterniond &_orient,
699 const ignition::math::Vector3d &_scale);
704 private:
void PrintSceneGraphHelper(const std::
string &_prefix,
710 private:
void OnScene(ConstScenePtr &_msg);
714 private:
void OnResponse(ConstResponsePtr &_msg);
718 private:
void OnRequest(ConstRequestPtr &_msg);
722 private:
void OnJointMsg(ConstJointPtr &_msg);
726 private:
bool ProcessSensorMsg(ConstSensorPtr &_msg);
730 private:
bool ProcessJointMsg(ConstJointPtr &_msg);
734 private:
bool ProcessLinkMsg(ConstLinkPtr &_msg);
738 private:
bool ProcessSceneMsg(ConstScenePtr &_msg);
742 private:
bool ProcessModelMsg(const msgs::Model &_msg);
746 private:
void OnSensorMsg(ConstSensorPtr &_msg);
750 private:
void OnVisualMsg(ConstVisualPtr &_msg);
756 private:
bool ProcessVisualMsg(ConstVisualPtr &_msg,
761 private:
void OnLightFactoryMsg(ConstLightPtr &_msg);
765 private:
void OnLightModifyMsg(ConstLightPtr &_msg);
769 private:
bool ProcessLightFactoryMsg(ConstLightPtr &_msg);
773 private:
bool ProcessLightModifyMsg(ConstLightPtr &_msg);
777 private:
void ProcessRequestMsg(ConstRequestPtr &_msg);
781 private:
void OnSkyMsg(ConstSkyPtr &_msg);
785 private:
void OnModelMsg(ConstModelPtr &_msg);
789 private:
void OnPoseMsg(ConstPosesStampedPtr &_msg);
793 private:
void OnSkeletonPoseMsg(ConstPoseAnimationPtr &_msg);
798 private:
void CreateCOMVisual(ConstLinkPtr &_msg,
VisualPtr _linkVisual);
803 private:
void CreateCOMVisual(sdf::ElementPtr _elem,
809 private:
void CreateInertiaVisual(ConstLinkPtr &_msg,
815 private:
void CreateInertiaVisual(sdf::ElementPtr _elem,
821 private:
void CreateLinkFrameVisual(ConstLinkPtr &_msg,
827 private:
void RemoveVisualizations(
VisualPtr _vis);
boost::shared_ptr< DepthCamera > DepthCameraPtr
Definition: RenderTypes.hh:96
boost::shared_ptr< WideAngleCamera > WideAngleCameraPtr
Definition: RenderTypes.hh:100
boost::shared_ptr< Light > LightPtr
Definition: RenderTypes.hh:84
Forward declarations for transport.
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:48
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:112
boost::shared_ptr< Camera > CameraPtr
Definition: RenderTypes.hh:88
SkyXMode
Definition: Scene.hh:77
A renderable object.
Definition: Visual.hh:59
Displays a grid of cells, drawn with lines.
Definition: Grid.hh:53
Private data for the Visual class.
Definition: ScenePrivate.hh:112
#define GZ_RENDERING_VISIBLE
Definition: system.hh:209
boost::shared_ptr< GpuLaser > GpuLaserPtr
Definition: RenderTypes.hh:104
Rendering a terrain using heightmap information.
Definition: Heightmap.hh:68
Representation of an entire scene graph.
Definition: Scene.hh:74
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< UserCamera > UserCameraPtr
Definition: RenderTypes.hh:92
boost::shared_ptr< OculusCamera > OculusCameraPtr
Definition: RenderTypes.hh:201