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 ogre_tools 00019 { 00020 00032 class QtOgreRenderWindow : public RenderWidget { 00033 public: 00037 QtOgreRenderWindow( RenderSystem* render_system, QWidget* parent = 0 ); 00038 00043 virtual void setPreRenderCallback( boost::function<void ()> func ); 00048 virtual void setPostRenderCallback( boost::function<void ()> func ); 00049 00054 virtual QSize sizeHint () const { return QSize( 320, 240 ); } 00055 00062 Ogre::Viewport* getViewport() const; 00063 00066 void setCamera( Ogre::Camera* camera ); 00067 00072 void setOrthoScale( float scale ); 00073 00074 void setAutoRender(bool auto_render) { auto_render_ = auto_render; } 00075 00078 void setOverlaysEnabled( bool overlays_enabled ); 00079 void setBackgroundColor( Ogre::ColourValue color ); 00080 00081 protected: 00082 virtual void showEvent(QShowEvent *e); 00083 virtual void paintEvent( QPaintEvent* e ); 00084 virtual void resizeEvent( QResizeEvent* event ); 00085 00087 // virtual bool Reparent(wxWindowBase* new_parent); 00088 00092 void setCameraAspectRatio(); 00093 00094 Ogre::Viewport* viewport_; 00095 00096 Ogre::Root* ogre_root_; 00097 00098 boost::function<void ()> pre_render_callback_; 00099 boost::function<void ()> post_render_callback_; 00100 00101 float ortho_scale_; 00102 bool auto_render_; 00103 00104 Ogre::Camera* camera_; 00105 bool overlays_enabled_; 00106 Ogre::ColourValue background_color_; 00107 }; 00108 00109 } // namespace ogre_tools 00110 00111 #endif // QT_OGRE_RENDER_WINDOW_OGRE_RENDER_WINDOW_H_