Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GLViewer.h
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
23 #ifndef _GL_VIEWER_H
24 #define _GL_VIEWER_H
25 
26 #include "ViewState.h"
27 #include "base_wx/platform.h"
28 #include <wx/glcanvas.h>
29 #include <utility>
30 #include <vigra/diff2d.hxx>
31 
32 class GLRenderer;
35 class TextureManager;
36 class MeshManager;
37 class ToolHelper;
38 class PreviewToolHelper;
39 class OverviewToolHelper;
42 class GLPreviewFrame;
43 
44 
45 
46 
51 class GLViewer: public wxGLCanvas
52 {
53 public:
54  GLViewer(
55  wxWindow* parent,
56  HuginBase::Panorama &pano,
57  int args[],
59  wxGLContext * shared_context = NULL
60  );
61  virtual ~GLViewer();
62  void RedrawE(wxPaintEvent& e);
63  void Resized(wxSizeEvent& e);
64  void Redraw();
65  static void RefreshWrapper(void *obj);
66  void SetUpContext();
67  void SetPhotometricCorrect(bool state);
68  virtual void SetLayoutMode(bool state);
69  virtual void SetLayoutScale(double scale);
70 
73  static size_t m_view_state_observer;
74 
75  void SetActive(bool active) {this->active = active;}
76  bool IsActive() {return active;}
77 
78  wxGLContext * GetContext() {return m_glContext;}
79 
80  void SetViewerBackground(wxColour col);
81  void MarkToolsDirty();
82 protected:
83  void OnEraseBackground(wxEraseEvent& e);
84  void MouseMotion(wxMouseEvent& e);
85  void MouseEnter(wxMouseEvent & e);
86  void MouseLeave(wxMouseEvent & e);
87  void MouseButtons(wxMouseEvent& e);
88  void MouseWheel(wxMouseEvent& e);
89  void KeyDown(wxKeyEvent & e);
90  void KeyUp(wxKeyEvent & e);
91 
92  DECLARE_EVENT_TABLE()
93 
96  wxGLContext *m_glContext;
97  HuginBase::Panorama * m_pano;
98 
99  virtual void setUp() = 0;
100 
102  static bool initialised_glew;
103  vigra::Diff2D offset;
104  double m_scale = 1.0;
106 
107  bool active;
108 
110 };
111 
112 class GLPreview : public GLViewer
113 {
114 public:
116  wxWindow* parent,
117  HuginBase::Panorama &pano,
118  int args[],
119  GLPreviewFrame *frame,
120  wxGLContext * shared_context = NULL
121  ) : GLViewer(parent, pano, args, frame, shared_context) {}
122  void setUp();
123 
124 };
125 
126 class GLOverview : public GLViewer
127 {
128 public:
130  wxWindow* parent,
131  HuginBase::Panorama &pano,
132  int args[],
133  GLPreviewFrame *frame,
134  wxGLContext * shared_context = NULL
135  ) : GLViewer(parent, pano, args, frame, shared_context) {
136  panosphere_m_renderer = 0;
137  plane_m_renderer = 0;
138  }
139  ~GLOverview();
140 
141  void setUp();
142 
143  virtual void SetLayoutMode(bool state);
144  virtual void SetLayoutScale(double scale);
145 
149  PLANE
150  };
151 
152  void SetMode(OverviewMode mode);
153  OverviewMode GetMode() {return mode;}
154 
155 protected:
156 
158 
162 
166 
167 };
168 
169 #endif
static size_t m_view_state_observer
Definition: GLViewer.h:73
void MouseButtons(wxMouseEvent &e)
Definition: GLViewer.cpp:444
implementation of huginApp Class
void MouseLeave(wxMouseEvent &e)
Definition: GLViewer.cpp:438
wxGLContext * GetContext()
Definition: GLViewer.h:78
The OpenGL preview frame.
void KeyDown(wxKeyEvent &e)
Definition: GLViewer.cpp:467
GLPreviewFrame * frame
Definition: GLViewer.h:105
PanosphereOverviewVisualizationState * panosphere_m_visualization_state
Definition: GLViewer.h:159
GLOverview(wxWindow *parent, HuginBase::Panorama &pano, int args[], GLPreviewFrame *frame, wxGLContext *shared_context=NULL)
Definition: GLViewer.h:129
virtual void SetLayoutScale(double scale)
Definition: GLViewer.cpp:300
void SetPhotometricCorrect(bool state)
Definition: GLViewer.cpp:288
void SetActive(bool active)
Definition: GLViewer.h:75
PlaneOverviewToolHelper * plane_m_tool_helper
Definition: GLViewer.h:164
void Resized(wxSizeEvent &e)
Definition: GLViewer.cpp:355
void MarkToolsDirty()
Definition: GLViewer.cpp:479
HuginBase::Panorama * m_pano
Definition: GLViewer.h:97
void MouseMotion(wxMouseEvent &e)
Definition: GLViewer.cpp:424
bool redrawing
Definition: GLViewer.h:101
wxGLContext * m_glContext
Definition: GLViewer.h:96
void KeyUp(wxKeyEvent &e)
Definition: GLViewer.cpp:473
static void RefreshWrapper(void *obj)
Definition: GLViewer.cpp:348
GLPlaneOverviewRenderer * plane_m_renderer
Definition: GLViewer.h:165
static bool initialised_glew
Definition: GLViewer.h:102
virtual void setUp()=0
void OnEraseBackground(wxEraseEvent &e)
Definition: GLViewer.cpp:419
Model for a panorama.
Definition: Panorama.h:152
PlaneOverviewVisualizationState * plane_m_visualization_state
Definition: GLViewer.h:163
GLViewer(wxWindow *parent, HuginBase::Panorama &pano, int args[], GLPreviewFrame *frame, wxGLContext *shared_context=NULL)
Definition: GLViewer.cpp:73
subclass for the plane overview mode
Definition: GLRenderer.h:118
void MouseEnter(wxMouseEvent &e)
Definition: GLViewer.cpp:431
The renderer handles drawing the opengl scene.
Definition: GLRenderer.h:47
bool started_creation
Definition: GLViewer.h:101
GLPreview(wxWindow *parent, HuginBase::Panorama &pano, int args[], GLPreviewFrame *frame, wxGLContext *shared_context=NULL)
Definition: GLViewer.h:115
OverviewMode GetMode()
Definition: GLViewer.h:153
virtual void SetLayoutMode(bool state)
Definition: GLViewer.cpp:294
bool IsActive()
Definition: GLViewer.h:76
VisualizationState * m_visualization_state
Definition: GLViewer.h:71
PanosphereOverviewToolHelper * panosphere_m_tool_helper
Definition: GLViewer.h:160
subclass for the panosphere overview mode
Definition: GLRenderer.h:101
GLRenderer * m_renderer
Definition: GLViewer.h:95
virtual ~GLViewer()
Definition: GLViewer.cpp:102
A MeshManager handles the graphics system representation of a remapping, by creating OpenGL display l...
Definition: MeshManager.h:37
double m_scale
Definition: GLViewer.h:104
void Redraw()
Definition: GLViewer.cpp:384
bool m_toolsInitialized
Definition: GLViewer.h:101
void SetViewerBackground(wxColour col)
Definition: GLViewer.cpp:484
GLPanosphereOverviewRenderer * panosphere_m_renderer
Definition: GLViewer.h:161
bool active
Definition: GLViewer.h:107
ToolHelper * m_tool_helper
Definition: GLViewer.h:94
static ViewState * m_view_state
Definition: GLViewer.h:72
void RedrawE(wxPaintEvent &e)
Definition: GLViewer.cpp:321
void SetUpContext()
Definition: GLViewer.cpp:121
wxColour m_background_color
Definition: GLViewer.h:109
void MouseWheel(wxMouseEvent &e)
Definition: GLViewer.cpp:459
A wxWidget to display the fast preview.
Definition: GLViewer.h:51
OverviewMode mode
Definition: GLViewer.h:157
vigra::Diff2D offset
Definition: GLViewer.h:103