All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
gazebo::rendering::Visual Class Reference

A renderable object. More...

#include <rendering/rendering.hh>

Inheritance diagram for gazebo::rendering::Visual:
Inheritance graph
[legend]

Public Member Functions

 Visual (const std::string &_name, VisualPtr _parent, bool _useRTShader=true)
 Constructor.
 
 Visual (const std::string &_name, ScenePtr _scene, bool _useRTShader=true)
 Constructor.
 
virtual ~Visual ()
 Destructor.
 
void AttachAxes ()
 Attach visualization axes.
 
void AttachLineVertex (DynamicLines *_line, unsigned int _index)
 Attach a vertex of a line to the position of the visual.
 
Ogre::MovableObject * AttachMesh (const std::string &_meshName, const std::string &_objName="")
 Attach a mesh to this visual by name.
 
void AttachObject (Ogre::MovableObject *_obj)
 Attach a renerable object to the visual.
 
void AttachVisual (VisualPtr _vis)
 Attach a visual to this visual.
 
void ClearParent ()
 Clear parents.
 
VisualPtr Clone (const std::string &_name, VisualPtr _newParent)
 Clone the visual with a new name.
 
DynamicLinesCreateDynamicLine (RenderOpType _type=RENDERING_LINE_STRIP)
 Add a line to the visual.
 
void DeleteDynamicLine (DynamicLines *_line)
 Delete a dynamic line.
 
void DetachObjects ()
 Detach all objects.
 
void DetachVisual (VisualPtr _vis)
 Detach a visual.
 
void DetachVisual (const std::string &_name)
 Detach a visual.
 
void DisableTrackVisual ()
 Disable tracking of a visual.
 
void EnableTrackVisual (VisualPtr _vis)
 Set one visual to track/follow another.
 
void Fini ()
 Helper for the destructor.
 
unsigned int GetAttachedObjectCount () const
 Return the number of attached movable objects.
 
math::Box GetBoundingBox () const
 Get the bounding box for the visual.
 
VisualPtr GetChild (unsigned int _index)
 Get an attached visual based on an index.
 
unsigned int GetChildCount ()
 Get the number of attached visuals.
 
std::string GetMaterialName () const
 Get the name of the material.
 
std::string GetName () const
 Get the name of the visual.
 
std::string GetNormalMap () const
 Get the normal map.
 
VisualPtr GetParent () const
 Get the parent visual, if one exists.
 
math::Pose GetPose () const
 Get the pose of the visual.
 
math::Vector3 GetPosition () const
 Get the position of the visual.
 
VisualPtr GetRootVisual ()
 Get the root visual.
 
math::Quaternion GetRotation () const
 Get the rotation of the visual.
 
math::Vector3 GetScale ()
 Get the scale.
 
ScenePtr GetScene () const
 Get current.
 
Ogre::SceneNode * GetSceneNode () const
 Return the scene Node of this visual entity.
 
std::string GetShaderType () const
 Get the shader type.
 
float GetTransparency ()
 Get the transparency.
 
uint32_t GetVisibilityFlags ()
 Get visibility flags for this visual and all children.
 
bool GetVisible () const
 Get whether the visual is visible.
 
math::Pose GetWorldPose () const
 Get the global pose of the node.
 
bool HasAttachedObject (const std::string &_name)
 Returns true if an object with _name is attached.
 
void Init ()
 Helper for the contructor.
 
void InsertMesh (const std::string &_meshName)
 Insert a mesh into Ogre.
 
bool IsPlane () const
 Return true if the visual is a plane.
 
bool IsStatic () const
 Return true if the visual is a static geometry.
 
void Load (sdf::ElementPtr _sdf)
 Load the visual with a set of parameters.
 
virtual void Load ()
 Load the visual with default parameters.
 
void LoadFromMsg (ConstVisualPtr &_msg)
 Load from a message.
 
void LoadPlugin (const std::string &_filename, const std::string &_name, sdf::ElementPtr _sdf)
 Load a plugin.
 
void MakeStatic ()
 Make the visual objects static renderables.
 
void MoveToPosition (const math::Pose &_pose, double _time)
 Move to a pose and over a given time.
 
void MoveToPositions (const std::vector< math::Pose > &_pts, double _time, boost::function< void()> _onComplete=NULL)
 Move to a series of pose and over a given time.
 
void RemovePlugin (const std::string &_name)
 Remove a running plugin.
 
void SetAmbient (const common::Color &_color)
 Set the ambient color of the visual.
 
