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/Color.hh>
31 #include <ignition/math/Vector2.hh>
32 #include <ignition/math/Vector3.hh>
36 #include "gazebo/gazebo_config.h"
102 public boost::enable_shared_from_this<Scene>
105 GZ_SKYX_ALL = 0x0FFFFFFF,
106 GZ_SKYX_CLOUDS = 0x0000001,
107 GZ_SKYX_MOON = 0x0000002,
119 public:
Scene(
const std::string &_name,
120 const bool _enableVisualizations =
false,
121 const bool _isServer =
false);
124 public:
virtual ~
Scene();
128 public:
void Load(sdf::ElementPtr _scene);
137 public:
void PreRender();
141 public: Ogre::SceneManager *OgreSceneManager()
const;
145 public: std::string Name()
const;
155 public:
void SetAmbientColor(
const ignition::math::Color &_color);
159 public: ignition::math::Color AmbientColor()
const;
169 public:
void SetBackgroundColor(
const ignition::math::Color &_color);
173 public: ignition::math::Color BackgroundColor()
const;
181 public:
void CreateGrid(
const uint32_t _cellCount,
182 const float _cellLength,
const float _lineWidth,
189 public:
void CreateGrid(
const uint32_t _cellCount,
190 const float _cellLength,
const ignition::math::Color &_color);
195 public:
Grid *GetGrid(uint32_t _index)
const;
199 public: uint32_t GridCount()
const;
206 public:
CameraPtr CreateCamera(
const std::string &_name,
207 const bool _autoRender =
true);
215 const bool _autoRender =
true);
218 public: OculusCameraPtr CreateOculusCamera(
const std::string &_name);
225 public: uint32_t OculusCameraCount()
const;
233 public:
DepthCameraPtr CreateDepthCamera(
const std::string &_name,
234 const bool _autoRender =
true);
241 public:
GpuLaserPtr CreateGpuLaser(
const std::string &_name,
242 const bool _autoRender =
true);
246 public: uint32_t CameraCount()
const;
252 public:
CameraPtr GetCamera(
const uint32_t _index)
const;
257 public:
CameraPtr GetCamera(
const std::string &_name)
const;
266 public:
UserCameraPtr CreateUserCamera(
const std::string &_name,
267 const bool _stereoEnabled =
false);
271 public: uint32_t UserCameraCount()
const;
278 public:
UserCameraPtr GetUserCamera(
const uint32_t _index)
const;
282 public:
void RemoveCamera(
const std::string &_name);
287 public:
LightPtr GetLight(
const std::string &_name)
const;
291 public: uint32_t LightCount()
const;
297 public:
LightPtr GetLight(
const uint32_t _index)
const;
302 public:
VisualPtr GetVisual(
const std::string &_name)
const;
307 public:
VisualPtr GetVisual(
const uint32_t _id)
const;
312 public:
void SelectVisual(
const std::string &_name,
313 const std::string &_mode);
322 const ignition::math::Vector2i &_mousePos,
327 public:
void SnapVisualToNearestBelow(
const std::string &_visualName);
335 const ignition::math::Vector2i &_mousePos);
343 const ignition::math::Vector2i &_mousePos);
348 public:
VisualPtr VisualBelow(
const std::string &_visualName);
354 public:
void VisualsBelowPoint(
const ignition::math::Vector3d &_pt,
355 std::vector<VisualPtr> &_visuals);
361 public:
double HeightBelowPoint(
const ignition::math::Vector3d &_pt);
368 public:
bool FirstContact(
CameraPtr _camera,
369 const ignition::math::Vector2i &_mousePos,
370 ignition::math::Vector3d &_position);
373 public:
void PrintSceneGraph();
379 public:
void SetVisible(
const std::string &_name,
const bool _visible);
385 public:
void DrawLine(
const ignition::math::Vector3d &_start,
386 const ignition::math::Vector3d &_end,
387 const std::string &_name);
397 public:
void SetFog(
const std::string &_type,
399 const double _density,
const double _start,
409 public:
void SetFog(
const std::string &_type,
410 const ignition::math::Color &_color,
411 const double _density,
const double _start,
416 public: uint32_t Id()
const;
420 public: std::string IdString()
const;
424 public:
void SetShadowsEnabled(
const bool _value);
428 public:
bool ShadowsEnabled()
const;
434 public:
bool SetShadowTextureSize(
const unsigned int _size);
438 public:
unsigned int ShadowTextureSize()
const;
446 public:
void RemoveVisual(
VisualPtr _vis);
450 public:
void RemoveVisual(
const uint32_t _id);
457 public:
void SetVisualId(
VisualPtr _vis,
const uint32_t _id);
461 public:
void AddLight(
LightPtr _light);
465 public:
void RemoveLight(
LightPtr _light);
469 public:
void SetGrid(
const bool _enabled);
473 public:
void ShowOrigin(
const bool _show);
482 public: std::string StripSceneName(
const std::string &_name)
const;
491 public:
void SetHeightmapLOD(
const unsigned int _value);
496 public:
unsigned int HeightmapLOD()
const;
499 public:
void Clear();
504 public:
VisualPtr SelectedVisual()
const;
508 public:
void SetWireframe(
const bool _show);
512 public:
bool Wireframe()
const;
516 public:
void SetTransparent(
const bool _show);
520 public:
void ShowCOMs(
const bool _show);
524 public:
void ShowInertias(
const bool _show);
528 public:
void ShowLinkFrames(
const bool _show);
532 public:
void ShowSkeleton(
const bool _show);
536 public:
void ShowJoints(
const bool _show);
540 public:
void ShowCollisions(
const bool _show);
544 public:
void ShowContacts(
const bool _show);
548 public:
void ShowClouds(
const bool _show);
552 public:
bool ShowClouds()
const;
558 public:
void SetSkyXMode(
const unsigned int _mode);
562 public: SkyX::SkyX *GetSkyX()
const;
566 public:
bool Initialized()
const;
577 public: uint32_t VisualCount()
const;
580 public:
void RemoveProjectors();
586 public:
void ToggleLayer(
const int32_t _layer);
593 public:
bool LayerState(
const int32_t _layer)
const;
599 public:
bool HasLayer(
const int32_t _layer)
const;
605 public:
void EnableVisualizations(
const bool _enable);
610 public:
bool EnableVisualizations()
const;
613 private:
void SetSky();
616 private:
void InitDeferredShading();
624 private: Ogre::Entity *OgreEntityAt(
CameraPtr _camera,
625 const ignition::math::Vector2i &_mousePos,
626 const bool _ignoreSelectionObj);
638 private:
void MeshInformation(
const Ogre::Mesh *_mesh,
639 size_t &_vertexCount,
640 Ogre::Vector3* &_vertices,
643 const ignition::math::Vector3d &_position,
644 const ignition::math::Quaterniond &_orient,
645 const ignition::math::Vector3d &_scale);
650 private:
void PrintSceneGraphHelper(
const std::string &_prefix,
656 private:
void OnScene(ConstScenePtr &_msg);
660 private:
void OnResponse(ConstResponsePtr &_msg);
664 private:
void OnRequest(ConstRequestPtr &_msg);
668 private:
void OnJointMsg(ConstJointPtr &_msg);
672 private:
bool ProcessSensorMsg(ConstSensorPtr &_msg);
676 private:
bool ProcessJointMsg(ConstJointPtr &_msg);
680 private:
bool ProcessLinkMsg(ConstLinkPtr &_msg);
684 private:
bool ProcessSceneMsg(ConstScenePtr &_msg);
688 private:
bool ProcessModelMsg(
const msgs::Model &_msg);
692 private:
void OnSensorMsg(ConstSensorPtr &_msg);
696 private:
void OnVisualMsg(ConstVisualPtr &_msg);
702 private:
bool ProcessVisualMsg(ConstVisualPtr &_msg,
707 private:
void OnLightFactoryMsg(ConstLightPtr &_msg);
711 private:
void OnLightModifyMsg(ConstLightPtr &_msg);
715 private:
bool ProcessLightFactoryMsg(ConstLightPtr &_msg);
719 private:
bool ProcessLightModifyMsg(ConstLightPtr &_msg);
723 private:
void ProcessRequestMsg(ConstRequestPtr &_msg);
727 private:
void OnSkyMsg(ConstSkyPtr &_msg);
731 private:
void OnModelMsg(ConstModelPtr &_msg);
735 private:
void OnPoseMsg(ConstPosesStampedPtr &_msg);
739 private:
void OnSkeletonPoseMsg(ConstPoseAnimationPtr &_msg);
743 private:
void OnRoadMsg(ConstRoadPtr &_msg);
748 private:
void CreateCOMVisual(ConstLinkPtr &_msg,
VisualPtr _linkVisual);
753 private:
void CreateCOMVisual(sdf::ElementPtr _elem,
759 private:
void CreateInertiaVisual(ConstLinkPtr &_msg,
765 private:
void CreateInertiaVisual(sdf::ElementPtr _elem,
771 private:
void CreateLinkFrameVisual(ConstLinkPtr &_msg,
777 private:
void RemoveVisualizations(
VisualPtr _vis);
781 private: std::unique_ptr<ScenePrivate> dataPtr;
boost::shared_ptr< UserCamera > UserCameraPtr
Definition: RenderTypes.hh:94
boost::shared_ptr< GpuLaser > GpuLaserPtr
Definition: RenderTypes.hh:106
Entity visual.
Definition: Visual.hh:68
SkyXMode
Definition: Scene.hh:104
Forward declarations for transport.
Displays a grid of cells, drawn with lines.
Definition: Grid.hh:58
boost::shared_ptr< DepthCamera > DepthCameraPtr
Definition: RenderTypes.hh:98
VisualType
Type of visual.
Definition: Visual.hh:65
Rendering a terrain using heightmap information.
Definition: Heightmap.hh:62
Representation of an entire scene graph.
Definition: Scene.hh:101
Defines a color.
Definition: Color.hh:36
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:328
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:114
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< WideAngleCamera > WideAngleCameraPtr
Definition: RenderTypes.hh:102
boost::shared_ptr< Light > LightPtr
Definition: RenderTypes.hh:86
boost::shared_ptr< Camera > CameraPtr
Definition: RenderTypes.hh:90
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:44