29 # include <QtAlgorithms> 31 # include <QApplication> 34 # include <QMessageBox> 35 # include <QPushButton> 36 # include <QTabWidget> 37 # include <QTextStream> 38 # include <QMouseEvent> 75 setFocusPolicy(Qt::StrongFocus);
85 setDefaultShortcuts();
86 setDefaultMouseBindings();
88 setSnapshotFileName(tr(
"snapshot",
"Default snapshot file name"));
89 initializeSnapshotFormats();
90 setSnapshotCounter(0);
91 setSnapshotQuality(95);
96 fpsString_ = tr(
"%1Hz",
"Frames per seconds, in Hertz").arg(
"?");
103 manipulatedFrame_ = NULL;
104 manipulatedFrameIsACamera_ =
false;
105 mouseGrabberIsAManipulatedFrame_ =
false;
106 mouseGrabberIsAManipulatedCameraFrame_ =
false;
107 displayMessage_ =
false;
108 connect(&messageTimer_, SIGNAL(timeout()), SLOT(hideMessage()));
109 messageTimer_.setSingleShot(
true);
111 setMouseGrabber(NULL);
115 setStateFileName(
".qglviewer.xml");
118 setAxisIsDrawn(
false);
119 setGridIsDrawn(
false);
120 setFPSIsDisplayed(
false);
121 setCameraIsEdited(
false);
122 setTextIsEnabled(
true);
123 setStereoDisplay(
false);
126 setFullScreen(
false);
128 animationTimerId_ = 0;
130 setAnimationPeriod(40);
132 selectBuffer_ = NULL;
133 setSelectBufferSize(4*1000);
134 setSelectRegionWidth(3);
135 setSelectRegionHeight(3);
138 bufferTextureId_ = 0;
139 bufferTextureMaxU_ = 0.0;
140 bufferTextureMaxV_ = 0.0;
141 bufferTextureWidth_ = 0;
142 bufferTextureHeight_ = 0;
143 previousBufferTextureFormat_ = 0;
144 previousBufferTextureInternalFormat_ = 0;
145 currentlyPressedKey_ = Qt::Key(0);
147 setAttribute(Qt::WA_NoSystemBackground);
152 #if !defined QT3_SUPPORT 161 : QGLWidget(parent, shareWidget, flags)
166 QGLViewer::QGLViewer(QGLContext *context, QWidget* parent,
const QGLWidget* shareWidget, Qt::WindowFlags flags)
167 : QGLWidget(context, parent, shareWidget, flags)
174 QGLViewer::QGLViewer(
const QGLFormat& format, QWidget* parent,
const QGLWidget* shareWidget, Qt::WindowFlags flags)
175 : QGLWidget(format, parent, shareWidget, flags)
177 #endif // QT3_SUPPORT 212 return Qt::KeyboardModifiers(
int(state & 0xFF000000));
218 return Qt::MouseButton(state & 0xFFFF);
242 glEnable(GL_LIGHTING);
243 glEnable(GL_DEPTH_TEST);
244 glEnable(GL_COLOR_MATERIAL);
251 if (format().stereo())
253 glDrawBuffer(GL_BACK_RIGHT);
254 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
255 glDrawBuffer(GL_BACK_LEFT);
256 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
259 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
279 for (
int view=1; view>=0; --view)
284 if (
camera()->frame()->isManipulated())
296 if (
camera()->frame()->isManipulated())
319 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
342 glMatrixMode(GL_MODELVIEW);
348 glPushAttrib(GL_ALL_ATTRIB_BITS);
351 glDisable(GL_TEXTURE_1D);
352 glDisable(GL_TEXTURE_2D);
353 #ifdef GL_TEXTURE_3D // OpenGL 1.2 Only... 354 glDisable(GL_TEXTURE_3D);
357 glDisable(GL_TEXTURE_GEN_Q);
358 glDisable(GL_TEXTURE_GEN_R);
359 glDisable(GL_TEXTURE_GEN_S);
360 glDisable(GL_TEXTURE_GEN_T);
362 #ifdef GL_RESCALE_NORMAL // OpenGL 1.2 Only... 363 glEnable(GL_RESCALE_NORMAL);
366 glDisable(GL_COLOR_MATERIAL);
379 const unsigned int maxCounter = 20;
393 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
394 glDisable(GL_LIGHTING);
395 glDisable(GL_DEPTH_TEST);
416 glDrawBuffer(GL_BACK_LEFT);
418 glDrawBuffer(GL_BACK_RIGHT);
421 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
531 const Qt::KeyboardModifiers cameraKeyboardModifiers = Qt::NoModifier;
532 const Qt::KeyboardModifiers frameKeyboardModifiers = Qt::ControlModifier;
535 for (
int handler=0; handler<2; ++handler)
538 Qt::KeyboardModifiers modifiers = (mh ==
FRAME) ? frameKeyboardModifiers : cameraKeyboardModifiers;
575 const Qt::KeyboardModifiers macKeyboardModifiers = Qt::AltModifier;
610 disconnect(this->
camera()->frame(), SIGNAL(manipulated()),
this, SLOT(update()));
611 disconnect(this->
camera()->frame(), SIGNAL(spun()),
this, SLOT(update()));
614 connect(camera->
frame(), SIGNAL(manipulated()), SLOT(update()));
615 connect(camera->
frame(), SIGNAL(spun()), SLOT(update()));
626 for (QMap<unsigned int, KeyFrameInterpolator*>::ConstIterator it =
camera()->kfi_.begin(), end=
camera()->
kfi_.end(); it != end; ++it)
629 connect(
camera()->keyFrameInterpolator(it.key()), SIGNAL(interpolated()), SLOT(update()));
631 disconnect(
camera()->keyFrameInterpolator(it.key()), SIGNAL(interpolated()),
this, SLOT(update()));
635 connect(
camera()->interpolationKfi_, SIGNAL(interpolated()), SLOT(update()));
637 disconnect(
camera()->interpolationKfi_, SIGNAL(interpolated()),
this, SLOT(update()));
658 static GLUquadric* quadric = gluNewQuadric();
663 glGetBooleanv(light, &lightIsOn);
672 glGetLightfv(light, GL_DIFFUSE, color);
676 glGetLightfv(light, GL_POSITION, pos);
680 glTranslatef(pos[0]/pos[3], pos[1]/pos[3], pos[2]/pos[3]);
683 glGetLightfv(light, GL_SPOT_CUTOFF, &cutOff);
687 glGetLightfv(light, GL_SPOT_DIRECTION, dir);
690 gluCylinder(quadric, 0.0, 0.7 * length * sin(cutOff *
M_PI / 180.0), 0.7 * length * cos(cutOff *
M_PI / 180.0), 12, 1);
693 gluSphere(quadric, 0.2*length, 10, 10);
698 Vec dir(pos[0], pos[1], pos[2]);
702 glMultMatrixd(fr.
matrix());
750 renderText(x, y, text, fnt);
793 drawText(10,
int(1.5*((QApplication::font().pixelSize()>0)?QApplication::font().pixelSize():QApplication::font().pointSize())),
fpsString_);
829 glMatrixMode(GL_PROJECTION);
839 glOrtho(0, width(), 0, height(), 0.0, -1.0);
841 glOrtho(0, width(), height(), 0, 0.0, -1.0);
843 glMatrixMode(GL_MODELVIEW);
854 glMatrixMode(GL_PROJECTION);
857 glMatrixMode(GL_MODELVIEW);
924 QGLWidget::closeEvent(e);
1019 glRenderMode(GL_SELECT);
1023 glMatrixMode(GL_PROJECTION);
1025 static GLint viewport[4];
1080 GLint nbHits = glRenderMode(GL_RENDER);
1092 for (
int i=1; i<nbHits; ++i)
1115 bool addAmpersand =
false;
1116 if (b & Qt::LeftButton) { result += QGLViewer::tr(
"Left",
"left mouse button"); addAmpersand=
true; }
1117 if (b & Qt::MidButton) {
if (addAmpersand) result +=
" & "; result += QGLViewer::tr(
"Middle",
"middle mouse button"); addAmpersand=
true; }
1118 if (b & Qt::RightButton) {
if (addAmpersand) result +=
" & "; result += QGLViewer::tr(
"Right",
"right mouse button"); }
1142 if (!
camera()->setPivotPointFromPixel(e->pos()))
1204 for (QMap<MouseBindingPrivate, MouseActionPrivate>::ConstIterator it=
mouseBinding_.begin(), end=
mouseBinding_.end(); it!=end; ++it)
1205 if ((it.value().handler ==
FRAME) && (it.key().button == e->button()))
1210 mf->ManipulatedFrame::startAction(it.value().action, it.value().withConstraint);
1211 mf->ManipulatedFrame::mousePressEvent(e,
camera());
1215 mf->
startAction(it.value().action, it.value().withConstraint);
1314 if (
camera()->frame()->isManipulated())
1328 if (hasMouseTracking())
1330 Q_FOREACH (
MouseGrabber* mg, MouseGrabber::MouseGrabberPool())
1398 for (QMap<WheelBindingPrivate, MouseActionPrivate>::ConstIterator it=
wheelBinding_.begin(), end=
wheelBinding_.end(); it!=end; ++it)
1399 if (it.value().handler ==
FRAME)
1404 mf->ManipulatedFrame::startAction(it.value().action, it.value().withConstraint);
1405 mf->ManipulatedFrame::wheelEvent(e,
camera());
1409 mf->
startAction(it.value().action, it.value().withConstraint);
1477 if (format().stereo())
1482 glDrawBuffer(GL_BACK_LEFT);
1483 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
1484 glDrawBuffer(GL_BACK_RIGHT);
1485 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
1494 QMessageBox::warning(
this, tr(
"Stereo not supported",
"Message box window title"), tr(
"Stereo is not supported on this display."));
1509 QWidget* tlw = topLevelWidget();
1513 prevPos_ = topLevelWidget()->pos();
1514 tlw->showFullScreen();
1557 case QGLViewer::ROTATE :
return QGLViewer::tr(
"Rotates",
"ROTATE mouse action");
1558 case QGLViewer::ZOOM :
return QGLViewer::tr(
"Zooms",
"ZOOM mouse action");
1564 case QGLViewer::ROLL :
return QGLViewer::tr(
"Rolls",
"ROLL mouse action");
1565 case QGLViewer::DRIVE :
return QGLViewer::tr(
"Drives",
"DRIVE mouse action");
1569 return QString::null;
1579 case QGLViewer::SELECT :
return QGLViewer::tr(
"Selects",
"SELECT click action");
1582 case QGLViewer::CENTER_FRAME :
return QGLViewer::tr(
"Centers manipulated frame",
"CENTER_FRAME click action");
1585 case QGLViewer::ALIGN_FRAME :
return QGLViewer::tr(
"Aligns manipulated frame",
"ALIGN_FRAME click action");
1588 return QString::null;
1593 # if QT_VERSION >= 0x040100 1594 return QKeySequence(
int(key)).toString(QKeySequence::NativeText);
1596 return QString(QKeySequence(key));
1604 if (!keyModifierString.isEmpty()) {
1607 keyModifierString +=
" ";
1610 if (!keyModifierString.endsWith(
'+'))
1611 keyModifierString +=
"+";
1615 return tr(
"%1%2%3%4%5%6",
"Modifier / button or wheel / double click / with / button / pressed")
1616 .arg(keyModifierString)
1618 .arg(cbp.
doubleClick ? tr(
" double click",
"Suffix after mouse button") :
"")
1619 .arg(buttonsBefore ? tr(
" with ",
"As in : Left button with Ctrl pressed") :
"")
1621 .arg(buttonsBefore ? tr(
" pressed",
"As in : Left button with Ctrl pressed") :
"");
1625 return (key >= Qt::Key_Any && key < Qt::Key_Escape) || (key >= Qt::Key_F1 && key <= Qt::Key_F35);
1634 qWarning(
"setMouseBindingDescription(int state,...) is deprecated. Use the modifier/button equivalent");
1685 if (description.isEmpty())
1691 static QString
tableLine(
const QString& left,
const QString& right)
1693 static bool even =
false;
1694 const QString tdtd(
"</b></td><td>");
1695 const QString tdtr(
"</td></tr>\n");
1697 QString res(
"<tr bgcolor=\"");
1700 res +=
"#eeeeff\">";
1702 res +=
"#ffffff\">";
1703 res +=
"<td><b>" + left + tdtd + right + tdtr;
1720 QString text(
"<center><table border=\"1\" cellspacing=\"0\" cellpadding=\"4\">\n");
1721 const QString trtd(
"<tr><td>");
1722 const QString tdtr(
"</td></tr>\n");
1723 const QString tdtd(
"</td><td>");
1725 text += QString(
"<tr bgcolor=\"#aaaacc\"><th align=\"center\">%1</th><th align=\"center\">%2</th></tr>\n").
1726 arg(tr(
"Button(s)",
"Buttons column header in help window mouse tab")).arg(tr(
"Description",
"Description column header in help window mouse tab"));
1728 QMap<ClickBindingPrivate, QString> mouseBinding;
1732 mouseBinding[itm.key()] = itm.value();
1734 for (QMap<ClickBindingPrivate, QString>::ConstIterator it=mouseBinding.begin(), end=mouseBinding.end(); it != end; ++it)
1737 if (it.value().isNull())
1744 if (!mouseBinding.isEmpty())
1746 mouseBinding.clear();
1747 text += QString(
"<tr bgcolor=\"#aaaacc\"><td colspan=2>%1</td></tr>\n").arg(tr(
"Standard mouse bindings",
"In help window mouse tab"));
1754 itmb != endmb; ++itmb)
1756 ClickBindingPrivate cbp(itmb.key().modifiers, itmb.key().button,
false, Qt::NoButton, itmb.key().key);
1762 switch (itmb.value().handler)
1764 case CAMERA: text +=
" " + tr(
"camera",
"Suffix after action");
break;
1765 case FRAME: text +=
" " + tr(
"manipulated frame",
"Suffix after action");
break;
1767 if (!(itmb.value().withConstraint))
1770 mouseBinding[cbp] = text;
1773 for (QMap<WheelBindingPrivate, MouseActionPrivate>::ConstIterator itw=
wheelBinding_.begin(), endw=
wheelBinding_.end(); itw != endw; ++itw)
1775 ClickBindingPrivate cbp(itw.key().modifiers, Qt::NoButton,
false, Qt::NoButton, itw.key().key);
1781 switch (itw.value().handler)
1783 case CAMERA: text +=
" " + tr(
"camera",
"Suffix after action");
break;
1784 case FRAME: text +=
" " + tr(
"manipulated frame",
"Suffix after action");
break;
1786 if (!(itw.value().withConstraint))
1790 mouseBinding[cbp] = text;
1793 for (QMap<ClickBindingPrivate, ClickAction>::ConstIterator itcb=
clickBinding_.begin(), endcb=
clickBinding_.end(); itcb!=endcb; ++itcb)
1796 for (QMap<ClickBindingPrivate, QString>::ConstIterator it2=mouseBinding.begin(), end2=mouseBinding.end(); it2 != end2; ++it2)
1798 if (it2.value().isNull())
1804 text +=
"</table></center>";
1825 if (description.isEmpty())
1834 return QString::null;
1836 QVector<Qt::Key> keys;
1838 for (QMap<Qt::Key, unsigned int>::ConstIterator i =
pathIndex_.begin(), endi=
pathIndex_.end(); i != endi; ++i)
1839 keys.push_back(i.key());
1842 QVector<Qt::Key>::const_iterator it = keys.begin(), end = keys.end();
1845 const int maxDisplayedKeys = 6;
1846 int nbDisplayedKeys = 0;
1847 Qt::Key previousKey = (*it);
1850 while ((it != end) && (nbDisplayedKeys < maxDisplayedKeys-1))
1855 if ((*it) == previousKey + 1)
1864 if ((*it) == previousKey + 1)
1870 nbDisplayedKeys += 2;
1875 if ((*it) != previousKey + 1)
1879 nbDisplayedKeys += 2;
1908 QString text(
"<center><table border=\"1\" cellspacing=\"0\" cellpadding=\"4\">\n");
1909 text += QString(
"<tr bgcolor=\"#aaaacc\"><th align=\"center\">%1</th><th align=\"center\">%2</th></tr>\n").
1910 arg(QGLViewer::tr(
"Key(s)",
"Keys column header in help window mouse tab")).arg(QGLViewer::tr(
"Description",
"Description column header in help window mouse tab"));
1912 QMap<unsigned int, QString> keyDescription;
1916 keyDescription[kd.key()] = kd.value();
1919 for (QMap<unsigned int, QString>::ConstIterator kb=keyDescription.begin(), endb=keyDescription.end(); kb!=endb; ++kb)
1924 if (!keyDescription.isEmpty())
1926 keyDescription.clear();
1927 text += QString(
"<tr bgcolor=\"#aaaacc\"><td colspan=2>%1</td></tr>\n").arg(QGLViewer::tr(
"Standard viewer keys",
"In help window keys tab"));
1937 for (QMap<unsigned int, QString>::ConstIterator kb2=keyDescription.begin(), endb2=keyDescription.end(); kb2!=endb2; ++kb2)
1945 text +=
"<tr bgcolor=\"#ccccff\"><td colspan=2>\n";
1946 text += QGLViewer::tr(
"Camera paths are controlled using the %1 keys (noted <i>Fx</i> below):",
"Help window key tab camera keys").arg(cpks) +
"</td></tr>\n";
1948 QGLViewer::tr(
"Plays path (or resets saved position)"));
1950 QGLViewer::tr(
"Adds a key frame to path (or defines a position)"));
1952 QGLViewer::tr(
"Deletes path (or saved position)"));
1954 text +=
"</table></center>";
1979 bool resize =
false;
1983 static QString label[] = {tr(
"&Help",
"Help window tab title"), tr(
"&Keyboard",
"Help window tab title"), tr(
"&Mouse",
"Help window tab title"), tr(
"&About",
"Help window about title")};
1989 helpWidget()->setWindowTitle(tr(
"Help",
"Help window title"));
1992 for (
int i=0; i<4; ++i)
1994 QTextEdit* tab =
new QTextEdit(NULL);
1995 tab->setReadOnly(
true);
1999 # include "qglviewer-icon.xpm" 2000 QPixmap pixmap(qglviewer_icon);
2001 tab->document()->addResource(QTextDocument::ImageResource,
2002 QUrl(
"mydata://qglviewer-icon.xpm"), QVariant(pixmap));
2007 for (
int i=0; i<4; ++i)
2015 case 3 : text = QString(
"<center><br><img src=\"mydata://qglviewer-icon.xpm\">") + tr(
2016 "<h1>libQGLViewer</h1>" 2017 "<h3>Version %1</h3><br>" 2018 "A versatile 3D viewer based on OpenGL and Qt<br>" 2019 "Copyright 2002-%2 Gilles Debunne<br>" 2021 QString(
"</center>");
2026 QTextEdit* textEdit = (QTextEdit*)(
helpWidget()->widget(i));
2027 textEdit->setHtml(text);
2028 textEdit->setText(text);
2030 if (resize && (textEdit->height() > height))
2031 height = textEdit->height();
2074 const Qt::Key key = Qt::Key(e->key());
2076 const Qt::KeyboardModifiers modifiers = e->modifiers();
2079 const unsigned int target = key | modifiers;
2080 while ((it != end) && (it.value() != target))
2089 unsigned int index =
pathIndex_[Qt::Key(key)];
2092 static QTime doublePress;
2096 int elapsed = doublePress.restart();
2114 int elapsed = doublePress.restart();
2117 if (
camera()->keyFrameInterpolator(index))
2119 disconnect(
camera()->keyFrameInterpolator(index), SIGNAL(interpolated()),
this, SLOT(update()));
2120 if (
camera()->keyFrameInterpolator(index)->numberOfKeyFrames() > 1)
2121 displayMessage(tr(
"Path %1 deleted",
"Feedback message").arg(index));
2123 displayMessage(tr(
"Position %1 deleted",
"Feedback message").arg(index));
2132 connect(
camera()->keyFrameInterpolator(index), SIGNAL(interpolated()), SLOT(update()));
2135 displayMessage(tr(
"Path %1, position %2 added",
"Feedback message").arg(index).arg(nbKF));
2137 displayMessage(tr(
"Position %1 saved",
"Feedback message").arg(index));
2201 QGLWidget::resizeGL(width, height);
2202 glViewport( 0, 0, GLint(width), GLint(height) );
2258 qWarning(
"setKeyboardAccelerator is deprecated. Use setShortcut instead.");
2264 qWarning(
"keyboardAccelerator is deprecated. Use shortcut instead.");
2288 for (QMap<Qt::Key, unsigned int>::ConstIterator it =
pathIndex_.begin(), end=
pathIndex_.end(); it != end; ++it)
2289 if (it.value() == index)
2307 Qt::Key k = Qt::Key(abs(key));
2357 qWarning(
"addKeyFrameStateKey has been renamed addKeyFrameKeyboardModifiers");
2362 qWarning(
"playPathStateKey has been renamed playPathKeyboardModifiers");
2368 qWarning(
"setAddKeyFrameStateKey has been renamed setAddKeyFrameKeyboardModifiers");
2374 qWarning(
"setPlayPathStateKey has been renamed setPlayPathKeyboardModifiers");
2380 qWarning(
"keyFrameKey has been renamed pathKey.");
2386 qWarning(
"playKeyFramePathStateKey has been renamed playPathKeyboardModifiers.");
2392 qWarning(
"setKeyFrameKey is deprecated, use setPathKey instead, with swapped parameters.");
2398 qWarning(
"setPlayKeyFramePathStateKey has been renamed setPlayPathKeyboardModifiers.");
2447 qWarning(
"setHandlerKeyboardModifiers is deprecated, call setMouseBinding() instead");
2449 QMap<MouseBindingPrivate, MouseActionPrivate> newMouseBinding;
2450 QMap<WheelBindingPrivate, MouseActionPrivate> newWheelBinding;
2451 QMap<ClickBindingPrivate, ClickAction> newClickBinding_;
2453 QMap<MouseBindingPrivate, MouseActionPrivate>::Iterator mit;
2454 QMap<WheelBindingPrivate, MouseActionPrivate>::Iterator wit;
2458 if ((mit.value().handler != handler) || (mit.value().action ==
ZOOM_ON_REGION))
2459 newMouseBinding[mit.key()] = mit.value();
2462 if (wit.value().handler != handler)
2463 newWheelBinding[wit.key()] = wit.value();
2467 if ((mit.value().handler == handler) && (mit.value().action !=
ZOOM_ON_REGION))
2470 newMouseBinding[mbp] = mit.value();
2474 if (wit.value().handler == handler)
2477 newWheelBinding[wbp] = wit.value();
2481 for (QMap<ClickBindingPrivate, ClickAction>::ConstIterator cb=
clickBinding_.begin(), end=
clickBinding_.end(); cb != end; ++cb)
2485 ClickBindingPrivate cbp(modifiers, cb.key().button, cb.key().doubleClick, cb.key().buttonsBefore, cb.key().key);
2486 newClickBinding_[cbp] = cb.value();
2489 newClickBinding_[cb.key()] = cb.value();
2498 qWarning(
"setHandlerStateKey has been renamed setHandlerKeyboardModifiers");
2504 qWarning(
"setMouseStateKey has been renamed setHandlerKeyboardModifiers.");
2514 qWarning(
"setMouseBinding(int state, MouseHandler...) is deprecated. Use the modifier/button equivalent");
2528 setMouseBinding(Qt::Key(0), modifiers, button, handler, action, withConstraint);
2568 qWarning(
"Cannot bind %s to FRAME",
mouseActionString(action).toLatin1().constData());
2572 if (button == Qt::NoButton) {
2573 qWarning(
"No mouse button specified in setMouseBinding");
2598 qWarning(
"setMouseBinding(int state, ClickAction...) is deprecated. Use the modifier/button equivalent");
2613 setMouseBinding(Qt::Key(0), modifiers, button, action, doubleClick, buttonsBefore);
2638 if ((buttonsBefore != Qt::NoButton) && !doubleClick) {
2639 qWarning(
"Buttons before is only meaningful when doubleClick is true in setMouseBinding().");
2643 if (button == Qt::NoButton) {
2644 qWarning(
"No mouse button specified in setMouseBinding");
2656 if ((!doubleClick) && (buttonsBefore == Qt::NoButton)) {
2667 setWheelBinding(Qt::Key(0), modifiers, handler, action, withConstraint);
2684 qWarning(
"Cannot bind %s to wheel",
mouseActionString(action).toLatin1().constData());
2689 qWarning(
"Cannot bind %s to FRAME wheel",
mouseActionString(action).toLatin1().constData());
2729 qWarning(
"mouseAction(int state,...) is deprecated. Use the modifier/button equivalent");
2761 qWarning(
"mouseHandler(int state,...) is deprecated. Use the modifier/button equivalent");
2793 qWarning(
"mouseButtonState() is deprecated. Use mouseButtons() and keyboardModifiers() instead");
2794 for (QMap<MouseBindingPrivate, MouseActionPrivate>::ConstIterator it=
mouseBinding_.begin(), end=
mouseBinding_.end(); it != end; ++it)
2795 if ( (it.value().handler == handler) && (it.value().action == action) && (it.value().withConstraint == withConstraint) )
2796 return (
int) it.key().modifiers | (int) it.key().button;
2798 return Qt::NoButton;
2810 Qt::Key& key, Qt::KeyboardModifiers& modifiers)
const 2812 for (QMap<WheelBindingPrivate, MouseActionPrivate>::ConstIterator it=
wheelBinding_.begin(), end=
wheelBinding_.end(); it != end; ++it)
2813 if ( (it.value().handler == handler) && (it.value().action == action) && (it.value().withConstraint == withConstraint) ) {
2815 modifiers = it.key().modifiers;
2820 modifiers = Qt::NoModifier;
2831 Qt::Key& key, Qt::KeyboardModifiers& modifiers, Qt::MouseButton& button)
const 2833 for (QMap<MouseBindingPrivate, MouseActionPrivate>::ConstIterator it=
mouseBinding_.begin(), end=
mouseBinding_.end(); it != end; ++it) {
2834 if ( (it.value().handler == handler) && (it.value().action == action) && (it.value().withConstraint == withConstraint) ) {
2836 modifiers = it.key().modifiers;
2837 button = it.key().button;
2843 modifiers = Qt::NoModifier;
2844 button = Qt::NoButton;
2879 bool doubleClick, Qt::MouseButtons buttonsBefore)
const {
2892 qWarning(
"wheelAction() is deprecated. Use the new wheelAction() method with a key parameter instead");
2900 qWarning(
"wheelHandler() is deprecated. Use the new wheelHandler() method with a key parameter instead");
2909 qWarning(
"wheelButtonState() is deprecated. Use the wheelAction() and wheelHandler() instead");
2910 for (QMap<WheelBindingPrivate, MouseActionPrivate>::ConstIterator it=
wheelBinding_.begin(), end=
wheelBinding_.end(); it!=end; ++it)
2911 if ( (it.value().handler == handler) && (it.value().action == action) && (it.value().withConstraint == withConstraint) )
2912 return it.key().key + it.key().modifiers;
2922 qWarning(
"clickAction(int state,...) is deprecated. Use the modifier/button equivalent");
2935 qWarning(
"getClickButtonState(int state,...) is deprecated. Use the modifier/button equivalent");
2936 Qt::KeyboardModifiers modifiers;
2937 Qt::MouseButton button;
2940 state = (
unsigned int) modifiers | (
unsigned int) button | (
unsigned int) key;
2953 for (QMap<ClickBindingPrivate, ClickAction>::ConstIterator it=
clickBinding_.begin(), end=
clickBinding_.end(); it != end; ++it)
2954 if (it.value() == action) {
2955 modifiers = it.key().modifiers;
2956 button = it.key().button;
2957 doubleClick = it.key().doubleClick;
2958 buttonsBefore = it.key().buttonsBefore;
2963 modifiers = Qt::NoModifier;
2964 button = Qt::NoButton;
2965 doubleClick =
false;
2966 buttonsBefore = Qt::NoButton;
2977 Qt::KeyboardModifiers modifiers;
2978 Qt::MouseButton button;
2980 return button != Qt::NoButton;
2998 Qt::KeyboardModifiers modifiers;
2999 Qt::MouseButton button;
3001 bool rotateMode = button != Qt::NoButton;
3065 disconnect(
manipulatedFrame(), SIGNAL(manipulated()),
this, SLOT(update()));
3110 const qreal size = 15.0;
3113 glDisable(GL_LIGHTING);
3114 glDisable(GL_DEPTH_TEST);
3117 glVertex2d(proj.
x - size, proj.
y);
3118 glVertex2d(proj.
x + size, proj.
y);
3119 glVertex2d(proj.
x, proj.
y - size);
3120 glVertex2d(proj.
x, proj.
y + size);
3122 glEnable(GL_DEPTH_TEST);
3149 glDisable(GL_LIGHTING);
3150 glDisable(GL_DEPTH_TEST);
3153 glVertex2d(pnt.
x, pnt.
y);
3156 glEnable(GL_DEPTH_TEST);
3164 glDisable(GL_LIGHTING);
3165 glDisable(GL_DEPTH_TEST);
3167 glBegin(GL_LINE_LOOP);
3173 glEnable(GL_DEPTH_TEST);
3209 static GLUquadric* quadric = gluNewQuadric();
3212 radius = 0.05 * length;
3214 const qreal head = 2.5*(radius / length) + 0.1;
3215 const qreal coneRadiusCoef = 4.0 - 5.0 * head;
3217 gluCylinder(quadric, radius, radius, length * (1.0 - head/coneRadiusCoef), nbSubdivisions, 1);
3218 glTranslated(0.0, 0.0, length * (1.0 - head));
3219 gluCylinder(quadric, coneRadiusCoef * radius, 0.0, head * length, nbSubdivisions, 1);
3220 glTranslated(0.0, 0.0, -length * (1.0 - head));
3230 glTranslated(from[0], from[1], from[2]);
3231 const Vec dir = to-from;
3257 const qreal charWidth = length / 40.0;
3258 const qreal charHeight = length / 30.0;
3259 const qreal charShift = 1.04 * length;
3261 GLboolean lighting, colorMaterial;
3262 glGetBooleanv(GL_LIGHTING, &lighting);
3263 glGetBooleanv(GL_COLOR_MATERIAL, &colorMaterial);
3265 glDisable(GL_LIGHTING);
3269 glVertex3d(charShift, charWidth, -charHeight);
3270 glVertex3d(charShift, -charWidth, charHeight);
3271 glVertex3d(charShift, -charWidth, -charHeight);
3272 glVertex3d(charShift, charWidth, charHeight);
3274 glVertex3d( charWidth, charShift, charHeight);
3275 glVertex3d(0.0, charShift, 0.0);
3276 glVertex3d(-charWidth, charShift, charHeight);
3277 glVertex3d(0.0, charShift, 0.0);
3278 glVertex3d(0.0, charShift, 0.0);
3279 glVertex3d(0.0, charShift, -charHeight);
3281 glVertex3d(-charWidth, charHeight, charShift);
3282 glVertex3d( charWidth, charHeight, charShift);
3283 glVertex3d( charWidth, charHeight, charShift);
3284 glVertex3d(-charWidth, -charHeight, charShift);
3285 glVertex3d(-charWidth, -charHeight, charShift);
3286 glVertex3d( charWidth, -charHeight, charShift);
3289 glEnable(GL_LIGHTING);
3290 glDisable(GL_COLOR_MATERIAL);
3293 color[0] = 0.7f; color[1] = 0.7f; color[2] = 1.0f; color[3] = 1.0f;
3294 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
3297 color[0] = 1.0f; color[1] = 0.7f; color[2] = 0.7f; color[3] = 1.0f;
3298 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
3300 glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
3304 color[0] = 0.7f; color[1] = 1.0f; color[2] = 0.7f; color[3] = 1.0f;
3305 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
3307 glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
3312 glEnable(GL_COLOR_MATERIAL);
3314 glDisable(GL_LIGHTING);
3326 glGetBooleanv(GL_LIGHTING, &lighting);
3328 glDisable(GL_LIGHTING);
3331 for (
int i=0; i<=nbSubdivisions; ++i)
3333 const qreal pos = size*(2.0*i/nbSubdivisions-1.0);
3334 glVertex2d(pos, -size);
3335 glVertex2d(pos, +size);
3336 glVertex2d(-size, pos);
3337 glVertex2d( size, pos);
3342 glEnable(GL_LIGHTING);
3383 if (fi.suffix().isEmpty())
3386 name = fi.absolutePath() +
'/' + fi.completeBaseName() + QString::number(
QGLViewer::QGLViewerIndex(
this)) +
"." + fi.suffix();
3406 QFileInfo fileInfo(name);
3408 if (fileInfo.isDir())
3410 QMessageBox::warning(
this, tr(
"Save to file error",
"Message box window title"), tr(
"State file name (%1) references a directory instead of a file.").arg(name));
3414 const QString dirName = fileInfo.absolutePath();
3415 if (!QFileInfo(dirName).exists())
3418 if (!(dir.mkdir(dirName)))
3420 QMessageBox::warning(
this, tr(
"Save to file error",
"Message box window title"), tr(
"Unable to create directory %1").arg(dirName));
3427 if (f.open(QIODevice::WriteOnly))
3429 QTextStream out(&f);
3430 QDomDocument doc(
"QGLVIEWER");
3431 doc.appendChild(
domElement(
"QGLViewer", doc));
3437 QMessageBox::warning(
this, tr(
"Save to file error",
"Message box window title"), tr(
"Unable to save to file %1").arg(name) +
":\n" + f.errorString());
3467 QFileInfo fileInfo(name);
3469 if (!fileInfo.isFile())
3473 if (!fileInfo.isReadable())
3475 QMessageBox::warning(
this, tr(
"Problem in state restoration",
"Message box window title"), tr(
"File %1 is not readable.").arg(name));
3481 if (f.open(QIODevice::ReadOnly))
3486 QDomElement
main = doc.documentElement();
3491 QMessageBox::warning(
this, tr(
"Open file error",
"Message box window title"), tr(
"Unable to open file %1").arg(name) +
":\n" + f.errorString());
3532 QDomElement de = document.createElement(name);
3535 QDomElement stateNode = document.createElement(
"State");
3541 de.appendChild(stateNode);
3543 QDomElement displayNode = document.createElement(
"Display");
3549 de.appendChild(displayNode);
3551 QDomElement geometryNode = document.createElement(
"Geometry");
3555 geometryNode.setAttribute(
"prevPosX", QString::number(
prevPos_.x()));
3556 geometryNode.setAttribute(
"prevPosY", QString::number(
prevPos_.y()));
3560 QWidget* tlw = topLevelWidget();
3561 geometryNode.setAttribute(
"width", QString::number(tlw->width()));
3562 geometryNode.setAttribute(
"height", QString::number(tlw->height()));
3563 geometryNode.setAttribute(
"posX", QString::number(tlw->pos().x()));
3564 geometryNode.setAttribute(
"posY", QString::number(tlw->pos().y()));
3566 de.appendChild(geometryNode);
3618 const QString version = element.attribute(
"version");
3620 if (version[0] !=
'2')
3622 qWarning(
"State file created using QGLViewer version %s may not be correctly read.", version.toLatin1().constData());
3624 QDomElement child=element.firstChild().toElement();
3626 while (!child.isNull())
3628 if (child.tagName() ==
"State")
3636 QDomElement ch=child.firstChild().toElement();
3637 while (!ch.isNull())
3639 if (ch.tagName() ==
"foregroundColor")
3641 if (ch.tagName() ==
"backgroundColor")
3643 ch = ch.nextSibling().toElement();
3647 if (child.tagName() ==
"Display")
3658 if (child.tagName() ==
"Geometry")
3671 topLevelWidget()->resize(width, height);
3677 topLevelWidget()->move(pos);
3681 if (child.tagName() ==
"Camera")
3691 child = child.nextSibling().toElement();
3712 if (!fileName.isEmpty())
3715 qWarning(
"saveToFile() is deprecated, use saveStateToFile() instead.");
3723 if (!fileName.isEmpty())
3726 qWarning(
"restoreFromFile() is deprecated, use restoreStateFromFile() instead.");
3791 while (h < height())
3809 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
3810 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
3826 if (format == GL_NONE)
3827 format = GLenum(internalFormat);
3832 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, width(), height());
virtual QString mouseString() const
void setZClippingCoefficient(qreal coef)
int selectRegionHeight() const
virtual void aboutQGLViewer()
Qt::KeyboardModifiers playPathKeyboardModifiers() const
virtual void wheelEvent(QWheelEvent *)
void setScreenWidthAndHeight(int width, int height)
void getWheelActionBinding(MouseHandler handler, MouseAction action, bool withConstraint, Qt::Key &key, Qt::KeyboardModifiers &modifiers) const
void setDefaultMouseBindings()
static QString keyString(unsigned int key)
A keyFrame Catmull-Rom Frame interpolator.
virtual void initFromDOMElement(const QDomElement &element)
virtual void timerEvent(QTimerEvent *)
void setCamera(qglviewer::Camera *const camera)
Qt::KeyboardModifiers addKeyFrameStateKey() const
virtual void setPathKey(int key, unsigned int index=0)
static QDomElement QColorDomElement(const QColor &color, const QString &name, QDomDocument &doc)
QMap< unsigned int, QString > keyDescription_
QTabWidget * helpWidget()
The ManipulatedCameraFrame class represents a ManipulatedFrame with Camera specific mouse bindings...
virtual void drawAllPaths()
void resetInterpolation()
void getMouseActionBinding(MouseHandler handler, MouseAction action, bool withConstraint, Qt::Key &key, Qt::KeyboardModifiers &modifiers, Qt::MouseButton &button) const
virtual void resetVisualHints()
static QString mouseActionString(QGLViewer::MouseAction ma)
virtual void loadProjectionMatrixStereo(bool leftBuffer=true) const
void getClickButtonState(ClickAction action, unsigned int &state, bool &doubleClick, Qt::MouseButtons &buttonsBefore) const
void toggleFPSIsDisplayed()
A ManipulatedFrame is a Frame that can be rotated and translated using the mouse. ...
QString stateFileName() const
virtual void setPlayKeyFramePathStateKey(unsigned int buttonState)
virtual void setPlayPathKeyboardModifiers(Qt::KeyboardModifiers modifiers)
Qt::KeyboardModifiers playPathKeyboardModifiers_
virtual void checkIfGrabsMouse(int x, int y, const Camera *const camera)=0
static void drawGrid(qreal size=1.0, int nbSubdivisions=10)
qreal sceneRadius() const
static QString formatClickActionPrivate(ClickBindingPrivate cbp)
virtual void mouseMoveEvent(QMouseEvent *const event, Camera *const camera)
void setForegroundColor(const QColor &color)
void interpolateToFitScene()
virtual void stopAnimation()
virtual void stopScreenCoordinatesSystem() const
virtual void mouseMoveEvent(QMouseEvent *const event, Camera *const camera)
QMap< ClickBindingPrivate, ClickAction > clickBinding_
int previousBufferTextureInternalFormat_
virtual void loadProjectionMatrix(bool reset=true) const
void setSceneCenter(const Vec ¢er)
virtual void mouseReleaseEvent(QMouseEvent *const event, Camera *const camera)
virtual void saveStateToFile()
Vec projectedCoordinatesOf(const Vec &src, const Frame *frame=NULL) const
QColor foregroundColor() const
void defaultConstructor()
int selectBufferSize() const
void clearMouseBindings()
virtual void deletePath(unsigned int i)
void setMouseBinding(unsigned int state, MouseHandler handler, MouseAction action, bool withConstraint=true)
void setMouseBindingDescription(unsigned int state, QString description, bool doubleClick=false, Qt::MouseButtons buttonsBefore=Qt::NoButton)
QMap< KeyboardAction, QString > keyboardActionDescription_
virtual void loadModelViewMatrix(bool reset=true) const
static QList< QGLViewer * > QGLViewerPool_
void setSceneRadius(qreal radius)
void setFlySpeed(qreal speed)
void setMouseGrabberIsEnabled(const qglviewer::MouseGrabber *const mouseGrabber, bool enabled=true)
unsigned int previousBufferTextureFormat_
virtual void loadModelViewMatrixStereo(bool leftBuffer=true) const
void drawText(int x, int y, const QString &text, const QFont &fnt=QFont())
int animationPeriod() const
#define QGLVIEWER_VERSION
virtual void closeEvent(QCloseEvent *)
void setSelectedName(int id)
int mouseButtonState(MouseHandler handler, MouseAction action, bool withConstraint=true) const
void setStereoDisplay(bool stereo=true)
void getViewport(GLint viewport[4]) const
Qt::KeyboardModifiers playKeyFramePathStateKey() const
void toggleCameraIsEdited()
virtual void mouseReleaseEvent(QMouseEvent *const event, Camera *const camera)
qglviewer::MouseGrabber * mouseGrabber_
bool restoreFromFile(const QString &fileName=QString::null)
ClickAction clickAction(unsigned int state, bool doubleClick, Qt::MouseButtons buttonsBefore) const
static QString clickActionString(QGLViewer::ClickAction ca)
Qt::KeyboardModifiers playPathStateKey() const
qglviewer::Vec sceneCenter() const
virtual void initFromDOMElement(const QDomElement &element)
Abstract class for objects that grab mouse focus in a QGLViewer.
static int QGLViewerIndex(const QGLViewer *const viewer)
void setMouseStateKey(MouseHandler handler, unsigned int buttonState)
unsigned int previousPathId_
void setGridIsDrawn(bool draw=true)
QGLViewer(QWidget *parent=0, const QGLWidget *shareWidget=0, Qt::WindowFlags flags=0)
virtual void endSelection(const QPoint &point)
void updateSceneUpVector()
static void drawAxis(qreal length=1.0)
static QString QGLViewerVersionString()
void setHandlerKeyboardModifiers(MouseHandler handler, Qt::KeyboardModifiers modifiers)
qglviewer::MouseGrabber * mouseGrabber() const
ManipulatedCameraFrame * frame() const
virtual void mouseMoveEvent(QMouseEvent *)
virtual void select(const QMouseEvent *event)
virtual void mousePressEvent(QMouseEvent *const event, Camera *const camera)
bool mouseGrabberIsAManipulatedCameraFrame_
virtual void setPlayPathStateKey(unsigned int buttonState)
void setShortcut(KeyboardAction action, unsigned int key)
The Vec class represents 3D positions and 3D vectors.
const GLdouble * matrix() const
virtual void startScreenCoordinatesSystem(bool upward=false) const
virtual void wheelEvent(QWheelEvent *const event, Camera *const camera)
Qt::Key currentlyPressedKey_
virtual void setAddKeyFrameKeyboardModifiers(Qt::KeyboardModifiers modifiers)
void setWheelBinding(Qt::KeyboardModifiers modifiers, MouseHandler handler, MouseAction action, bool withConstraint=true)
int mouseHandler(unsigned int state) const
Qt::KeyboardModifiers addKeyFrameKeyboardModifiers() const
void connectAllCameraKFIInterpolatedSignals(bool connection=true)
void copyBufferToTexture(GLint internalFormat, GLenum format=GL_NONE)
virtual void initFromDOMElement(const QDomElement &element)
unsigned int wheelButtonState(MouseHandler handler, MouseAction action, bool withConstraint=true) const
static void saveStateToFileForAllViewers()
void setTranslation(const Vec &translation)
const Qt::KeyboardModifiers modifiers
void setManipulatedFrame(qglviewer::ManipulatedFrame *frame)
void mouseGrabberChanged(qglviewer::MouseGrabber *mouseGrabber)
void setDefaultShortcuts()
QColor backgroundColor() const
void projectOnLine(const Vec &origin, const Vec &direction)
virtual void mouseDoubleClickEvent(QMouseEvent *const event, Camera *const camera)
QMap< unsigned int, KeyFrameInterpolator * > kfi_
GLuint bufferTextureId() const
static Qt::MouseButton mouseButtonFromState(unsigned int state)
int wheelHandler(Qt::Key key, Qt::KeyboardModifiers modifiers) const
QFont scaledFont(const QFont &font) const
void setSelectBufferSize(int size)
virtual QString keyboardString() const
void interpolateToZoomOnPixel(const QPoint &pixel)
static QString mouseButtonsString(Qt::MouseButtons b)
static void setBoolAttribute(QDomElement &element, const QString &attribute, bool value)
bool interpolationIsStarted() const
bool cameraIsEdited() const
void setFullScreen(bool fullScreen=true)
virtual void startAnimation()
void setKeyDescription(unsigned int key, QString description)
void setMouseGrabber(qglviewer::MouseGrabber *mouseGrabber)
qglviewer::ManipulatedFrame * manipulatedFrame() const
bool manipulatedFrameIsACamera_
void snapshotToClipboard()
void setAxisIsDrawn(bool draw=true)
virtual QString helpString() const
virtual void drawWithNames()
void setFPSIsDisplayed(bool display=true)
void stereoChanged(bool on)
qglviewer::ManipulatedFrame * manipulatedFrame_
virtual void wheelEvent(QWheelEvent *const event, Camera *const camera)
virtual void setAddKeyFrameStateKey(unsigned int buttonState)
void cameraIsEditedChanged(bool edited)
bool displaysInStereo() const
virtual void mouseDoubleClickEvent(QMouseEvent *)
void setHandlerStateKey(MouseHandler handler, unsigned int buttonState)
QMap< WheelBindingPrivate, MouseActionPrivate > wheelBinding_
bool mouseGrabberIsAManipulatedFrame_
bool mouseGrabberIsEnabled(const qglviewer::MouseGrabber *const mouseGrabber)
KeyFrameInterpolator * keyFrameInterpolator(unsigned int i) const
void setStateFileName(const QString &name)
static QColor QColorFromDom(const QDomElement &e)
Qt::KeyboardModifiers addKeyFrameKeyboardModifiers_
A versatile 3D OpenGL viewer based on QGLWidget.
void setCameraIsEdited(bool edit=true)
Qt::Key keyFrameKey(unsigned int index) const
QMap< MouseBindingPrivate, MouseActionPrivate > mouseBinding_
virtual void preDrawStereo(bool leftBuffer=true)
void toggleTextIsEnabled()
QString cameraPathKeysString() const
void toggleStereoDisplay()
void setBackgroundColor(const QColor &color)
A perspective or orthographic camera.
int selectRegionWidth() const
The Quaternion class represents 3D rotations and orientations.
QMap< size_t, bool > disabledMouseGrabbers_
virtual void addKeyFrameToPath(unsigned int i)
virtual QDomElement domElement(const QString &name, QDomDocument &document) const
virtual bool restoreStateFromFile()
virtual void resetPath(unsigned int i)
bool cameraIsInRotateMode() const
void performClickAction(ClickAction ca, const QMouseEvent *const e)
virtual void setKeyFrameKey(unsigned int index, int key)
virtual void drawVisualHints()
const Qt::MouseButton button
virtual void keyPressEvent(QKeyEvent *)
bool FPSIsDisplayed() const
static bool boolFromDom(const QDomElement &e, const QString &attribute, bool defValue)
MouseAction mouseAction(unsigned int state) const
virtual void startAction(int ma, bool withConstraint=true)
virtual void mouseReleaseEvent(QMouseEvent *const event, Camera *const camera)
void setKeyboardAccelerator(KeyboardAction action, unsigned int key)
QMap< Qt::Key, unsigned int > pathIndex_
void alignWithFrame(const Frame *const frame, bool move=false, qreal threshold=0.0)
virtual void stopSpinning()
virtual void keyReleaseEvent(QKeyEvent *)
The Frame class represents a coordinate system, defined by a position and an orientation.
MouseAction wheelAction(Qt::Key key, Qt::KeyboardModifiers modifiers) const
bool isFullScreen() const
bool textIsEnabled() const
static int intFromDom(const QDomElement &e, const QString &attribute, int defValue)
void drawFinished(bool automatic)
QMap< KeyboardAction, unsigned int > keyboardBinding_
virtual void playPath(unsigned int i)
Qt::Key pathKey(unsigned int index) const
virtual void setVisualHintsMask(int mask, int delay=2000)
virtual void drawLight(GLenum light, qreal scale=1.0) const
static QString tableLine(const QString &left, const QString &right)
qreal previousCameraZClippingCoefficient_
static Qt::KeyboardModifiers keyboardModifiersFromState(unsigned int state)
static bool isValidShortcutKey(int key)
qglviewer::Camera * camera_
int main(int argc, char *argv[])
QMap< ClickBindingPrivate, QString > mouseDescription_
void handleKeyboardAction(KeyboardAction id)
unsigned int keyboardAccelerator(KeyboardAction action) const
virtual void postSelection(const QPoint &point)
void saveSnapshot(bool automatic=true, bool overwrite=false)
virtual void resizeGL(int width, int height)
unsigned int shortcut(KeyboardAction action) const
static const QList< QGLViewer * > & QGLViewerPool()
virtual void wheelEvent(QWheelEvent *const event, Camera *const camera)
virtual void mouseMoveEvent(QMouseEvent *const event, Camera *const camera)
bool animationIsStarted() const
int numberOfKeyFrames() const
bool isManipulated() const
void getClickActionBinding(ClickAction action, Qt::Key &key, Qt::KeyboardModifiers &modifiers, Qt::MouseButton &button, bool &doubleClick, Qt::MouseButtons &buttonsBefore) const
qreal zClippingCoefficient() const
virtual void initializeGL()
void saveToFile(const QString &fileName=QString::null)
static void drawArrow(qreal length=1.0, qreal radius=-1.0, int nbSubdivisions=12)
virtual void mouseReleaseEvent(QMouseEvent *)
const Qt::MouseButtons buttonsBefore
virtual void beginSelection(const QPoint &point)
virtual void startAction(int ma, bool withConstraint=true)
virtual void mousePressEvent(QMouseEvent *const event, Camera *const camera)
virtual void mousePressEvent(QMouseEvent *)
qglviewer::Camera * camera() const
void displayMessage(const QString &message, int delay=2000)
void pointSelected(const QMouseEvent *e)
void setPivotPoint(const Vec &point)