void SetCastShadows (bool _shadows)
 Set whether the visual should cast shadows.
 
void SetDiffuse (const common::Color &_color)
 Set the diffuse color of the visual.
 
virtual void SetEmissive (const common::Color &_color)
 Set the emissive value.
 
void SetHighlighted (bool _highlighted)
 
void SetMaterial (const std::string &_materialName, bool _unique=true)
 Set the material.
 
void SetName (const std::string &_name)
 Set the name of the visual.
 
void SetNormalMap (const std::string &nmap)
 Set the normal map.
 
void SetPose (const math::Pose &_pose)
 Set the pose of the visual.
 
void SetPosition (const math::Vector3 &_pos)
 Set the position of the visual.
 
void SetRibbonTrail (bool _value, const common::Color &_initialColor, const common::Color &_changeColor)
 True on or off a ribbon trail.
 
void SetRotation (const math::Quaternion &_rot)
 Set the rotation of the visual.
 
void SetScale (const math::Vector3 &_scale)
 Set the scale.
 
void SetScene (ScenePtr _scene)
 Set current scene.
 
void SetShaderType (const std::string &_type)
 Set the shader type for the visual's material.
 
void SetSkeletonPose (const msgs::PoseAnimation &_pose)
 Set animation skeleton pose.
 
void SetSpecular (const common::Color &_color)
 Set the specular color of the visual.
 
void SetTransparency (float _trans)
 Set the transparency.
 
void SetVisibilityFlags (uint32_t _flags)
 Set visibility flags for this visual and all children.
 
void SetVisible (bool _visible, bool _cascade=true)
 Set whether the visual is visible.
 
void SetWorldPose (const math::Pose _pose)
 Set the world pose of the visual.
 
void SetWorldPosition (const math::Vector3 &_pos)
 Set the world linear position of the visual.
 
void SetWorldRotation (const math::Quaternion &_rot)
 Set the world orientation of the visual.
 
void ShowBoundingBox ()
 Display the bounding box visual.
 
void ShowCollision (bool _show)
 Display the collision visuals.
 
void ShowCOM (bool _show)
 Display Center of Mass visuals.
 
void ShowJoints (bool _show)
 Display joint visuals.
 
void ShowSkeleton (bool _show)
 Display the skeleton visuals.
 
void ToggleVisible ()
 Toggle whether this visual is visible.
 
void Update ()
 Update the visual.
 
void UpdateFromMsg (ConstVisualPtr &_msg)
 Update a visual based on a message.
 

Static Public Member Functions

static void InsertMesh (const common::Mesh *_mesh)
 Insert a mesh into Ogre.
 

Protected Attributes

VisualPtr parent
 Parent visual.
 
ScenePtr scene
 Pointer to the visual's scene.
 
Ogre::SceneNode * sceneNode
 Pointer to the visual's scene node in Ogre.
 

Detailed Description

A renderable object.

Constructor & Destructor Documentation

gazebo::rendering::Visual::Visual ( const std::string &  _name,
VisualPtr  _parent,
bool  _useRTShader = true 
)

Constructor.

Parameters
[in]_nameName of the visual.
[in]_parentParent of the visual.
[in]_useRTShaderTrue if the visual should use the real-time shader system (RTShader).
gazebo::rendering::Visual::Visual ( const std::string &  _name,
ScenePtr  _scene,
bool  _useRTShader = true 
)

Constructor.

Parameters
[in]_nameName of the visual.
[in]_sceneScene containing the visual.
[in]_useRTShaderTrue if the visual should use the real-time shader system (RTShader).
virtual gazebo::rendering::Visual::~Visual ( )
virtual

Destructor.

Member Function Documentation

void gazebo::rendering::Visual::AttachAxes ( )

Attach visualization axes.

void gazebo::rendering::Visual::AttachLineVertex ( DynamicLines _line,
unsigned int  _index 
)

Attach a vertex of a line to the position of the visual.

Parameters
[in]_lineLine to attach to this visual.
[in]_indexIndex of the line vertex to attach.
Ogre::MovableObject* gazebo::rendering::Visual::AttachMesh ( const std::string &  _meshName,
const std::string &  _objName = "" 
)

Attach a mesh to this visual by name.

Parameters
[in]_meshNameName of the mesh.
[in]_objNameName of the attached Object to put the mesh onto.
void gazebo::rendering::Visual::AttachObject ( Ogre::MovableObject *  _obj)

Attach a renerable object to the visual.

