18 #ifndef _GAZEBO_VISUAL_HH_
19 #define _GAZEBO_VISUAL_HH_
21 #include <boost/enable_shared_from_this.hpp>
22 #include <boost/function.hpp>
33 #include "gazebo/msgs/MessageTypes.hh"
60 public std::enable_shared_from_this<Visual>
89 bool _useRTShader =
true);
97 bool _useRTShader =
true);
100 public:
virtual ~
Visual();
106 public:
virtual void Fini();
116 public:
void LoadFromMsg(ConstVisualPtr &_msg);
120 public:
void Load(sdf::ElementPtr _sdf);
123 public:
virtual void Load();
126 public:
void Update();
134 public: sdf::ElementPtr GetSDF()
const;
138 public:
void SetName(
const std::string &_name);
142 public: std::string GetName()
const;
146 public:
void AttachVisual(
VisualPtr _vis);
150 public:
void DetachVisual(
VisualPtr _vis);
154 public:
void DetachVisual(
const std::string &_name);
158 public:
void AttachObject(Ogre::MovableObject *_obj);
162 public:
bool HasAttachedObject(
const std::string &_name);
166 public:
unsigned int GetAttachedObjectCount()
const;
169 public:
void DetachObjects();
173 public:
unsigned int GetChildCount();
179 public:
VisualPtr GetChild(
unsigned int _index);
188 public: Ogre::MovableObject *AttachMesh(
const std::string &_meshName,
189 const std::string &_subMesh=
"",
190 bool _centerSubmesh =
false,
191 const std::string &_objName=
"");
203 public: ignition::math::Vector3d DerivedScale()
const;
207 public:
bool GetLighting()
const;
211 public:
void SetLighting(
bool _lighting);
219 public:
void SetMaterial(
const std::string &_materialName,
220 bool _unique =
true,
const bool _cascade =
true);
226 const bool _cascade =
true);
232 const bool _cascade =
true);
238 const bool _cascade =
true);
243 public:
virtual void SetEmissive(
const common::Color &_color,
244 const bool _cascade =
true);
264 public:
void SetWireframe(
bool _show);
268 public:
bool Wireframe()
const;
273 private:
void SetTransparencyInnerLoop(Ogre::SceneNode *_sceneNode);
278 public:
void SetTransparency(
float _trans);
282 public:
float GetTransparency();
287 public:
float DerivedTransparency()
const;
291 public:
void SetInheritTransparency(
const bool _inherit);
295 public:
bool InheritTransparency()
const;
300 public:
virtual void SetHighlighted(
bool _highlighted);
305 public:
bool GetHighlighted()
const;
309 public:
bool GetCastShadows()
const;
313 public:
void SetCastShadows(
bool _shadows);
318 public:
virtual void SetVisible(
bool _visible,
bool _cascade =
true);
321 public:
void ToggleVisible();
325 public:
bool GetVisible()
const;
337 public:
void SetPose(
const math::Pose &_pose);
357 public:
void SetWorldPose(
const math::Pose &_pose);
369 public: Ogre::SceneNode *GetSceneNode()
const;
372 public:
void MakeStatic();
376 public:
bool IsStatic()
const;
380 public:
void EnableTrackVisual(
VisualPtr _vis);
383 public:
void DisableTrackVisual();
387 public: std::string GetNormalMap()
const;
391 public:
void SetNormalMap(
const std::string &_nmap);
397 public:
void SetRibbonTrail(
bool _value,
403 public:
math::Box GetBoundingBox()
const;
419 unsigned int _index);
423 public: std::string GetMaterialName()
const;
429 public:
void InsertMesh(
const std::string &_meshName,
430 const std::string &_subMesh =
"",
431 bool _centerSubmesh =
false);
437 public:
static void InsertMesh(
const common::Mesh *_mesh,
438 const std::string &_subMesh =
"",
439 bool _centerSubmesh =
false);
443 public:
void UpdateFromMsg(ConstVisualPtr &_msg);
447 public:
bool IsPlane()
const;
464 public:
VisualPtr GetNthAncestor(
unsigned int _n);
479 public:
unsigned int GetDepth()
const;
484 public: std::string GetShaderType()
const;
489 public:
void SetShaderType(
const std::string &_type);
494 public:
void MoveToPosition(
const math::Pose &_pose,
double _time);
500 public:
void MoveToPositions(
const std::vector<math::Pose> &_pts,
502 boost::function<
void()> _onComplete =
NULL);
509 public:
void SetVisibilityFlags(uint32_t _flags);
516 public: uint32_t GetVisibilityFlags();
519 public:
void ShowBoundingBox();
524 public:
void ShowCollision(
bool _show);
528 public:
void ShowSkeleton(
bool _show);
532 public:
void SetScene(
ScenePtr _scene);
540 public:
void ShowJoints(
bool _show);
544 public:
void ShowCOM(
bool _show);
548 public:
void ShowInertia(
bool _show);
552 public:
void ShowLinkFrame(
bool _show);
556 public:
void SetSkeletonPose(
const msgs::PoseAnimation &_pose);
562 public:
void LoadPlugin(
const std::string &_filename,
563 const std::string &_name,
564 sdf::ElementPtr _sdf);
568 public:
void RemovePlugin(
const std::string &_name);
571 public: uint32_t GetId()
const;
574 public:
void SetId(uint32_t _id);
578 public: std::string GetGeometryType()
const;
582 public: ignition::math::Vector3d GetGeometrySize()
const;
586 public: std::string GetMeshName()
const;
591 public: std::string GetSubMeshName()
const;
594 public:
void ClearParent();
599 public:
void ToggleLayer(
const int32_t _layer);
611 public:
bool UseRTShader()
const;
617 const msgs::Visual::Type &_type);
622 public:
static msgs::Visual::Type ConvertVisualType(
632 protected:
Visual(VisualPrivate &_dataPtr,
633 const std::string &_name,
VisualPtr _parent,
634 bool _useRTShader =
true);
643 protected:
Visual(VisualPrivate &_dataPtr,
644 const std::string &_name,
ScenePtr _scene,
645 bool _useRTShader =
true);
653 private:
void Init(
const std::string &_name,
ScenePtr _scene,
662 private:
void Init(
const std::string &_name,
VisualPtr _parent,
667 private:
void LoadPlugins();
669 private:
void LoadPlugin(sdf::ElementPtr _sdf);
674 private:
void GetBoundsHelper(Ogre::SceneNode *_node,
680 private:
bool GetCenterSubMesh()
const;
684 private:
void DestroyAllAttachedMovableObjects(
685 Ogre::SceneNode *_sceneNode);
690 private:
void UpdateGeomSize(
const ignition::math::Vector3d &_scale);
694 private:
void UpdateTransparency(
const bool _cascade =
true);
A 3D mesh.
Definition: Mesh.hh:44
Class for drawing lines that can change.
Definition: DynamicLines.hh:43
Link visual.
Definition: Visual.hh:70
Encapsulates a position and rotation in three space.
Definition: Pose.hh:37
VisualPrivate * dataPtr
Definition: Visual.hh:698
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
Entity visual.
Definition: Visual.hh:66
Mathematical representation of a box and related functions.
Definition: Box.hh:35
GUI visual.
Definition: Visual.hh:78
A renderable object.
Definition: Visual.hh:59
RenderOpType
Type of render operation for a drawable.
Definition: RenderTypes.hh:206
A strip of connected lines, 1 vertex per line plus 1 start vertex.
Definition: RenderTypes.hh:216
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:80
Model visual.
Definition: Visual.hh:68
VisualType
Type of visual.
Definition: Visual.hh:63
A quaternion class.
Definition: Quaternion.hh:42
#define NULL
Definition: CommonTypes.hh:31
Defines a color.
Definition: Color.hh:36
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:112
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
Visual visual.
Definition: Visual.hh:72
Collision visual.
Definition: Visual.hh:74
Sensor visual.
Definition: Visual.hh:76