30 #include <boost/bind.hpp> 32 #include <OgreManualObject.h> 33 #include <OgreMaterialManager.h> 34 #include <OgreRectangle2D.h> 35 #include <OgreRenderSystem.h> 36 #include <OgreRenderWindow.h> 38 #include <OgreSceneManager.h> 39 #include <OgreSceneNode.h> 40 #include <OgreTextureManager.h> 41 #include <OgreViewport.h> 42 #include <OgreTechnique.h> 43 #include <OgreCamera.h> 64 "If set to true, will try to estimate the range of possible values from the received images.",
81 static uint32_t count = 0;
83 ss <<
"ImageDisplay" << count++;
84 img_scene_manager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC, ss.str());
92 ss <<
"ImageDisplayObject" << count++;
95 screen_rect_->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY - 1);
99 material_ = Ogre::MaterialManager::getSingleton().create( ss.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );
100 material_->setSceneBlending( Ogre::SBT_REPLACE );
105 material_->getTechnique(0)->setLightingEnabled(
false);
106 Ogre::TextureUnitState* tu =
material_->getTechnique(0)->getPass(0)->createTextureUnitState();
108 tu->setTextureFiltering( Ogre::TFO_NONE );
110 material_->setCullingMode(Ogre::CULL_NONE);
111 Ogre::AxisAlignedBox aabInf;
112 aabInf.setInfinite();
203 if ( img_width != 0 && img_height != 0 && win_width !=0 && win_height != 0 )
205 float img_aspect = img_width / img_height;
206 float win_aspect = win_width / win_height;
208 if ( img_aspect > win_aspect )
210 screen_rect_->setCorners(-1.0
f, 1.0
f * win_aspect/img_aspect, 1.0
f, -1.0
f * win_aspect/img_aspect,
false);
214 screen_rect_->setCorners(-1.0
f * img_aspect/win_aspect, 1.0
f, 1.0
f * img_aspect/win_aspect, -1.0
f,
false);
const Ogre::TexturePtr & getTexture()
RenderPanel * render_panel_
virtual void reset()
Reset display.
void initialize(Ogre::SceneManager *scene_manager, DisplayContext *manager)
DisplayContext * context_
This DisplayContext pointer is the main connection a Display has into the rest of rviz...
BoolProperty * normalize_property_
FloatProperty * max_property_
void setAutoRender(bool auto_render)
virtual int getInt() const
Return the internal property value as an integer.
virtual float getFloat() const
virtual void unsubscribe()
Ogre::Rectangle2D * screen_rect_
Ogre::SceneManager * img_scene_manager_
Property specialized to enforce floating point max/min.
Property specialized to provide max/min enforcement for integers.
void setNormalizeFloatImage(bool normalize, double min=0.0, double max=1.0)
virtual bool getBool() const
void setMedianFrames(unsigned median_frames)
virtual void update(float wall_dt, float ros_dt)
Called periodically by the visualization manager.
virtual void onDisable()
Derived classes override this to do the actual work of disabling themselves.
virtual void subscribe()
ROS topic management.
virtual void onEnable()
Derived classes override this to do the actual work of enabling themselves.
Display subclass for subscribing and displaying to image messages.
void addMessage(const sensor_msgs::Image::ConstPtr &image)
const std::string TYPE_32FC1
void setAssociatedWidget(QWidget *widget)
Associate the given widget with this Display.
IntProperty * median_buffer_size_property_
const std::string TYPE_16UC1
FloatProperty * min_property_
TFSIMD_FORCE_INLINE Vector3 & normalize()
virtual void onInitialize()
Override this function to do subclass-specific initialization.
virtual void setHidden(bool hidden)
Hide or show this property in any PropertyTreeWidget viewing its parent.
virtual void reset()
Reset display.
Ogre::SceneNode * img_scene_node_
Ogre::Camera * getCamera() const
virtual void onInitialize()
Override this function to do subclass-specific initialization.
virtual void processMessage(const sensor_msgs::Image::ConstPtr &msg)
Implement this to process the contents of a message.
Ogre::MaterialPtr material_
bool initialized() const
Returns true if the display has been initialized.
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
BoolProperty(const QString &name=QString(), bool default_value=false, const QString &description=QString(), Property *parent=0, const char *changed_slot=0, QObject *receiver=0)
virtual void setStatus(StatusProperty::Level level, const QString &name, const QString &text)
Show status level and text. This is thread-safe.
void setOverlaysEnabled(bool overlays_enabled)
virtual void updateNormalizeOptions()
const std::string TYPE_16SC1