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 
94  wxGLContext *m_glContext;
96 
97  virtual void setUp() = 0;
98 
100  static bool initialised_glew;
101  vigra::Diff2D offset;
102  double m_scale = 1.0;
104 
105  bool active;
106 
108 };
109 
110 class GLPreview : public GLViewer
111 {
112 public:
114  wxWindow* parent,
115  HuginBase::Panorama &pano,
116  int args[],
118  wxGLContext * shared_context = NULL
119  ) : GLViewer(parent, pano, args, frame, shared_context) {}
120  void setUp();
121 
122 };
123 
124 class GLOverview : public GLViewer
125 {
126 public:
128  wxWindow* parent,
129  HuginBase::Panorama &pano,
130  int args[],
132  wxGLContext * shared_context = NULL
133  ) : GLViewer(parent, pano, args, frame, shared_context) {
135  plane_m_renderer = 0;
136  }
137  ~GLOverview();
138 
139  void setUp();
140 
141  virtual void SetLayoutMode(bool state);
142  virtual void SetLayoutScale(double scale);
143 
148  };
149 
150  void SetMode(OverviewMode mode);
152 
153 protected:
154 
156 
160 
164 
165 };
166 
167 #endif
static size_t m_view_state_observer
Definition: GLViewer.h:73
void MouseButtons(wxMouseEvent &e)
Definition: GLViewer.cpp:445
implementation of huginApp Class
void MouseLeave(wxMouseEvent &e)
Definition: GLViewer.cpp:439
wxGLContext * GetContext()
Definition: GLViewer.h:78
The OpenGL preview frame.
void setUp()
Definition: GLViewer.cpp:236
void KeyDown(wxKeyEvent &e)
Definition: GLViewer.cpp:468
GLPreviewFrame * frame
Definition: GLViewer.h:103
PanosphereOverviewVisualizationState * panosphere_m_visualization_state
Definition: GLViewer.h:157
GLOverview(wxWindow *parent, HuginBase::Panorama &pano, int args[], GLPreviewFrame *frame, wxGLContext *shared_context=NULL)
Definition: GLViewer.h:127
virtual void SetLayoutScale(double scale)
Definition: GLViewer.cpp:301
void SetPhotometricCorrect(bool state)
Definition: GLViewer.cpp:289
void SetActive(bool active)
Definition: GLViewer.h:75
PlaneOverviewToolHelper * plane_m_tool_helper
Definition: GLViewer.h:162
void Resized(wxSizeEvent &e)
Definition: GLViewer.cpp:356
void MarkToolsDirty()
Definition: GLViewer.cpp:480
void setUp()
Definition: GLViewer.cpp:190
HuginBase::Panorama * m_pano
Definition: GLViewer.h:95
void MouseMotion(wxMouseEvent &e)
Definition: GLViewer.cpp:425
bool redrawing
Definition: GLViewer.h:99
wxGLContext * m_glContext
Definition: GLViewer.h:94
void KeyUp(wxKeyEvent &e)
Definition: GLViewer.cpp:474
static void RefreshWrapper(void *obj)
Definition: GLViewer.cpp:349
GLPlaneOverviewRenderer * plane_m_renderer
Definition: GLViewer.h:163
static bool initialised_glew
Definition: GLViewer.h:100
virtual void setUp()=0
void OnEraseBackground(wxEraseEvent &e)
Definition: GLViewer.cpp:420
void SetMode(OverviewMode mode)
Definition: GLViewer.cpp:492
Model for a panorama.
Definition: Panorama.h:152
PlaneOverviewVisualizationState * plane_m_visualization_state
Definition: GLViewer.h:161
GLViewer(wxWindow *parent, HuginBase::Panorama &pano, int args[], GLPreviewFrame *frame, wxGLContext *shared_context=NULL)
Definition: GLViewer.cpp:55
subclass for the plane overview mode
Definition: GLRenderer.h:118
void MouseEnter(wxMouseEvent &e)
Definition: GLViewer.cpp:432
The renderer handles drawing the opengl scene.
Definition: GLRenderer.h:47
bool started_creation
Definition: GLViewer.h:99
GLPreview(wxWindow *parent, HuginBase::Panorama &pano, int args[], GLPreviewFrame *frame, wxGLContext *shared_context=NULL)
Definition: GLViewer.h:113
OverviewMode GetMode()
Definition: GLViewer.h:151
virtual void SetLayoutMode(bool state)
Definition: GLViewer.cpp:295
bool IsActive()
Definition: GLViewer.h:76
VisualizationState * m_visualization_state
Definition: GLViewer.h:71
PanosphereOverviewToolHelper * panosphere_m_tool_helper
Definition: GLViewer.h:158
subclass for the panosphere overview mode
Definition: GLRenderer.h:101
virtual void SetLayoutScale(double scale)
Definition: GLViewer.cpp:314
GLRenderer * m_renderer
Definition: GLViewer.h:93
virtual ~GLViewer()
Definition: GLViewer.cpp:103
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:102
virtual void SetLayoutMode(bool state)
Definition: GLViewer.cpp:307
void Redraw()
Definition: GLViewer.cpp:385
bool m_toolsInitialized
Definition: GLViewer.h:99
void SetViewerBackground(wxColour col)
Definition: GLViewer.cpp:485
GLPanosphereOverviewRenderer * panosphere_m_renderer
Definition: GLViewer.h:159
bool active
Definition: GLViewer.h:105
ToolHelper * m_tool_helper
Definition: GLViewer.h:92
static ViewState * m_view_state
Definition: GLViewer.h:72
void RedrawE(wxPaintEvent &e)
Definition: GLViewer.cpp:322
void SetUpContext()
Definition: GLViewer.cpp:122
wxColour m_background_color
Definition: GLViewer.h:107
void MouseWheel(wxMouseEvent &e)
Definition: GLViewer.cpp:460
A wxWidget to display the fast preview.
Definition: GLViewer.h:51
OverviewMode mode
Definition: GLViewer.h:155
vigra::Diff2D offset
Definition: GLViewer.h:101