Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PreviewPanoMaskTool.cpp
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
22 #ifdef _WIN32
23 #include "wx/msw/wrapwin.h"
24 #endif
25 #include <wx/platform.h>
26 #include "PreviewPanoMaskTool.h"
27 #ifdef __WXMAC__
28 #include <OpenGL/gl.h>
29 #else
30 #include <GL/gl.h>
31 #endif
32 
34  : PreviewTool(helper)
35 {
36 }
37 
39 {
40  // we draw to the sentcil buffer the desired shape, and enable the stencil
41  // test before the images are rendered. After they have all been drawn, we
42  // turn off stenciling so the other tools can draw of the complete area.
44 }
45 
47 {
48 }
49 
51 {
53  {
56  glColor3f(0.0, 0.0, 0.0);
57  {
58  // Under a sinusodial projection, we mask off the sides.
60  GetProjectionInfo();
61  double x, y;
62  glBegin(GL_QUAD_STRIP);
63  for (double p = -90; p < 90; p += 1.0)
64  {
65  info->AngularToImage(x, y, -180.0, p);
66  glVertex2d(x, y); glVertex2d(0.0, y);
67  }
68  glEnd();
69  double width = helper->GetViewStatePtr()->GetOptions()->
70  getSize().width();
71  glBegin(GL_QUAD_STRIP);
72  for (double p = -90; p < 90; p += 1.0)
73  {
74  info->AngularToImage(x, y, -180.0, p);
75  glVertex2d(width - x, y); glVertex2d(width, y);
76  }
77  glEnd();
78  }
79  glEnable(GL_TEXTURE_2D);
80  glColor3f(1.0, 1.0, 1.0);
81  break;
83  // Under a albers equal area conic projection, we mask a circle
84  // segment with a hole in the middle. The dimensions and centre
85  // are depended on the projection parameters.
87  glColor3f(0.0, 0.0, 0.0);
88  glStencilFunc(GL_EQUAL, 1, 1);
89  glEnable(GL_TEXTURE_2D);
90  glColor3f(1.0, 1.0, 1.0);
91  break;
92  default:
93  // most projections don't need any of this.
94  // Always pass the stencil test.
95  glStencilFunc(GL_ALWAYS, 1, 1);
96  break;
97  }
98 }
99 
PanoramaOptions::ProjectionFormat getProjection() const
implementation of huginApp Class
ViewState * GetViewStatePtr()
Definition: ToolHelper.cpp:305
void DisableTexture(bool maskOnly=false)
void ReallyAfterDrawImagesEvent()
Draw (using OpenGL) the overlays, e.g. crop highlights, guides.
void NotifyMe(Event event, Tool *tool)
Definition: ToolHelper.cpp:315
HuginBase::PanoramaOptions * GetOptions()
Definition: ViewState.cpp:273
options getSize().area()) int wxCALLBACK SortFieldOfViewAscending(wxIntPtr item1
ToolHelper * helper
The PreviewToolHelper that uses the same preview window and panorama as the tool should.
Definition: Tool.h:102
void Activate()
Switch on a tool.
void BeforeDrawImagesEvent()
Draw using OpenGL anything the tool requires underneath the images.
bool AngularToImage(double &image_x, double &image_y, double yaw, double pitch)
TextureManager * GetTextureManager()
Definition: ViewState.h:104
PreviewPanoMaskTool(PreviewToolHelper *helper)
static void info(const char *fmt,...)
Definition: svm.cpp:95