40 #include <OgreSceneManager.h> 41 #include <OgreSubEntity.h> 42 #include <OgreMaterialManager.h> 43 #include <OgreTextureManager.h> 44 #include <OgreTechnique.h> 46 #include <OgreFrameListener.h> 52 MeshNode(
rviz::DisplayContext* displayContext, Ogre::SceneNode* parentNode,
const std::string& meshResource, Ogre::Vector3 position = Ogre::Vector3::ZERO)
64 static int counter = 0;
65 ss <<
"gender_symbol_" << counter++;
66 std::string
id = ss.str();
73 Ogre::MaterialPtr default_material = Ogre::MaterialManager::getSingleton().create( ss.str(),
"rviz" );
74 default_material->setReceiveShadows(
false);
75 default_material->getTechnique(0)->setLightingEnabled(
true);
76 default_material->getTechnique(0)->setAmbient( 0.5, 0.5, 0.5 );
78 m_entity->setMaterial( default_material );
84 Ogre::Root::getSingleton().addFrameListener(
this);
88 Ogre::Root::getSingleton().removeFrameListener(
this);
92 std::set<Ogre::MaterialPtr>::iterator it;
95 Ogre::MaterialPtr material = *it;
96 if (!material.isNull())
99 Ogre::MaterialManager::getSingleton().remove(material->getName());
115 m_sceneNode->setScale(Ogre::Vector3(scaleFactor, scaleFactor, scaleFactor));
127 Ogre::SceneBlendType blending;
132 blending = Ogre::SBT_TRANSPARENT_ALPHA;
137 blending = Ogre::SBT_REPLACE;
141 std::set<Ogre::MaterialPtr>::iterator it;
144 Ogre::Technique* technique = (*it)->getTechnique( 0 );
146 technique->setAmbient( c.r*0.5, c.g*0.5, c.b*0.5 );
147 technique->setDiffuse( c.r, c.g, c.b, c.a );
148 technique->setSceneBlending( blending );
149 technique->setDepthWriteEnabled( depth_write );
150 technique->setLightingEnabled(
true );
163 Ogre::Quaternion cameraQuat;
168 assert(visualizationManager !=
NULL);
189 #endif // MESH_NODE_H
void setPosition(const Ogre::Vector3 &position)
Ogre::Quaternion m_orientation
void setOrientation(const Ogre::Quaternion &orientation)
MeshNode(rviz::DisplayContext *displayContext, Ogre::SceneNode *parentNode, const std::string &meshResource, Ogre::Vector3 position=Ogre::Vector3::ZERO)
std::string m_meshResource
Ogre::MeshPtr loadMeshFromResource(const std::string &resource_path)
RenderPanel * getRenderPanel() const
void setColor(const Ogre::ColourValue &c)
void setVisible(bool visible)
std::set< Ogre::MaterialPtr > m_materials
void setScale(const float scaleFactor)
const std::string & getMeshResource() const
Ogre::Camera * getCamera() const
virtual bool frameStarted(const Ogre::FrameEvent &evt)
Ogre::SceneManager * m_sceneManager
Ogre::SceneNode * m_sceneNode
rviz::DisplayContext * m_displayContext
void setCameraFacing(bool cameraFacing)