diff options
author | Liang Qi <liang.qi@qt.io> | 2016-09-20 10:39:32 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-09-20 10:39:32 +0200 |
commit | 0e3d54f8d7f9be26687afebcc9f456e4cefc2357 (patch) | |
tree | f3826c927305cc137006aed968be6fbf57b42009 /src/extras/defaults/qfirstpersoncameracontroller.cpp | |
parent | 52121396c55e6100316f006c87b4fdaa8b5a0719 (diff) | |
parent | 7e638edbd15640302516f9a69d20f62d26d4af06 (diff) |
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
src/render/framegraph/qrendersurfaceselector.cpp
src/render/frontend/qrendersettings.cpp
src/render/jobs/renderviewjobutils_p.h
tests/auto/render/render.pro
Change-Id: Ibe9eb962e3990e07f01a5608a2d60c79bc4c160f
Diffstat (limited to 'src/extras/defaults/qfirstpersoncameracontroller.cpp')
-rw-r--r-- | src/extras/defaults/qfirstpersoncameracontroller.cpp | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/src/extras/defaults/qfirstpersoncameracontroller.cpp b/src/extras/defaults/qfirstpersoncameracontroller.cpp index 37892d3d3..19446d3ba 100644 --- a/src/extras/defaults/qfirstpersoncameracontroller.cpp +++ b/src/extras/defaults/qfirstpersoncameracontroller.cpp @@ -188,12 +188,45 @@ void QFirstPersonCameraControllerPrivate::_q_onTriggered(float dt) m_tyAxis->value() * m_linearSpeed, m_tzAxis->value() * m_linearSpeed) * dt); if (m_leftMouseButtonAction->isActive()) { - m_camera->pan(m_rxAxis->value() * m_lookSpeed * dt, m_firstPersonUp); - m_camera->tilt(m_ryAxis->value() * m_lookSpeed * dt); + float lookSpeed = m_lookSpeed; + if (m_fineMotionAction->isActive()) + lookSpeed *= 0.2f; + m_camera->pan(m_rxAxis->value() * lookSpeed * dt, m_firstPersonUp); + m_camera->tilt(m_ryAxis->value() * lookSpeed * dt); } } } +/*! + \class Qt3DExtras::QFirstPersonCameraController + \brief The QFirstPersonCameraController class allows controlling the scene camera + from the first person perspective. + \inmodule Qt3DExtras + \since 5.7 + \inherits Qt3DCore::QEntity + + The controls are: + \table + \header + \li Input + \li Action + \row + \li Left mouse button + \li While the left mouse button is pressed, mouse movement along x-axis pans the camera and + movement along y-axis tilts it. + \row + \li Shift key + \li Turns the fine motion control active while pressed. Makes mouse pan and tilt less + sensitive. + \row + \li Arrow keys + \li Move the camera horizontally relative to camera viewport. + \row + \li Page up and page down keys + \li Move the camera vertically relative to camera viewport. + \endtable +*/ + QFirstPersonCameraController::QFirstPersonCameraController(Qt3DCore::QNode *parent) : Qt3DCore::QEntity(*new QFirstPersonCameraControllerPrivate, parent) { @@ -205,18 +238,35 @@ QFirstPersonCameraController::~QFirstPersonCameraController() { } +/*! + \property QFirstPersonCameraController::camera + + Holds the currently controlled camera. +*/ Qt3DRender::QCamera *QFirstPersonCameraController::camera() const { Q_D(const QFirstPersonCameraController); return d->m_camera; } +/*! + \property QFirstPersonCameraController::linearSpeed + + Holds the current linear speed of the camera controller. Linear speed determines the + movement speed of the camera. +*/ float QFirstPersonCameraController::linearSpeed() const { Q_D(const QFirstPersonCameraController); return d->m_linearSpeed; } +/*! + \property QFirstPersonCameraController::lookSpeed + + Holds the current look speed of the camera controller. The look speed determines the turn rate + of the camera pan and tilt. +*/ float QFirstPersonCameraController::lookSpeed() const { Q_D(const QFirstPersonCameraController); |