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

Generated on 10 Dec 2016 for Hugintrunk by  doxygen 1.4.7