23 #include "wx/msw/wrapwin.h"
26 #include "hugin_config.h"
27 #if defined HAVE_EPOXY && HAVE_EPOXY
30 #include <OpenGL/glu.h>
37 #include <OpenGL/gl.h>
38 #include <OpenGL/glu.h>
45 #include <GLUT/glut.h>
58 dirty_meshes(true), preview(viewer),
59 display_list_number_canvas(glGenLists(1)),
60 display_list_number_crop(glGenLists(1)),
61 display_list_number_canvas_outline(glGenLists(1)),
62 display_list_number_crop_outline(glGenLists(1))
81 Rec(
double left,
double top,
double right,
double bottom) : left(left), top(top), right(right), bottom(bottom) {}
125 GLUquadric* grid = gluNewQuadric();
126 gluSphere(grid, radius+1,40,20);
140 double end = 1000000;
142 glVertex3f(-end, end, 0);
143 glVertex3f( end, end, 0);
144 glVertex3f( end,-end, 0);
145 glVertex3f(-end,-end, 0);
179 DrawRect(rect.left(), rect.top(), rect.right(), rect.bottom(),
false);
182 DrawRect(rect.left(), rect.top(), rect.right(), rect.bottom(),
true, 4.0);
187 DrawRect(roi.left(), roi.top(), roi.right(), roi.bottom(),
false);
190 DrawRect(roi.left(), roi.top(), roi.right(), roi.bottom(),
true, 2.0);
203 DrawRect(rect.left(), rect.top(), rect.right(), rect.bottom(),
true, 4.0);
208 DrawRect(roi.left(), roi.top(), roi.right(), roi.bottom(),
true, 2.0);
214 glDisable(GL_TEXTURE_2D);
217 glColor4f(0, 0, 0, 0.50f);
218 glBlendFunc(GL_ZERO, GL_SRC_ALPHA);
222 glColor4f(1.0f, 1.0f, 1.0f, 0.20f);
223 glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA);
228 glColor4f(1.0f, 1.0f, 1.0f, 0.66f);
229 glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA);
232 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
233 glColor4f(0.8f, 0.8f, 0.8f, 0.5f);
235 glColor4f(0.8f, 0.8f, 0.8f, 0.6f);
238 glEnable(GL_TEXTURE_2D);
248 double mlength = (size->y > size->x) ? size->y : size->x;
254 double tres =
res * mlength / fov;
255 double tmindist =
mindist * mlength / fov;
279 DEBUG_ERROR(
"OverviewOutlinesTools: unknown projection")
305 double wstep = (float)(right - left) / steps;
306 double hstep = (float)(bottom - top) / steps;
308 for(
int w = 0 ; w < steps ; w++) {
309 for(
int h = 0 ;
h < steps ;
h++) {
313 if (!(w == 0 ||
h == 0 || w == steps - 1 || steps - 1)) {
318 Rect rec(left + w * wstep, top +
h * hstep, left + (w+1) * wstep, top + (
h+1)* hstep);
341 bool edges[4] = {
false,
false,
false,
false};
345 if (w == steps - 1) {
351 if (
h == steps - 1) {
354 for (
int i = 0 ; i < 4 ; i++) {
360 if (plus == 4) plus = 0;
395 glBegin(GL_LINE_LOOP);
399 for (
int s = 0 ; s < 4 ; s++) {
408 glVertex3f(coord.
x,coord.
y,coord.
z);
436 std::vector<Rec> stack;
438 stack.push_back(
Rec(left,top,right,bottom));
441 stack.push_back(
Rec(
true,
true,
true,
true));
444 while(!stack.empty()) {
448 edge = stack[stack.size() - 1];
452 Rec top_rec = stack[stack.size() - 1];
465 double edge1 = (tr.
val[0][0]-tr.
val[1][0])*(tr.
val[0][0]-tr.
val[1][0]) + (tr.
val[0][1]-tr.
val[1][1])*(tr.
val[0][1]-tr.
val[1][1]);
466 double edge2 = (tr.
val[1][0]-tr.
val[2][0])*(tr.
val[1][0]-tr.
val[2][0]) + (tr.
val[1][1]-tr.
val[2][1])*(tr.
val[1][1]-tr.
val[2][1]);
467 double edge3 = (tr.
val[2][0]-tr.
val[3][0])*(tr.
val[2][0]-tr.
val[3][0]) + (tr.
val[2][1]-tr.
val[3][1])*(tr.
val[2][1]-tr.
val[3][1]);
468 double edge4 = (tr.
val[3][0]-tr.
val[0][0])*(tr.
val[3][0]-tr.
val[0][0]) + (tr.
val[3][1]-tr.
val[0][1])*(tr.
val[3][1]-tr.
val[0][1]);
478 double ressq = tres * tres;
480 bool divide_ver =
false;
481 bool divide_hor =
false;
485 (edge1 > ressq || edge3 > ressq)
487 std::abs(top_rec.
top - top_rec.
bottom) > tmindist
493 (edge2 > ressq || edge4 > ressq)
495 std::abs(top_rec.
left - top_rec.
right) > tmindist
527 if (!(divide_ver || divide_hor)) {
534 edges[0] = edge.
left!=0;
535 edges[1] = edge.
bottom!=0;
536 edges[2] = edge.
right!=0;
537 edges[3] = edge.
top!=0;
538 for (
int i = 0 ; i < 4 ; i++) {
544 if (plus == 4) plus = 0;
579 glBegin(GL_LINE_LOOP);
583 for (
int s = 0 ; s < 4 ; s++) {
592 glVertex3f(coord.
x,coord.
y,coord.
z);
PanoramaOptions::ProjectionFormat getProjection() const
void doGL(double width, VisualizationState *state, LineSegment *preceding=NULL, LineSegment *proceeding=NULL) const
Draw a meshed line.
void ForceRequireRedraw()
HuginBase::PanoramaOptions * GetOptions()
const vigra::Rect2D & getROI() const
MeshManager * GetMeshManager()
vigra::Rect2D GetVisibleArea()
Declare GreatCircles class.
virtual MeshInfo::Coord3D GetCoord3D(hugin_utils::FDiff2D &)=0
VisualizationState * m_visualization_state
bool RequireRecalculateViewport()
hugin_utils::FDiff2D vertices[2]
void addObserver(PanoramaObserver *o)
add a panorama observer.
virtual HuginBase::PanoramaOptions * GetOptions()
Rec(double left, double top, double right, double bottom)
void setSize(vigra::Size2D val)
Set the image size in pixels.
ProjectionFormat
Projection of final panorama.
All variables of a source image.
vigra::Size2D getSize() const
get size of output image
a class to handle a 3D point
A wxWidget to display the fast preview.