1
/****************************************************************************
3
* A versatile mesh processing toolbox o o *
5
* Copyright(C) 2005 \/)\/ *
6
* Visual Computing Lab /\/| *
7
* ISTI - Italian National Research Council | *
9
* All rights reserved. *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
* This program is distributed in the hope that it will be useful, *
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
22
****************************************************************************/
28
#include <meshlab/glarea.h>
29
#include <wrap/qt/trackball.h>
30
#include <PhotoTexturingWidget.h>
31
#include "photoTexturing.h"
37
* The PhotoTexturingPlugin is an edit plugin, which allows to texture a mesh using
38
* a calibrated camera and a corresponding image. It is also possible to use more
39
* then one camera to generate a texture for the mesh. The texture of each individuell
40
* camera can be merged with the other camera to one texture file.
42
PhotoTexturingPlugin::PhotoTexturingPlugin() {
43
qFont.setFamily("Helvetica");
44
qFont.setPixelSize(10);
48
// inits the PhotoTexturer
49
photoTexturer = new PhotoTexturer();
52
const QString PhotoTexturingPlugin::Info() {
53
return tr("Generates a texture for a mesh using a calibrated camera and a photo made by this camera.");
56
void PhotoTexturingPlugin::StartEdit(MeshModel &m, GLArea *gla)
61
ptDialog = new PhotoTexturingWidget::PhotoTexturingWidget(this,photoTexturer,m, gla);
62
//ptDialog->setWindowFlags(Qt::WindowStaysOnTopHint);
63
//qDebug()<<"new PhotoTexturingDialog";
67
//connect(this,SIGNAL(suspendEditToggle()),gla,SLOT(suspendEditToggle()));
68
//emit suspendEditToggle();
74
void PhotoTexturingPlugin::mousePressEvent(QMouseEvent *e, MeshModel &mm, GLArea *glArea)
76
//just passes throgh the mouse events to the GLArea
79
if (glArea->isDefaultTrackBall())
80
glArea->trackball.MouseDown(e->x(),glArea->height()-e->y(), QT2VCG(e->button(), e->modifiers() ) );
81
else glArea->trackball_light.MouseDown(e->x(),glArea->height()-e->y(), QT2VCG(e->button(), Qt::NoModifier ) );
85
void PhotoTexturingPlugin::mouseMoveEvent(QMouseEvent *e, MeshModel &, GLArea *glArea)
87
//just passes throgh the mouse move events to the GLArea
88
if(e->buttons() | Qt::LeftButton)
90
if (glArea->isDefaultTrackBall())
92
glArea->trackball.MouseMove(e->x(),glArea->height()-e->y());
93
//glArea->setCursorTrack(glArea->trackball.current_mode);
95
else glArea->trackball_light.MouseMove(e->x(),glArea->height()-e->y());
100
// When mouse is released we set the correct mouse curson
101
void PhotoTexturingPlugin::mouseReleaseEvent(QMouseEvent *e, MeshModel &, GLArea *glArea)
103
if (glArea->isDefaultTrackBall()) glArea->trackball.MouseUp(e->x(),glArea->height()-e->y(), QT2VCG(e->button(), e->modifiers() ) );
104
else glArea->trackball_light.MouseUp(e->x(),glArea->height()-e->y(), QT2VCG(e->button(),e->modifiers()) );
105
//glArea->setCursorTrack(glArea->trackball.current_mode);
111
void PhotoTexturingPlugin::EndEdit(MeshModel &/*m*/, GLArea *gla){
112
//gla->reloadTexture();