39 #include <OgreSceneNode.h> 40 #include <OgreMatrix3.h> 45 :
MarkerBase(owner, context, parent_node), shape_(nullptr)
56 if (!
shape_ || old_message->type != new_message->type)
62 switch (new_message->type)
64 case visualization_msgs::Marker::CUBE:
67 case visualization_msgs::Marker::CYLINDER:
70 case visualization_msgs::Marker::SPHERE:
84 Ogre::Vector3 pos, scale, scale_correct;
85 Ogre::Quaternion orient;
86 if (!
transform(new_message, pos, orient, scale))
90 setOrientation(orient * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3(1, 0, 0)));
92 scale_correct = Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3(1, 0, 0)) * scale;
96 shape_->
setColor(new_message->color.r, new_message->color.g, new_message->color.b,
97 new_message->color.a);
Ogre::SceneNode * scene_node_
bool transform(const MarkerConstPtr &message, Ogre::Vector3 &pos, Ogre::Quaternion &orient, Ogre::Vector3 &scale)
void setScale(const Ogre::Vector3 &scale) override
Set the scale of the object. Always relative to the identity orientation of the object.
virtual void setPosition(const Ogre::Vector3 &position)
void setColor(float r, float g, float b, float a) override
Set the color of the object. Values are in the range [0, 1].
ShapeMarker(MarkerDisplay *owner, DisplayContext *context, Ogre::SceneNode *parent_node)
void extractMaterials(Ogre::Entity *entity, S_MaterialPtr &materials)
S_MaterialPtr getMaterials() override
std::pair< std::string, int32_t > MarkerID
Pure-virtual base class for objects which give Display subclasses context in which to work...
boost::shared_ptr< MarkerSelectionHandler > handler_
DisplayContext * context_
visualization_msgs::Marker::ConstPtr MarkerConstPtr
virtual Ogre::SceneManager * getSceneManager() const =0
Returns the Ogre::SceneManager used for the main RenderPanel.
std::set< Ogre::MaterialPtr > S_MaterialPtr
virtual void setOrientation(const Ogre::Quaternion &orientation)
Ogre::SceneNode * getRootNode()
Get the root scene node (pivot node) for this object.
Displays "markers" sent in by other ROS nodes on the "visualization_marker" topic.
Ogre::Entity * getEntity()
void onNewMessage(const MarkerConstPtr &old_message, const MarkerConstPtr &new_message) override