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"
101 public boost::enable_shared_from_this<Scene>
104 GZ_SKYX_ALL = 0x0FFFFFFF,
105 GZ_SKYX_CLOUDS = 0x0000001,
106 GZ_SKYX_MOON = 0x0000002,
118 public:
Scene(
const std::string &_name,
119 const bool _enableVisualizations =
false,
120 const bool _isServer =
false);
123 public:
virtual ~
Scene();
127 public:
void Load(sdf::ElementPtr _scene);
136 public:
void PreRender();
140 public: Ogre::SceneManager *OgreSceneManager()
const;
144 public: std::string Name()
const;
156 public:
void SetBackgroundColor(
const common::Color &_color);
167 public:
void CreateGrid(
const uint32_t _cellCount,
168 const float _cellLength,
const float _lineWidth,
174 public:
Grid *GetGrid(uint32_t _index)
const;
178 public: uint32_t GridCount()
const;
185 public:
CameraPtr CreateCamera(
const std::string &_name,
186 const bool _autoRender =
true);
194 const bool _autoRender =
true);
197 public: OculusCameraPtr CreateOculusCamera(
const std::string &_name);
204 public: uint32_t OculusCameraCount()
const;
212 public:
DepthCameraPtr CreateDepthCamera(
const std::string &_name,
213 const bool _autoRender =
true);
220 public:
GpuLaserPtr CreateGpuLaser(
const std::string &_name,
221 const bool _autoRender =
true);
225 public: uint32_t CameraCount()
const;
231 public:
CameraPtr GetCamera(
const uint32_t _index)
const;
236 public:
CameraPtr GetCamera(
const std::string &_name)
const;
245 public:
UserCameraPtr CreateUserCamera(
const std::string &_name,
246 const bool _stereoEnabled =
false);
250 public: uint32_t UserCameraCount()
const;
257 public:
UserCameraPtr GetUserCamera(
const uint32_t _index)
const;
261 public:
void RemoveCamera(
const std::string &_name);
266 public:
LightPtr GetLight(
const std::string &_name)
const;
270 public: uint32_t LightCount()
const;
276 public:
LightPtr GetLight(
const uint32_t _index)
const;
281 public:
VisualPtr GetVisual(
const std::string &_name)
const;
286 public:
VisualPtr GetVisual(
const uint32_t _id)
const;
291 public:
void SelectVisual(
const std::string &_name,
292 const std::string &_mode);
301 const ignition::math::Vector2i &_mousePos,
306 public:
void SnapVisualToNearestBelow(
const std::string &_visualName);
314 const ignition::math::Vector2i &_mousePos);
322 const ignition::math::Vector2i &_mousePos);
327 public:
VisualPtr VisualBelow(
const std::string &_visualName);
333 public:
void VisualsBelowPoint(
const ignition::math::Vector3d &_pt,
334 std::vector<VisualPtr> &_visuals);
340 public:
double HeightBelowPoint(
const ignition::math::Vector3d &_pt);
347 public:
bool FirstContact(
CameraPtr _camera,
348 const ignition::math::Vector2i &_mousePos,
349 ignition::math::Vector3d &_position);
352 public:
void PrintSceneGraph();
358 public:
void SetVisible(
const std::string &_name,
const bool _visible);
364 public:
void DrawLine(
const ignition::math::Vector3d &_start,
365 const ignition::math::Vector3d &_end,
366 const std::string &_name);
375 public:
void SetFog(
const std::string &_type,
377 const double _density,
const double _start,
382 public: uint32_t Id()
const;
386 public: std::string IdString()
const;
390 public:
void SetShadowsEnabled(
const bool _value);
394 public:
bool ShadowsEnabled()
const;
400 public:
bool SetShadowTextureSize(
const unsigned int _size);
404 public:
unsigned int ShadowTextureSize()
const;
412 public:
void RemoveVisual(
VisualPtr _vis);
416 public:
void RemoveVisual(
const uint32_t _id);
423 public:
void SetVisualId(
VisualPtr _vis,
const uint32_t _id);
427 public:
void AddLight(
LightPtr _light);
431 public:
void RemoveLight(
LightPtr _light);
435 public:
void SetGrid(
const bool _enabled);
439 public:
void ShowOrigin(
const bool _show);
448 public: std::string StripSceneName(
const std::string &_name)
const;
457 public:
void SetHeightmapLOD(
const unsigned int _value);
462 public:
unsigned int HeightmapLOD()
const;
465 public:
void Clear();
470 public:
VisualPtr SelectedVisual()
const;
474 public:
void SetWireframe(
const bool _show);
478 public:
bool Wireframe()
const;
482 public:
void SetTransparent(
const bool _show);
486 public:
void ShowCOMs(
const bool _show);
490 public:
void ShowInertias(
const bool _show);
494 public:
void ShowLinkFrames(
const bool _show);
498 public:
void ShowSkeleton(
const bool _show);
502 public:
void ShowJoints(
const bool _show);
506 public:
void ShowCollisions(
const bool _show);
510 public:
void ShowContacts(
const bool _show);
514 public:
void ShowClouds(
const bool _show);
518 public:
bool ShowClouds()
const;
524 public:
void SetSkyXMode(
const unsigned int _mode);
528 public: SkyX::SkyX *GetSkyX()
const;
532 public:
bool Initialized()
const;
543 public: uint32_t VisualCount()
const;
546 public:
void RemoveProjectors();
552 public:
void ToggleLayer(
const int32_t _layer);
559 public:
bool LayerState(
const int32_t _layer)
const;
565 public:
bool HasLayer(
const int32_t _layer)
const;
571 public:
void EnableVisualizations(
const bool _enable);
576 public:
bool EnableVisualizations()
const;
579 private:
void SetSky();
582 private:
void InitDeferredShading();
590 private: Ogre::Entity *OgreEntityAt(
CameraPtr _camera,
591 const ignition::math::Vector2i &_mousePos,
592 const bool _ignoreSelectionObj);
604 private:
void MeshInformation(
const Ogre::Mesh *_mesh,
605 size_t &_vertexCount,
606 Ogre::Vector3* &_vertices,
609 const ignition::math::Vector3d &_position,
610 const ignition::math::Quaterniond &_orient,
611 const ignition::math::Vector3d &_scale);
616 private:
void PrintSceneGraphHelper(
const std::string &_prefix,
622 private:
void OnScene(ConstScenePtr &_msg);
626 private:
void OnResponse(ConstResponsePtr &_msg);
630 private:
void OnRequest(ConstRequestPtr &_msg);
634 private:
void OnJointMsg(ConstJointPtr &_msg);
638 private:
bool ProcessSensorMsg(ConstSensorPtr &_msg);
642 private:
bool ProcessJointMsg(ConstJointPtr &_msg);
646 private:
bool ProcessLinkMsg(ConstLinkPtr &_msg);
650 private:
bool ProcessSceneMsg(ConstScenePtr &_msg);
654 private:
bool ProcessModelMsg(
const msgs::Model &_msg);
658 private:
void OnSensorMsg(ConstSensorPtr &_msg);
662 private:
void OnVisualMsg(ConstVisualPtr &_msg);
668 private:
bool ProcessVisualMsg(ConstVisualPtr &_msg,
673 private:
void OnLightFactoryMsg(ConstLightPtr &_msg);
677 private:
void OnLightModifyMsg(ConstLightPtr &_msg);
681 private:
bool ProcessLightFactoryMsg(ConstLightPtr &_msg);
685 private:
bool ProcessLightModifyMsg(ConstLightPtr &_msg);
689 private:
void ProcessRequestMsg(ConstRequestPtr &_msg);
693 private:
void OnSkyMsg(ConstSkyPtr &_msg);
697 private:
void OnModelMsg(ConstModelPtr &_msg);
701 private:
void OnPoseMsg(ConstPosesStampedPtr &_msg);
705 private:
void OnSkeletonPoseMsg(ConstPoseAnimationPtr &_msg);
709 private:
void OnRoadMsg(ConstRoadPtr &_msg);
714 private:
void CreateCOMVisual(ConstLinkPtr &_msg,
VisualPtr _linkVisual);
719 private:
void CreateCOMVisual(sdf::ElementPtr _elem,
725 private:
void CreateInertiaVisual(ConstLinkPtr &_msg,
731 private:
void CreateInertiaVisual(sdf::ElementPtr _elem,
737 private:
void CreateLinkFrameVisual(ConstLinkPtr &_msg,
743 private:
void RemoveVisualizations(
VisualPtr _vis);
747 private: std::unique_ptr<ScenePrivate> dataPtr;
boost::shared_ptr< UserCamera > UserCameraPtr
Definition: RenderTypes.hh:93
boost::shared_ptr< GpuLaser > GpuLaserPtr
Definition: RenderTypes.hh:105
Entity visual.
Definition: Visual.hh:71
SkyXMode
Definition: Scene.hh:103
Forward declarations for transport.
Displays a grid of cells, drawn with lines.
Definition: Grid.hh:56
boost::shared_ptr< DepthCamera > DepthCameraPtr
Definition: RenderTypes.hh:97
VisualType
Type of visual.
Definition: Visual.hh:68
Rendering a terrain using heightmap information.
Definition: Heightmap.hh:62
Representation of an entire scene graph.
Definition: Scene.hh:100
Defines a color.
Definition: Color.hh:36
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:113
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< WideAngleCamera > WideAngleCameraPtr
Definition: RenderTypes.hh:101
boost::shared_ptr< Light > LightPtr
Definition: RenderTypes.hh:85
boost::shared_ptr< Camera > CameraPtr
Definition: RenderTypes.hh:89
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:44