Parameters
[in]_objA movable object to attach to the visual.
void gazebo::rendering::Visual::AttachVisual ( VisualPtr  _vis)

Attach a visual to this visual.

Parameters
[in]_visVisual to attach.
void gazebo::rendering::Visual::ClearParent ( )

Clear parents.

VisualPtr gazebo::rendering::Visual::Clone ( const std::string &  _name,
VisualPtr  _newParent 
)

Clone the visual with a new name.

Parameters
[in]_nameName of the cloned Visual.
[in]_newParentParent of the cloned Visual.
Returns
The visual.
DynamicLines* gazebo::rendering::Visual::CreateDynamicLine ( RenderOpType  _type = RENDERING_LINE_STRIP)

Add a line to the visual.

Parameters
[in]_typeThe type of line to make.
Returns
A pointer to the new dynamic line.
void gazebo::rendering::Visual::DeleteDynamicLine ( DynamicLines _line)

Delete a dynamic line.

Parameters
[in]_linePointer to the line to delete.
void gazebo::rendering::Visual::DetachObjects ( )

Detach all objects.

void gazebo::rendering::Visual::DetachVisual ( VisualPtr  _vis)

Detach a visual.

Parameters
[in]_visVisual to detach.
void gazebo::rendering::Visual::DetachVisual ( const std::string &  _name)

Detach a visual.

Parameters
[in]_nameName of the visual to detach.
void gazebo::rendering::Visual::DisableTrackVisual ( )

Disable tracking of a visual.

void gazebo::rendering::Visual::EnableTrackVisual ( VisualPtr  _vis)

Set one visual to track/follow another.

Parameters
[in]_visVisual to track.
void gazebo::rendering::Visual::Fini ( )

Helper for the destructor.

unsigned int gazebo::rendering::Visual::GetAttachedObjectCount ( ) const

Return the number of attached movable objects.

Returns
The number of attached movable objects.
math::Box gazebo::rendering::Visual::GetBoundingBox ( ) const

Get the bounding box for the visual.

Returns
The bounding box in world coordinates.
VisualPtr gazebo::rendering::Visual::GetChild ( unsigned int  _index)

Get an attached visual based on an index.

Index should be between 0 and Visual::GetChildCount.

Parameters
[in]_indexIndex of the child to retreive.
Returns
Pointer to the child visual, NULL if index is invalid.
unsigned int gazebo::rendering::Visual::GetChildCount ( )

Get the number of attached visuals.

Returns
The number of children.
std::string gazebo::rendering::Visual::GetMaterialName ( ) const

Get the name of the material.

Returns
The name of the visual applied to this visual.
std::string gazebo::rendering::Visual::GetName ( ) const

Get the name of the visual.

Returns
The name of the visual.
std::string gazebo::rendering::Visual::GetNormalMap ( ) const

Get the normal map.

Returns
The name of the normal map material.
VisualPtr gazebo::rendering::Visual::GetParent ( ) const

Get the parent visual, if one exists.

Returns
Pointer to the parent visual, NULL if no parent.
math::Pose gazebo::rendering::Visual::GetPose ( ) const

Get the pose of the visual.

Returns
The Visual's pose.
math::Vector3 gazebo::rendering::Visual::GetPosition ( ) const

Get the position of the visual.

Returns
The visual's position.
VisualPtr gazebo::rendering::Visual::GetRootVisual ( )

Get the root visual.

Returns
The root visual, which is one level below the world visual.
math::Quaternion gazebo::rendering::Visual::GetRotation ( ) const

Get the rotation of the visual.

Returns
The visual's rotation.
math::Vector3 gazebo::rendering::Visual::GetScale ( )

Get the scale.

Returns
The scaling factor.
ScenePtr gazebo::rendering::Visual::GetScene ( ) const

Get current.

Returns
Pointer to the scene.
Ogre::SceneNode* gazebo::rendering::Visual::GetSceneNode ( ) const

Return the scene Node of this visual entity.

Returns
The Ogre scene node.
std::string gazebo::rendering::Visual::GetShaderType ( ) const

Get the shader type.

Returns
String of the shader type: "vertex", "pixel", "normal_map_object_space", "normal_map_tangent_space".
float gazebo::rendering::Visual::GetTransparency ( )

Get the transparency.

Returns
The transparency.
uint32_t gazebo::rendering::Visual::GetVisibilityFlags ( )

Get visibility flags for this visual and all children.

