allow changing the navigation mode
parent
2f6e02abf3
commit
575beeb792
|
@ -10,10 +10,15 @@
|
|||
using namespace mitsuba;
|
||||
|
||||
enum EConnectionType {
|
||||
ESSHConnection,
|
||||
ESSHConnection = 0,
|
||||
EDirectConnection
|
||||
};
|
||||
|
||||
enum ENavigationMode {
|
||||
EFlythroughFixedYaw = 0,
|
||||
EFlythrough
|
||||
};
|
||||
|
||||
namespace mitsuba {
|
||||
class RemoteWorker;
|
||||
};
|
||||
|
|
|
@ -29,6 +29,7 @@ GLWidget::GLWidget(QWidget *parent) :
|
|||
connect(m_preview, SIGNAL(statusMessage(const QString &)),
|
||||
this, SIGNAL(statusMessage(const QString &)), Qt::QueuedConnection);
|
||||
m_invertMouse = false;
|
||||
m_navigationMode = EFlythroughFixedYaw;
|
||||
m_ignoreMouseEvent = QPoint(0, 0);
|
||||
m_didSetCursor = false;
|
||||
m_softwareFallback = false;
|
||||
|
@ -558,6 +559,14 @@ void GLWidget::mouseMoveEvent(QMouseEvent *event) {
|
|||
PinholeCamera *camera = static_cast<PinholeCamera *>(m_context->scene->getCamera());
|
||||
Point p = camera->getInverseViewTransform()(Point(0,0,0));
|
||||
Vector direction = camera->getInverseViewTransform()(Vector(0,0,1));
|
||||
Vector up;
|
||||
|
||||
if (m_navigationMode == EFlythrough)
|
||||
up = camera->getInverseViewTransform()(Vector(0,1,0));
|
||||
else if (m_navigationMode == EFlythroughFixedYaw)
|
||||
up = m_context->up;
|
||||
else
|
||||
SLog(EError, "Unknown navigation mode encountered!");
|
||||
|
||||
bool didMove = false;
|
||||
|
||||
|
@ -573,10 +582,10 @@ void GLWidget::mouseMoveEvent(QMouseEvent *event) {
|
|||
direction = trafo.inverse()(Vector(0,0,1));
|
||||
|
||||
if (camera->getViewTransform().det3x3() < 0) {
|
||||
camera->setInverseViewTransform(Transform::lookAt(p, p+direction, m_context->up));
|
||||
camera->setInverseViewTransform(Transform::lookAt(p, p+direction, up));
|
||||
} else {
|
||||
camera->setInverseViewTransform(
|
||||
Transform::lookAt(p, p+direction, m_context->up) *
|
||||
Transform::lookAt(p, p+direction, up) *
|
||||
Transform::scale(Vector(-1,1,1))
|
||||
);
|
||||
}
|
||||
|
@ -588,10 +597,10 @@ void GLWidget::mouseMoveEvent(QMouseEvent *event) {
|
|||
Float fovChange = rel.y() * m_mouseSensitivity * .03f;
|
||||
|
||||
if (camera->getViewTransform().det3x3() < 0) {
|
||||
m_context->up = Transform::rotate(direction, roll)(m_context->up);
|
||||
m_context->up = Transform::rotate(direction, roll)(up);
|
||||
camera->setInverseViewTransform(Transform::lookAt(p, p+direction, m_context->up));
|
||||
} else {
|
||||
m_context->up = Transform::rotate(direction, -roll)(m_context->up);
|
||||
m_context->up = Transform::rotate(direction, -roll)(up);
|
||||
camera->setInverseViewTransform(
|
||||
Transform::lookAt(p, p+direction, m_context->up) *
|
||||
Transform::scale(Vector(-1,1,1))
|
||||
|
@ -633,7 +642,7 @@ void GLWidget::wheelEvent(QWheelEvent *event) {
|
|||
|
||||
if (!bar->isVisible() || !m_preview->isRunning())
|
||||
return;
|
||||
|
||||
|
||||
int oldStep = bar->singleStep();
|
||||
bar->setSingleStep(event->delta()/4);
|
||||
#if defined(__OSX__)
|
||||
|
|
|
@ -32,6 +32,8 @@ public:
|
|||
|
||||
inline bool getInvertMouse() const { return m_invertMouse; }
|
||||
void setInvertMouse(bool invert) { m_invertMouse = invert; }
|
||||
inline ENavigationMode getNavigationMode() const { return m_navigationMode; }
|
||||
void setNavigationMode(ENavigationMode mode) { m_navigationMode = mode; }
|
||||
inline int getMouseSensitivity() const { return m_mouseSensitivity; }
|
||||
void setMouseSensitivity(int sensitivity) { m_mouseSensitivity = sensitivity; }
|
||||
void setScrollBars(QScrollBar *hScroll, QScrollBar *vScroll);
|
||||
|
@ -119,6 +121,7 @@ private:
|
|||
QTimer *m_movementTimer, *m_redrawTimer;
|
||||
QScrollBar *m_hScroll, *m_vScroll;
|
||||
ref<Timer> m_clock;
|
||||
ENavigationMode m_navigationMode;
|
||||
bool m_invertMouse, m_didSetCursor;
|
||||
bool m_ignoreScrollEvents, m_ignoreResizeEvents;
|
||||
int m_mouseSensitivity, m_softwareFallback;
|
||||
|
|
|
@ -146,6 +146,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
/* Load defaults from app settings file */
|
||||
ui->glView->setInvertMouse(settings.value("invertMouse", false).toBool());
|
||||
ui->glView->setMouseSensitivity(settings.value("mouseSensitivity", 3).toInt());
|
||||
ui->glView->setNavigationMode((ENavigationMode) settings.value("navigationMode",
|
||||
EFlythroughFixedYaw).toInt());
|
||||
m_searchPaths = settings.value("searchPaths", QStringList()).toStringList();
|
||||
m_blockSize = settings.value("blockSize", 32).toInt();
|
||||
m_listenPort = settings.value("listenPort", MTS_DEFAULT_PORT).toInt();
|
||||
|
@ -1016,6 +1018,7 @@ void MainWindow::on_actionSettings_triggered() {
|
|||
d.setWindowModality(Qt::ApplicationModal);
|
||||
d.setLogLevel(logger->getLogLevel());
|
||||
d.setInvertMouse(ui->glView->getInvertMouse());
|
||||
d.setNavigationMode(ui->glView->getNavigationMode());
|
||||
d.setMouseSensitivity(ui->glView->getMouseSensitivity());
|
||||
d.setBlockSize(m_blockSize);
|
||||
d.setSearchPaths(m_searchPaths);
|
||||
|
@ -1042,10 +1045,12 @@ void MainWindow::on_actionSettings_triggered() {
|
|||
settings.setValue("mouseSensitivity", d.getMouseSensitivity());
|
||||
settings.setValue("listenPort", d.getListenPort());
|
||||
settings.setValue("nodeName", d.getNodeName());
|
||||
settings.setValue("navigationMode", (int) d.getNavigationMode());
|
||||
|
||||
logger->setLogLevel(d.getLogLevel());
|
||||
ui->glView->setInvertMouse(d.getInvertMouse());
|
||||
ui->glView->setMouseSensitivity(d.getMouseSensitivity());
|
||||
ui->glView->setNavigationMode(d.getNavigationMode());
|
||||
m_blockSize = d.getBlockSize();
|
||||
m_searchPaths = d.getSearchPaths();
|
||||
m_checkForUpdates = d.getCheckForUpdates();
|
||||
|
|
|
@ -37,6 +37,14 @@ public:
|
|||
return ui->invertMouseBox->checkState() == Qt::Checked;
|
||||
}
|
||||
|
||||
inline ENavigationMode getNavigationMode() const {
|
||||
return (ENavigationMode) ui->navigationModeBox->currentIndex();
|
||||
}
|
||||
|
||||
inline void setNavigationMode(ENavigationMode mode) const {
|
||||
ui->navigationModeBox->setCurrentIndex(mode);
|
||||
}
|
||||
|
||||
inline void setInvertMouse(bool value) {
|
||||
ui->invertMouseBox->setCheckState(value ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>354</width>
|
||||
<height>485</height>
|
||||
<width>377</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -51,7 +51,7 @@
|
|||
<attribute name="title">
|
||||
<string>General</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout1" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0" columnstretch="0,0,0,1">
|
||||
<layout class="QGridLayout" name="gridLayout1" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" columnstretch="0,0,0,1">
|
||||
<property name="leftMargin">
|
||||
<number>15</number>
|
||||
</property>
|
||||
|
@ -186,7 +186,7 @@ system load, especially when much of the work is done over the network.</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="4">
|
||||
<item row="13" column="0" colspan="4">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
|
@ -199,7 +199,7 @@ system load, especially when much of the work is done over the network.</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1" colspan="3">
|
||||
<item row="15" column="1" colspan="3">
|
||||
<layout class="QHBoxLayout" name="buttonsLayout1" stretch="0,0,0">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
|
@ -286,50 +286,6 @@ system load, especially when much of the work is done over the network.</string>
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="toolTip">
|
||||
<string>Specifies the threshold for displaying log messages.
|
||||
For instance, setting this to "Info" means that everything
|
||||
above and including "Info" is written to the console.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Log verbosity :</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>logVerbosityBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="logVerbosityBox">
|
||||
<property name="toolTip">
|
||||
<string>Specifies the threshold for displaying log messages.
|
||||
For instance, setting this to "Info" means that everything
|
||||
above and including "Info" is written to the console.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Trace</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Debug</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Info</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Warn</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="font">
|
||||
|
@ -343,7 +299,7 @@ above and including "Info" is written to the console.</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="3">
|
||||
<item row="14" column="1" colspan="3">
|
||||
<widget class="QListWidget" name="searchPathList">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
|
@ -415,7 +371,7 @@ release via Internet every time it is started.</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2" colspan="2">
|
||||
<item row="10" column="2" colspan="2">
|
||||
<widget class="QSlider" name="sensitivitySlider">
|
||||
<property name="toolTip">
|
||||
<string>Specifies how sensitive the mouse should react to
|
||||
|
@ -450,7 +406,7 @@ movements while navigating in the realt-time preview.</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="toolTip">
|
||||
<string>Specifies how sensitive the mouse should react to
|
||||
|
@ -461,7 +417,7 @@ movements while navigating in the realt-time preview.</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="toolTip">
|
||||
<string>Should the preview navigation flip the Y axis of the mouse?</string>
|
||||
|
@ -474,7 +430,7 @@ movements while navigating in the realt-time preview.</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<item row="8" column="2">
|
||||
<widget class="QCheckBox" name="invertMouseBox">
|
||||
<property name="toolTip">
|
||||
<string>Should the preview navigation flip the Y axis of the mouse?</string>
|
||||
|
@ -493,6 +449,96 @@ movements while navigating in the realt-time preview.</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="toolTip">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This option specifies the camera behavior when navigating within the realtime preview.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Fly-through (Fix yaw)</span>: Always yaw around a fixed &quot;up&quot; axis, which is determined when a scene is loaded. This is intuitive and similar to a person walking through a scene, but assumes that the camera has already been set up correctly.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Fly-through</span>: Always yaw around the current camera &quot;up&quot; axis.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Navigation :</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>navigationModeBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="navigationModeBox">
|
||||
<property name="toolTip">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This option specifies the camera behavior when navigating within the realtime preview.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Fly-through (Fix yaw)</span>: Always yaw around a fixed &quot;up&quot; axis, which is determined when a scene is loaded. This is intuitive and similar to a person walking through a scene, but assumes that the camera has already been set up correctly.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Fly-through</span>: Always yaw around the current camera &quot;up&quot; axis.</p></body></html></string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fly-through (Fix yaw)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fly-through</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="logVerbosityBox">
|
||||
<property name="toolTip">
|
||||
<string>Specifies the threshold for displaying log messages.
|
||||
For instance, setting this to "Info" means that everything
|
||||
above and including "Info" is written to the console.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Trace</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Debug</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Info</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Warn</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="toolTip">
|
||||
<string>Specifies the threshold for displaying log messages.
|
||||
For instance, setting this to "Info" means that everything
|
||||
above and including "Info" is written to the console.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Log verbosity :</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>logVerbosityBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab2">
|
||||
|
@ -757,9 +803,10 @@ connections. The default setting is 7554.</string>
|
|||
<tabstop>blockSizeBox</tabstop>
|
||||
<tabstop>localWorkerBox</tabstop>
|
||||
<tabstop>checkForUpdatesBox</tabstop>
|
||||
<tabstop>logVerbosityBox</tabstop>
|
||||
<tabstop>navigationModeBox</tabstop>
|
||||
<tabstop>invertMouseBox</tabstop>
|
||||
<tabstop>sensitivitySlider</tabstop>
|
||||
<tabstop>logVerbosityBox</tabstop>
|
||||
<tabstop>searchPathList</tabstop>
|
||||
<tabstop>removePathButton</tabstop>
|
||||
<tabstop>addPathButton</tabstop>
|
||||
|
@ -782,8 +829,8 @@ connections. The default setting is 7554.</string>
|
|||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>280</x>
|
||||
<y>412</y>
|
||||
<x>286</x>
|
||||
<y>475</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>141</x>
|
||||
|
@ -798,8 +845,8 @@ connections. The default setting is 7554.</string>
|
|||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>309</x>
|
||||
<y>412</y>
|
||||
<x>315</x>
|
||||
<y>475</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>318</x>
|
||||
|
@ -831,7 +878,7 @@ connections. The default setting is 7554.</string>
|
|||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>175</x>
|
||||
<y>100</y>
|
||||
<y>90</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>26</x>
|
||||
|
@ -846,8 +893,8 @@ connections. The default setting is 7554.</string>
|
|||
<slot>refresh()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>224</x>
|
||||
<y>74</y>
|
||||
<x>175</x>
|
||||
<y>62</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>291</x>
|
||||
|
|
Loading…
Reference in New Issue