GLViewer.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00023 #ifndef _GL_VIEWER_H
00024 #define _GL_VIEWER_H
00025 
00026 #include "ViewState.h"
00027 #include "base_wx/platform.h"
00028 #include <wx/glcanvas.h>
00029 #include <utility>
00030 #include <vigra/diff2d.hxx>
00031 
00032 class GLRenderer;
00033 class GLPanosphereOverviewRenderer;
00034 class GLPlaneOverviewRenderer;
00035 class TextureManager;
00036 class MeshManager;
00037 class ToolHelper;
00038 class PreviewToolHelper;
00039 class OverviewToolHelper;
00040 class PanosphereOverviewToolHelper;
00041 class PlaneOverviewToolHelper;
00042 class GLPreviewFrame;
00043 
00044 
00045 
00046 
00051 class GLViewer: public wxGLCanvas
00052 {
00053 public:
00054     GLViewer(
00055             wxWindow* parent, 
00056             HuginBase::Panorama &pano, 
00057             int args[], 
00058             GLPreviewFrame *frame,
00059             wxGLContext * shared_context = NULL
00060             );
00061     virtual ~GLViewer();
00062     void RedrawE(wxPaintEvent& e);
00063     void Resized(wxSizeEvent& e);
00064     void Redraw();
00065     static void RefreshWrapper(void *obj);
00066     void SetUpContext();
00067     void SetPhotometricCorrect(bool state);
00068     virtual void SetLayoutMode(bool state);
00069     virtual void SetLayoutScale(double scale);
00070     
00071     VisualizationState * m_visualization_state;
00072     static ViewState * m_view_state;
00073 
00074     void SetActive(bool active) {this->active = active;}
00075     bool IsActive() {return active;}
00076 
00077 #if defined __WXGTK__ || wxCHECK_VERSION(2,9,0)
00078     wxGLContext * GetContext() {return m_glContext;}
00079 #endif
00080 
00081     void SetViewerBackground(wxColour col);
00082 
00083 protected:
00084     void OnEraseBackground(wxEraseEvent& e);
00085     void MouseMotion(wxMouseEvent& e);
00086     void MouseEnter(wxMouseEvent & e);
00087     void MouseLeave(wxMouseEvent & e);
00088     void MouseButtons(wxMouseEvent& e);
00089     void MouseWheel(wxMouseEvent& e);
00090     void KeyDown(wxKeyEvent & e);
00091     void KeyUp(wxKeyEvent & e);
00092 
00093     DECLARE_EVENT_TABLE()
00094 
00095     ToolHelper *m_tool_helper;
00096     GLRenderer *m_renderer;
00097 #if defined __WXGTK__ || wxCHECK_VERSION(2,9,0)
00098     wxGLContext *m_glContext;
00099 #endif
00100     HuginBase::Panorama  * m_pano;
00101 
00102     virtual void setUp() = 0;
00103 
00104     bool started_creation, redrawing;
00105     static bool initialised_glew;
00106     vigra::Diff2D offset;
00107     GLPreviewFrame *frame;
00108 
00109     bool active;
00110 
00111     wxColour m_background_color;
00112 };
00113 
00114 class GLPreview : public GLViewer
00115 {
00116 public:
00117     GLPreview(
00118             wxWindow* parent, 
00119             HuginBase::Panorama &pano,
00120             int args[], 
00121             GLPreviewFrame *frame,
00122             wxGLContext * shared_context = NULL
00123             ) : GLViewer(parent, pano, args, frame, shared_context) {}
00124     void setUp();
00125 
00126 };
00127 
00128 class GLOverview : public GLViewer
00129 {
00130 public:
00131     GLOverview(
00132             wxWindow* parent, 
00133             HuginBase::Panorama &pano,
00134             int args[], 
00135             GLPreviewFrame *frame,
00136             wxGLContext * shared_context = NULL
00137             ) : GLViewer(parent, pano, args, frame, shared_context) {
00138         panosphere_m_renderer = 0;
00139         plane_m_renderer = 0;
00140     }
00141 
00142     void SetPanosphereMode();
00143     void SetPlaneMode();
00144     
00145     void setUp();
00146 
00147     virtual void SetLayoutMode(bool state);
00148     virtual void SetLayoutScale(double scale);
00149 
00150     enum OverviewMode {
00151         PANOSPHERE,
00152         PLANE
00153     };
00154 
00155     void SetMode(OverviewMode mode);
00156     OverviewMode GetMode() {return mode;}
00157 
00158 protected:
00159 
00160     OverviewMode mode;
00161 
00162     PanosphereOverviewVisualizationState * panosphere_m_visualization_state;
00163     PanosphereOverviewToolHelper * panosphere_m_tool_helper;
00164     GLPanosphereOverviewRenderer * panosphere_m_renderer;
00165     
00166     PlaneOverviewVisualizationState * plane_m_visualization_state;
00167     PlaneOverviewToolHelper * plane_m_tool_helper;
00168     GLPlaneOverviewRenderer * plane_m_renderer;
00169 
00170 };
00171 
00172 #endif

Generated on 8 Feb 2016 for Hugintrunk by  doxygen 1.4.7