Returns
The visiblity flags.
See Also
GZ_VISIBILITY_ALL
GZ_VISIBILITY_GUI
GZ_VISIBILITY_NOT_SELECTABLE
bool gazebo::rendering::Visual::GetVisible ( ) const

Get whether the visual is visible.

Returns
True if the visual is visible.
math::Pose gazebo::rendering::Visual::GetWorldPose ( ) const

Get the global pose of the node.

Returns
The pose in the world coordinate frame.
bool gazebo::rendering::Visual::HasAttachedObject ( const std::string &  _name)

Returns true if an object with _name is attached.

Parameters
[in]_nameName of an object to find.
void gazebo::rendering::Visual::Init ( )

Helper for the contructor.

void gazebo::rendering::Visual::InsertMesh ( const std::string &  _meshName)

Insert a mesh into Ogre.

Parameters
[in]_meshNameName of the mesh to insert.
static void gazebo::rendering::Visual::InsertMesh ( const common::Mesh _mesh)
static

Insert a mesh into Ogre.

Parameters
[in]_meshPointer to the mesh to insert.
bool gazebo::rendering::Visual::IsPlane ( ) const

Return true if the visual is a plane.

Returns
True if a plane.
bool gazebo::rendering::Visual::IsStatic ( ) const

Return true if the visual is a static geometry.

Returns
True if the visual is static.
void gazebo::rendering::Visual::Load ( sdf::ElementPtr  _sdf)

Load the visual with a set of parameters.

Parameters
[in]_sdfLoad from an SDF element.
virtual void gazebo::rendering::Visual::Load ( )
virtual

Load the visual with default parameters.

Reimplemented in gazebo::rendering::ArrowVisual, and gazebo::rendering::AxisVisual.

void gazebo::rendering::Visual::LoadFromMsg ( ConstVisualPtr &  _msg)

Load from a message.

Parameters
[in]_msgA visual message.
void gazebo::rendering::Visual::LoadPlugin ( const std::string &  _filename,
const std::string &  _name,
sdf::ElementPtr  _sdf 
)

Load a plugin.

Parameters
_filenameThe filename of the plugin
_nameA unique name for the plugin
_sdfThe SDF to pass into the plugin.
void gazebo::rendering::Visual::MakeStatic ( )

Make the visual objects static renderables.

void gazebo::rendering::Visual::MoveToPosition ( const math::Pose _pose,
double  _time 
)

Move to a pose and over a given time.

Parameters
[in]_posePose the visual will end at.
[in]_timeTime it takes the visual to move to the pose.
void gazebo::rendering::Visual::MoveToPositions ( const std::vector< math::Pose > &  _pts,
double  _time,
boost::function< void()>  _onComplete = NULL 
)

Move to a series of pose and over a given time.

Parameters
[in]_posesSeries of poses the visual will move to.
[in]_timeTime it takes the visual to move to the pose.
[in]_onCompleteCallback used when the move is complete.
void gazebo::rendering::Visual::RemovePlugin ( const std::string &  _name)

Remove a running plugin.

Parameters
_nameThe unique name of the plugin to remove
void gazebo::rendering::Visual::SetAmbient ( const common::Color _color)

Set the ambient color of the visual.

Parameters
[in]_colorThe ambient color.
void gazebo::rendering::Visual::SetCastShadows ( bool  _shadows)

Set whether the visual should cast shadows.

Parameters
[in]_shadowsTrue to enable shadows.
void gazebo::rendering::Visual::SetDiffuse ( const common::Color _color)

Set the diffuse color of the visual.

Parameters
[in]_colorSet the diffuse color.
virtual void gazebo::rendering::Visual::SetEmissive ( const common::Color _color)
virtual

Set the emissive value.

Parameters
[in]_colorThe emissive color.

Reimplemented in gazebo::rendering::LaserVisual.

void gazebo::rendering::Visual::SetHighlighted ( bool  _highlighted)
void gazebo::rendering::Visual::SetMaterial ( const std::string &  _materialName,
bool  _unique = true 
)

Set the material.

Parameters
[in]_materialNameThe name of the material.
[in]_uniqueTrue to make the material unique, which allows the material to change without changing materials that originally had the same name.
void gazebo::rendering::Visual::SetName ( const std::string &  _name)

Set the name of the visual.

Parameters
[in]_nameName of the visual
void gazebo::rendering::Visual::SetNormalMap ( const std::string &  nmap)

Set the normal map.

Parameters
[in]_nmapName of the normal map material.
void gazebo::rendering::Visual::SetPose ( const math::Pose _pose)

