34 #include <OgreSceneManager.h>
35 #include <OgreSceneNode.h>
37 #include <OgreQuaternion.h>
38 #include <OgreEntity.h>
39 #include <OgreMaterialManager.h>
40 #include <OgreTextureManager.h>
41 #include <OgreTechnique.h>
51 std::string mesh_name;
55 mesh_name =
"rviz_cone.mesh";
59 mesh_name =
"rviz_cube.mesh";
63 mesh_name =
"rviz_cylinder.mesh";
67 mesh_name =
"rviz_sphere.mesh";
74 return scene_manager->createEntity(name, mesh_name);
77 Shape::Shape(
Type type, Ogre::SceneManager* scene_manager, Ogre::SceneNode* parent_node)
78 :
Object(scene_manager), type_(type)
80 static uint32_t count = 0;
82 ss <<
"Shape" << count++;
98 material_ = Ogre::MaterialManager::getSingleton().create(
99 material_name_, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
101 material_->getTechnique(0)->setLightingEnabled(
true);
102 material_->getTechnique(0)->setAmbient(0.5, 0.5, 0.5);
116 Ogre::MaterialManager::getSingleton().remove(
material_->getName());
121 material_->getTechnique(0)->setAmbient(c * 0.5);
122 material_->getTechnique(0)->setDiffuse(c);
126 material_->getTechnique(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
127 material_->getTechnique(0)->setDepthWriteEnabled(
false);
131 material_->getTechnique(0)->setSceneBlending(Ogre::SBT_REPLACE);
132 material_->getTechnique(0)->setDepthWriteEnabled(
true);
138 setColor(Ogre::ColourValue(r, g, b, a));
174 entity_->getUserObjectBindings().setUserAny(data);
176 ROS_ERROR(
"Shape not yet fully constructed. Cannot set user data. Did you add triangles to the mesh "