42 #include <OgreRenderWindow.h> 43 #include <OgreSceneManager.h> 44 #include <OgreViewport.h> 45 #include <OgreRectangle2D.h> 46 #include <OgreMaterial.h> 47 #include <OgreMaterialManager.h> 48 #include <OgreTextureUnitState.h> 49 #include <OgreSharedPtr.h> 50 #include <OgreTechnique.h> 51 #include <OgreSceneNode.h> 72 QtOgreRenderWindow::showEvent( event );
81 if( resolved_image ==
"/image" )
83 ROS_WARN(
"image topic has not been remapped");
86 std::stringstream title;
87 title <<
"rviz Image Viewer [" << resolved_image <<
"]";
88 setWindowTitle( QString::fromStdString( title.str() ));
102 ROS_ERROR(
"%s", (std::string(
"Error subscribing: ") + e.what()).c_str());
105 Ogre::MaterialPtr material =
106 Ogre::MaterialManager::getSingleton().create(
"Material",
107 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );
108 material->setCullingMode(Ogre::CULL_NONE);
109 material->getTechnique(0)->getPass(0)->setDepthWriteEnabled(
true);
110 material->getTechnique(0)->setLightingEnabled(
false);
111 Ogre::TextureUnitState* tu = material->getTechnique(0)->getPass(0)->createTextureUnitState();
113 tu->setTextureFiltering( Ogre::TFO_NONE );
115 Ogre::Rectangle2D* rect =
new Ogre::Rectangle2D(
true);
116 rect->setCorners(-1.0
f, 1.0
f, 1.0
f, -1.0
f);
117 rect->setMaterial(material->getName());
118 rect->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY - 1);
119 Ogre::AxisAlignedBox aabb;
121 rect->setBoundingBox(aabb);
123 Ogre::SceneNode* node =
scene_manager_->getRootSceneNode()->createChildSceneNode();
124 node->attachObject(rect);
125 node->setVisible(
true);
127 QTimer* timer =
new QTimer(
this );
128 connect( timer, SIGNAL( timeout() ),
this, SLOT(
onTimer() ));
136 static bool first =
true;
const Ogre::TexturePtr & getTexture()
void initializeResources(const V_string &resource_paths)
std::string resolveName(const std::string &name, bool remap=true) const
void setAutoRender(bool auto_render)
void textureCallback(const sensor_msgs::Image::ConstPtr &msg)
std::vector< std::string > V_string
boost::shared_ptr< image_transport::SubscriberFilter > texture_sub_
void addMessage(const sensor_msgs::Image::ConstPtr &image)
void showEvent(QShowEvent *event)
ROSLIB_DECL std::string getPath(const std::string &package_name)
ROSImageTexture * texture_
ImageView(QWidget *parent=0)
ROSCPP_DECL void spinOnce()
void setCamera(Ogre::Camera *camera)
Ogre::SceneManager * scene_manager_
image_transport::ImageTransport texture_it_