Set the pose of the visual.

Parameters
[in]_poseThe new pose of the visual.
void gazebo::rendering::Visual::SetPosition ( const math::Vector3 _pos)

Set the position of the visual.

Parameters
[in]_posThe position to set the visual to.
void gazebo::rendering::Visual::SetRibbonTrail ( bool  _value,
const common::Color _initialColor,
const common::Color _changeColor 
)

True on or off a ribbon trail.

Parameters
[in]_valueTrue to enable ribbon trail.
[in]_initialColorThe initial color of the ribbon trail.
[in]_changeColorColor to change too as the trail grows.
void gazebo::rendering::Visual::SetRotation ( const math::Quaternion _rot)

Set the rotation of the visual.

Parameters
[in]_rotThe rotation of the visual.
void gazebo::rendering::Visual::SetScale ( const math::Vector3 _scale)

Set the scale.

Parameters
[in]_scaleThe scaling factor for the visual.
void gazebo::rendering::Visual::SetScene ( ScenePtr  _scene)

Set current scene.

Parameters
[in]_scenePointer to the scene.
void gazebo::rendering::Visual::SetShaderType ( const std::string &  _type)

Set the shader type for the visual's material.

Parameters
[in]_typeShader type string: "vertex", "pixel", "normal_map_object_space", "normal_map_tangent_space".
void gazebo::rendering::Visual::SetSkeletonPose ( const msgs::PoseAnimation &  _pose)

Set animation skeleton pose.

Parameters
[in]_poseSkelton message
void gazebo::rendering::Visual::SetSpecular ( const common::Color _color)

Set the specular color of the visual.

Parameters
[in]_colorSpecular color.
void gazebo::rendering::Visual::SetTransparency ( float  _trans)

Set the transparency.

Parameters
[in]_transThe transparency, between 0 and 1 where 0 is no transparency.
void gazebo::rendering::Visual::SetVisibilityFlags ( uint32_t  _flags)

Set visibility flags for this visual and all children.

Parameters
[in]_flagsThe visiblity flags.
See Also
GZ_VISIBILITY_ALL
GZ_VISIBILITY_GUI
GZ_VISIBILITY_NOT_SELECTABLE
void gazebo::rendering::Visual::SetVisible ( bool  _visible,
bool  _cascade = true 
)

Set whether the visual is visible.

Parameters
[in]_visibleset this node visible.
[in]_cascadesetting this parameter in children too.
void gazebo::rendering::Visual::SetWorldPose ( const math::Pose  _pose)

Set the world pose of the visual.

Parameters
[in]_posePose of the visual in the world coordinate frame.
void gazebo::rendering::Visual::SetWorldPosition ( const math::Vector3 _pos)

Set the world linear position of the visual.

Parameters
[in]_posePosition in the world coordinate frame.
void gazebo::rendering::Visual::SetWorldRotation ( const math::Quaternion _rot)

Set the world orientation of the visual.

Parameters
[in]_rotRotation in the world coordinate frame.
void gazebo::rendering::Visual::ShowBoundingBox ( )

Display the bounding box visual.

void gazebo::rendering::Visual::ShowCollision ( bool  _show)

Display the collision visuals.

Parameters
[in]_showTrue to show visuals labeled as collision objects.
void gazebo::rendering::Visual::ShowCOM ( bool  _show)

Display Center of Mass visuals.

Parameters
[in]_showTrue to show center of mass visualizations.
void gazebo::rendering::Visual::ShowJoints ( bool  _show)

Display joint visuals.

Parameters
[in]_showTrue to show joint visualizations.
void gazebo::rendering::Visual::ShowSkeleton ( bool  _show)

Display the skeleton visuals.

Parameters
[in]_showTrue to show skeleton visuals.
void gazebo::rendering::Visual::ToggleVisible ( )

Toggle whether this visual is visible.

void gazebo::rendering::Visual::Update ( )

Update the visual.

void gazebo::rendering::Visual::UpdateFromMsg ( ConstVisualPtr &  _msg)

Update a visual based on a message.

Parameters
[in]_msgThe visual message.

Member Data Documentation

VisualPtr gazebo::rendering::Visual::parent
protected

Parent visual.

ScenePtr gazebo::rendering::Visual::scene
protected

Pointer to the visual's scene.

Ogre::SceneNode* gazebo::rendering::Visual::sceneNode
protected

Pointer to the visual's scene node in Ogre.


The documentation for this class was generated from the following file: