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     static size_t m_view_state_observer;
00074 
00075     void SetActive(bool active) {this->active = active;}
00076     bool IsActive() {return active;}
00077 
00078 #if defined __WXGTK__ || wxCHECK_VERSION(2,9,0)
00079     wxGLContext * GetContext() {return m_glContext;}
00080 #endif
00081 
00082     void SetViewerBackground(wxColour col);
00083 
00084 protected:
00085     void OnEraseBackground(wxEraseEvent& e);
00086     void MouseMotion(wxMouseEvent& e);
00087     void MouseEnter(wxMouseEvent & e);
00088     void MouseLeave(wxMouseEvent & e);
00089     void MouseButtons(wxMouseEvent& e);
00090     void MouseWheel(wxMouseEvent& e);
00091     void KeyDown(wxKeyEvent & e);
00092     void KeyUp(wxKeyEvent & e);
00093 
00094     DECLARE_EVENT_TABLE()
00095 
00096     ToolHelper *m_tool_helper;
00097     GLRenderer *m_renderer;
00098 #if defined __WXGTK__ || wxCHECK_VERSION(2,9,0)
00099     wxGLContext *m_glContext;
00100 #endif
00101     HuginBase::Panorama  * m_pano;
00102 
00103     virtual void setUp() = 0;
00104 
00105     bool started_creation, redrawing, m_toolsInitialized;
00106     static bool initialised_glew;
00107     vigra::Diff2D offset;
00108     GLPreviewFrame *frame;
00109 
00110     bool active;
00111 
00112     wxColour m_background_color;
00113 };
00114 
00115 class GLPreview : public GLViewer
00116 {
00117 public:
00118     GLPreview(
00119             wxWindow* parent, 
00120             HuginBase::Panorama &pano,
00121             int args[], 
00122             GLPreviewFrame *frame,
00123             wxGLContext * shared_context = NULL
00124             ) : GLViewer(parent, pano, args, frame, shared_context) {}
00125     void setUp();
00126 
00127 };
00128 
00129 class GLOverview : public GLViewer
00130 {
00131 public:
00132     GLOverview(
00133             wxWindow* parent, 
00134             HuginBase::Panorama &pano,
00135             int args[], 
00136             GLPreviewFrame *frame,
00137             wxGLContext * shared_context = NULL
00138             ) : GLViewer(parent, pano, args, frame, shared_context) {
00139         panosphere_m_renderer = 0;
00140         plane_m_renderer = 0;
00141     }
00142     ~GLOverview();
00143 
00144     void SetPanosphereMode();
00145     void SetPlaneMode();
00146     
00147     void setUp();
00148 
00149     virtual void SetLayoutMode(bool state);
00150     virtual void SetLayoutScale(double scale);
00151 
00152     enum OverviewMode {
00153         PANOSPHERE,
00154         PLANE
00155     };
00156 
00157     void SetMode(OverviewMode mode);
00158     OverviewMode GetMode() {return mode;}
00159 
00160 protected:
00161 
00162     OverviewMode mode;
00163 
00164     PanosphereOverviewVisualizationState * panosphere_m_visualization_state;
00165     PanosphereOverviewToolHelper * panosphere_m_tool_helper;
00166     GLPanosphereOverviewRenderer * panosphere_m_renderer;
00167     
00168     PlaneOverviewVisualizationState * plane_m_visualization_state;
00169     PlaneOverviewToolHelper * plane_m_tool_helper;
00170     GLPlaneOverviewRenderer * plane_m_renderer;
00171 
00172 };
00173 
00174 #endif

Generated on 29 May 2016 for Hugintrunk by  doxygen 1.4.7