00001 #ifndef QT_OGRE_RENDER_WINDOW_OGRE_RENDER_WINDOW_H_ 00002 #define QT_OGRE_RENDER_WINDOW_OGRE_RENDER_WINDOW_H_ 00003 00004 #include <boost/function.hpp> 00005 00006 #include "render_widget.h" 00007 00008 #include <OGRE/OgreColourValue.h> 00009 00010 namespace Ogre 00011 { 00012 class Root; 00013 class RenderWindow; 00014 class Viewport; 00015 class Camera; 00016 } 00017 00018 namespace rviz 00019 { 00020 00026 class QtOgreRenderWindow : public RenderWidget { 00027 public: 00031 QtOgreRenderWindow( QWidget* parent = 0 ); 00032 00037 virtual void setPreRenderCallback( boost::function<void ()> func ); 00042 virtual void setPostRenderCallback( boost::function<void ()> func ); 00043 00048 virtual QSize sizeHint () const { return QSize( 320, 240 ); } 00049 00056 Ogre::Viewport* getViewport() const; 00057 00060 void setCamera( Ogre::Camera* camera ); 00061 00066 void setOrthoScale( float scale ); 00067 00068 void setAutoRender(bool auto_render) { auto_render_ = auto_render; } 00069 00072 void setOverlaysEnabled( bool overlays_enabled ); 00073 void setBackgroundColor( Ogre::ColourValue color ); 00074 00075 protected: 00076 virtual void paintEvent( QPaintEvent* e ); 00077 virtual void resizeEvent( QResizeEvent* event ); 00078 00082 void setCameraAspectRatio(); 00083 00084 Ogre::Viewport* viewport_; 00085 00086 Ogre::Root* ogre_root_; 00087 00088 boost::function<void ()> pre_render_callback_; 00089 boost::function<void ()> post_render_callback_; 00090 00091 float ortho_scale_; 00092 bool auto_render_; 00093 00094 Ogre::Camera* camera_; 00095 bool overlays_enabled_; 00096 Ogre::ColourValue background_color_; 00097 }; 00098 00099 } // namespace rviz 00100 00101 #endif // QT_OGRE_RENDER_WINDOW_OGRE_RENDER_WINDOW_H_