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> 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;
148 public:
void SetAmbientColor(
const ignition::math::Color &_color);
152 public: ignition::math::Color AmbientColor()
const;
156 public:
void SetBackgroundColor(
const ignition::math::Color &_color);
160 public: ignition::math::Color BackgroundColor()
const;
166 public:
void CreateGrid(
const uint32_t _cellCount,
167 const float _cellLength,
const ignition::math::Color &_color);
172 public:
Grid *GetGrid(uint32_t _index)
const;
176 public: uint32_t GridCount()
const;
183 public:
CameraPtr CreateCamera(
const std::string &_name,
184 const bool _autoRender =
true);
192 const bool _autoRender =
true);
195 public: OculusCameraPtr CreateOculusCamera(
const std::string &_name);
202 public: uint32_t OculusCameraCount()
const;
210 public:
DepthCameraPtr CreateDepthCamera(
const std::string &_name,
211 const bool _autoRender =
true);
218 public:
GpuLaserPtr CreateGpuLaser(
const std::string &_name,
219 const bool _autoRender =
true);
223 public: uint32_t CameraCount()
const;
229 public:
CameraPtr GetCamera(
const uint32_t _index)
const;
234 public:
CameraPtr GetCamera(
const std::string &_name)
const;
243 public:
UserCameraPtr CreateUserCamera(
const std::string &_name,
244 const bool _stereoEnabled =
false);
248 public: uint32_t UserCameraCount()
const;
255 public:
UserCameraPtr GetUserCamera(
const uint32_t _index)
const;
259 public:
void RemoveCamera(
const std::string &_name);
263 public: uint32_t LightCount()
const;
269 public:
LightPtr GetLight(
const std::string &_name)
const 277 public:
LightPtr GetLight(
const uint32_t _index)
const 283 public:
LightPtr LightByName(
const std::string &_name)
const;
289 public:
LightPtr LightByIndex(
const uint32_t _index)
const;
294 public:
LightPtr LightById(
const uint32_t _id)
const;
299 public:
VisualPtr GetVisual(
const std::string &_name)
const;
304 public:
VisualPtr GetVisual(
const uint32_t _id)
const;
309 public:
void SelectVisual(
const std::string &_name,
310 const std::string &_mode);
319 const ignition::math::Vector2i &_mousePos,
324 public:
void SnapVisualToNearestBelow(
const std::string &_visualName);
332 const ignition::math::Vector2i &_mousePos);
340 const ignition::math::Vector2i &_mousePos);
345 public:
VisualPtr VisualBelow(
const std::string &_visualName);
351 public:
void VisualsBelowPoint(
const ignition::math::Vector3d &_pt,
352 std::vector<VisualPtr> &_visuals);
358 public:
double HeightBelowPoint(
const ignition::math::Vector3d &_pt);
365 public:
bool FirstContact(
CameraPtr _camera,
366 const ignition::math::Vector2i &_mousePos,
367 ignition::math::Vector3d &_position);
370 public:
void PrintSceneGraph();
376 public:
void SetVisible(
const std::string &_name,
const bool _visible);
382 public:
void DrawLine(
const ignition::math::Vector3d &_start,
383 const ignition::math::Vector3d &_end,
384 const std::string &_name);
393 public:
void SetFog(
const std::string &_type,
394 const ignition::math::Color &_color,
395 const double _density,
const double _start,
400 public: uint32_t Id()
const;
404 public: std::string IdString()
const;
408 public:
void SetShadowsEnabled(
const bool _value);
412 public:
bool ShadowsEnabled()
const;
418 public:
bool SetShadowTextureSize(
const unsigned int _size);
422 public:
unsigned int ShadowTextureSize()
const;
430 public:
void RemoveVisual(
VisualPtr _vis);
434 public:
void RemoveVisual(
const uint32_t _id);
441 public:
void SetVisualId(
VisualPtr _vis,
const uint32_t _id);
445 public:
void AddLight(
LightPtr _light);
449 public:
void RemoveLight(
LightPtr _light);
453 public:
void SetGrid(
const bool _enabled);
457 public:
void ShowOrigin(
const bool _show);
466 public: std::string StripSceneName(
const std::string &_name)
const;
475 public:
void SetHeightmapLOD(
const unsigned int _value);
480 public:
unsigned int HeightmapLOD()
const;
485 public:
void SetHeightmapSkirtLength(
const double _value);
490 public:
double HeightmapSkirtLength()
const;
493 public:
void Clear();
498 public:
VisualPtr SelectedVisual()
const;
502 public:
void SetWireframe(
const bool _show);
506 public:
bool Wireframe()
const;
510 public:
void SetTransparent(
const bool _show);
514 public:
void ShowCOMs(
const bool _show);
518 public:
void ShowInertias(
const bool _show);
522 public:
void ShowLinkFrames(
const bool _show);
526 public:
void ShowSkeleton(
const bool _show);
530 public:
void ShowJoints(
const bool _show);
534 public:
void ShowCollisions(
const bool _show);
538 public:
void ShowContacts(
const bool _show);
542 public:
void ShowClouds(
const bool _show);
546 public:
bool ShowClouds()
const;
552 public:
void SetSkyXMode(
const unsigned int _mode);
556 public: SkyX::SkyX *GetSkyX()
const;
560 public:
bool Initialized()
const;
571 public: uint32_t VisualCount()
const;
574 public:
void RemoveProjectors();
580 public:
void ToggleLayer(
const int32_t _layer);
587 public:
bool LayerState(
const int32_t _layer)
const;
593 public:
bool HasLayer(
const int32_t _layer)
const;
599 public:
void EnableVisualizations(
const bool _enable);
604 public:
bool EnableVisualizations()
const;
607 private:
void SetSky();
610 private:
void InitDeferredShading();
618 private: Ogre::Entity *OgreEntityAt(
CameraPtr _camera,
619 const ignition::math::Vector2i &_mousePos,
620 const bool _ignoreSelectionObj);
632 private:
void MeshInformation(
const Ogre::Mesh *_mesh,
633 size_t &_vertexCount,
634 Ogre::Vector3* &_vertices,
637 const ignition::math::Vector3d &_position,
638 const ignition::math::Quaterniond &_orient,
639 const ignition::math::Vector3d &_scale);
644 private:
void PrintSceneGraphHelper(
const std::string &_prefix,
650 private:
void OnScene(ConstScenePtr &_msg);
654 private:
void OnResponse(ConstResponsePtr &_msg);
658 private:
void OnRequest(ConstRequestPtr &_msg);
662 private:
void OnJointMsg(ConstJointPtr &_msg);
666 private:
bool ProcessSensorMsg(ConstSensorPtr &_msg);
670 private:
bool ProcessJointMsg(ConstJointPtr &_msg);
674 private:
bool ProcessLinkMsg(ConstLinkPtr &_msg);
678 private:
bool ProcessSceneMsg(ConstScenePtr &_msg);
682 private:
bool ProcessModelMsg(
const msgs::Model &_msg);
686 private:
void OnSensorMsg(ConstSensorPtr &_msg);
690 private:
void OnVisualMsg(ConstVisualPtr &_msg);
696 private:
bool ProcessVisualMsg(ConstVisualPtr &_msg,
701 private:
void OnLightFactoryMsg(ConstLightPtr &_msg);
705 private:
void OnLightModifyMsg(ConstLightPtr &_msg);
709 private:
bool ProcessLightFactoryMsg(ConstLightPtr &_msg);
713 private:
bool ProcessLightModifyMsg(ConstLightPtr &_msg);
717 private:
void ProcessRequestMsg(ConstRequestPtr &_msg);
721 private:
void OnSkyMsg(ConstSkyPtr &_msg);
725 private:
void OnModelMsg(ConstModelPtr &_msg);
729 private:
void OnPoseMsg(ConstPosesStampedPtr &_msg);
733 private:
void OnSkeletonPoseMsg(ConstPoseAnimationPtr &_msg);
737 private:
void OnRoadMsg(ConstRoadPtr &_msg);
742 private:
void CreateCOMVisual(ConstLinkPtr &_msg,
VisualPtr _linkVisual);
747 private:
void CreateCOMVisual(sdf::ElementPtr _elem,
753 private:
void CreateInertiaVisual(ConstLinkPtr &_msg,
759 private:
void CreateInertiaVisual(sdf::ElementPtr _elem,
765 private:
void CreateLinkFrameVisual(ConstLinkPtr &_msg,
771 private:
void RemoveVisualizations(
VisualPtr _vis);
775 private: std::unique_ptr<ScenePrivate> dataPtr;
boost::shared_ptr< UserCamera > UserCameraPtr
Definition: RenderTypes.hh:94
Forward declarations for the common classes.
Definition: Animation.hh:26
boost::shared_ptr< GpuLaser > GpuLaserPtr
Definition: RenderTypes.hh:106
SkyXMode
Definition: Scene.hh:103
Forward declarations for transport.
Displays a grid of cells, drawn with lines.
Definition: Grid.hh:53
boost::shared_ptr< DepthCamera > DepthCameraPtr
Definition: RenderTypes.hh:98
VisualType
Type of visual.
Definition: Visual.hh:64
Rendering a terrain using heightmap information.
Definition: Heightmap.hh:62
Representation of an entire scene graph.
Definition: Scene.hh:100
Definition: JointMaker.hh:39
#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