control.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _WX_OGRE_CONTROL_H_
00021 #define _WX_OGRE_CONTROL_H_
00022
00023 #include <Ogre.h>
00024 #include <wx/wx.h>
00025
00035 class wxOgreControl : public wxControl
00036 {
00037 DECLARE_DYNAMIC_CLASS(wxOgreControl)
00038 DECLARE_EVENT_TABLE()
00039
00040 public:
00041
00043 wxOgreControl();
00044
00046 wxOgreControl(wxWindow* parent, wxWindowID id = wxID_ANY,
00047 const wxPoint& pos = wxDefaultPosition,
00048 const wxSize& size = wxDefaultSize,
00049 long style = wxSUNKEN_BORDER | wxTRANSPARENT_WINDOW,
00050 const wxValidator& val = wxDefaultValidator,
00051 const wxString& name = wxT("OgreControl"));
00052
00062 virtual ~wxOgreControl();
00063
00065 virtual bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
00066 const wxPoint& pos = wxDefaultPosition,
00067 const wxSize& size = wxDefaultSize,
00068 long style = wxSUNKEN_BORDER | wxTRANSPARENT_WINDOW,
00069 const wxValidator& val = wxDefaultValidator,
00070 const wxString& name = wxT("OgreControl"));
00071
00073 virtual bool Destroy();
00074
00076 virtual void Update();
00077
00082 virtual wxSize DoGetBestSize() const { return wxSize(320, 240); }
00083
00084
00089 virtual Ogre::SceneManager* CreateSceneManager(const Ogre::String& tn,
00090 const Ogre::String& name="");
00091
00096 virtual Ogre::SceneManager* CreateSceneManager(Ogre::SceneTypeMask tm,
00097 const Ogre::String& name="");
00098
00107 virtual void SetSceneManager(Ogre::SceneManager* sm);
00108
00116 virtual void SetCamera(Ogre::Camera* cam);
00117
00125 virtual void RotateCamera(float relX, float relY, float relZ);
00126
00132 virtual void TranslateCamera(float x, float y, float z);
00133
00138 virtual void SetPolygonMode(const Ogre::PolygonMode& pm);
00139
00152 virtual void ProcessSelection(const wxPoint& pt);
00153
00155 Ogre::Camera* GetCamera() const { return m_cam; }
00156
00158 Ogre::RenderWindow* GetRenderWindow() const { return m_rwin; }
00159
00161 Ogre::Viewport* GetViewport() const { return m_vp; }
00162
00167 void AddViewport(Ogre::Camera* cam, int ZOrder=0, float left=0.0f,
00168 float top=0.0f, float width=1.0f, float height=1.0f);
00169
00174 void DestroyRenderWindow();
00175
00176 protected:
00177
00178 virtual void OnSize(wxSizeEvent& event);
00179 virtual void OnPaint(wxPaintEvent& event);
00180 virtual void OnMouseMove(wxMouseEvent& event);
00181 virtual void OnEraseBackground(wxEraseEvent& event);
00182
00183 Ogre::SceneManager* m_sm;
00184 Ogre::Camera* m_cam;
00185
00186 private:
00187
00189 virtual void Init();
00190
00195 Ogre::RenderWindow* CreateRenderWindow(const Ogre::String& name);
00196
00207 void GetParentWindowHandle(Ogre::NameValuePairList& pl);
00208
00209
00210 Ogre::Root* m_root;
00211 Ogre::RenderWindow* m_rwin;
00212 Ogre::Viewport* m_vp;
00213
00214
00216 long m_x;
00218 long m_y;
00219
00221 static unsigned int m_instances;
00222 };
00223
00224 #endif