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

Generated on 3 Sep 2015 for Hugintrunk by  doxygen 1.4.7