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 | |
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')
-rw-r--r-- | src/extras/defaults/qfirstpersoncameracontroller.cpp | 54 | ||||
-rw-r--r-- | src/extras/defaults/qforwardrenderer.cpp | 99 | ||||
-rw-r--r-- | src/extras/defaults/qorbitcameracontroller.cpp | 68 | ||||
-rw-r--r-- | src/extras/defaults/qorbitcameracontroller.h | 1 |
4 files changed, 186 insertions, 36 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); diff --git a/src/extras/defaults/qforwardrenderer.cpp b/src/extras/defaults/qforwardrenderer.cpp index 43d8c1029..d556b58d3 100644 --- a/src/extras/defaults/qforwardrenderer.cpp +++ b/src/extras/defaults/qforwardrenderer.cpp @@ -85,26 +85,46 @@ void QForwardRendererPrivate::init() } /*! - \class Qt3DRender::QForwardRenderer - \brief The Qt3DRender::QForwardRenderer provides a default \l {QFrameGraph}{FrameGraph} implementation of a forward renderer. - \inmodule Qt3DRender - \since 5.5 - - Forward rendering is how OpenGL is traditionally. It renders directly to the backbuffer + \class Qt3DExtras::QForwardRenderer + \brief The QForwardRenderer provides a default \l{Qt 3D Render Framegraph}{FrameGraph} + implementation of a forward renderer. + \inmodule Qt3DExtras + \since 5.7 + \inherits Qt3DRender::QTechniqueFilter + + Forward rendering is what OpenGL traditionally uses. It renders directly to the backbuffer one object at a time shading each one as it goes. - Internally the Qt3DRender::QForwardRenderer is a subclass of Qt3DRender::QTechniqueFilter. - This a is a single leaf Framegraph tree which contains a Qt3DRender::QViewport, a Qt3DRender::QCameraSelector - and a Qt3DRender::QClearBuffers. - The Qt3DRender::QForwardRenderer has a default requirement annotation whose name is "renderingStyle" and value "forward". - If you need to filter out your techniques, you should do so based on that annotation. + QForwardRenderer is a single leaf \l{Qt 3D Render Framegraph}{FrameGraph} tree which contains + a Qt3DRender::QViewport, a Qt3DRender::QCameraSelector, and a Qt3DRender::QClearBuffers. + The QForwardRenderer has a default requirement filter key whose name is "renderingStyle" and + value "forward". + If you need to filter out your techniques, you should do so based on that filter key. - By default the viewport occupies the whole screen and the clear color is white. Frustum culling is also enabled. + By default the viewport occupies the whole screen and the clear color is white. + Frustum culling is also enabled. */ - /*! - Constructs a new Qt3DRender::QForwardRenderer instance with parent object \a parent. + \qmltype ForwardRenderer + \brief The ForwardRenderer provides a default \l{Qt 3D Render Framegraph}{FrameGraph} + implementation of a forward renderer. + \since 5.7 + \inqmlmodule Qt3D.Extras + \instantiates Qt3DExtras::QForwardRenderer + + Forward rendering is what OpenGL traditionally uses. It renders directly to the backbuffer + one object at a time shading each one as it goes. + + ForwardRenderer is a single leaf \l{Qt 3D Render Framegraph}{FrameGraph} tree which contains + a Viewport, a CameraSelector, and a ClearBuffers. + The ForwardRenderer has a default requirement filter key whose name is "renderingStyle" and + value "forward". + If you need to filter out your techniques, you should do so based on that filter key. + + By default the viewport occupies the whole screen and the clear color is white. + Frustum culling is also enabled. */ + QForwardRenderer::QForwardRenderer(QNode *parent) : QTechniqueFilter(*new QForwardRendererPrivate, parent) { @@ -117,9 +137,6 @@ QForwardRenderer::QForwardRenderer(QNode *parent) d->init(); } -/*! - Destroys the QForwardRenderer instance. -*/ QForwardRenderer::~QForwardRenderer() { } @@ -136,11 +153,6 @@ void QForwardRenderer::setClearColor(const QColor &clearColor) d->m_clearBuffer->setClearColor(clearColor); } -/*! - Sets the camera which should be used to render the scene to \a camera. - - \note A camera is a QEntity having a QCameraLens as one of its components. -*/ void QForwardRenderer::setCamera(Qt3DCore::QEntity *camera) { Q_D(QForwardRenderer); @@ -160,10 +172,15 @@ void QForwardRenderer::setExternalRenderTargetSize(const QSize &size) } /*! - \property Qt3DRender::QForwardRenderer::viewportRect + \qmlproperty rect ForwardRenderer::viewportRect - Holds the current viewport normalizedRect. - */ + Holds the current normalized viewport rectangle. +*/ +/*! + \property QForwardRenderer::viewportRect + + Holds the current normalized viewport rectangle. +*/ QRectF QForwardRenderer::viewportRect() const { Q_D(const QForwardRenderer); @@ -171,9 +188,16 @@ QRectF QForwardRenderer::viewportRect() const } /*! - \property Qt3DRender::QForwardRenderer::clearColor + \qmlproperty color ForwardRenderer::clearColor + + Holds the current clear color of the scene. The frame buffer is initialized to the clear color + before rendering. +*/ +/*! + \property QForwardRenderer::clearColor - Holds the current clearColor. + Holds the current clear color of the scene. The frame buffer is initialized to the clear color + before rendering. */ QColor QForwardRenderer::clearColor() const { @@ -182,9 +206,16 @@ QColor QForwardRenderer::clearColor() const } /*! - \property Qt3DRender::QForwardRenderer::camera + \qmlproperty Entity ForwardRenderer::camera + + Holds the current camera entity used to render the scene. + + \note A camera is an Entity that has a CameraLens as one of its components. +*/ +/*! + \property QForwardRenderer::camera - Holds the current QEntity camera used to render the scene. + Holds the current camera entity used to render the scene. \note A camera is a QEntity that has a QCameraLens as one of its components. */ @@ -194,6 +225,16 @@ Qt3DCore::QEntity *QForwardRenderer::camera() const return d->m_cameraSelector->camera(); } +/*! + \qmlproperty Object ForwardRenderer::surface + + Holds the current render surface. +*/ +/*! + \property QForwardRenderer::surface + + Holds the current render surface. +*/ QObject *QForwardRenderer::surface() const { Q_D(const QForwardRenderer); diff --git a/src/extras/defaults/qorbitcameracontroller.cpp b/src/extras/defaults/qorbitcameracontroller.cpp index c12a78292..e340941a8 100644 --- a/src/extras/defaults/qorbitcameracontroller.cpp +++ b/src/extras/defaults/qorbitcameracontroller.cpp @@ -54,9 +54,46 @@ QT_BEGIN_NAMESPACE namespace Qt3DExtras { /*! - * \class QOrbitCameraController::QOrbitCameraController - * \internal - */ + \class Qt3DExtras::QOrbitCameraController + \brief The QOrbitCameraController class allows controlling the scene camera along orbital path. + \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 moves the camera + left and right and movement along y-axis moves it up and down. + \row + \li Right mouse button + \li While the right mouse button is pressed, mouse movement along x-axis pans the camera + around the camera view center and movement along y-axis tilts it around the camera + view center. + \row + \li Both left and right mouse button + \li While both the left and the right mouse button are pressed, mouse movement along y-axis + zooms the camera in and out without changing the view center. + \row + \li Arrow keys + \li Move the camera vertically and horizontally relative to camera viewport. + \row + \li Page up and page down keys + \li Move the camera forwards and backwards. + \row + \li Shift key + \li Changes the behavior of the up and down arrow keys to zoom the camera in and out + without changing the view center. The other movement keys are disabled. + \row + \li Alt key + \li Changes the behovior of the arrow keys to pan and tilt the camera around the view + center. Disables the page up and page down keys. + \endtable +*/ QOrbitCameraControllerPrivate::QOrbitCameraControllerPrivate() : Qt3DCore::QEntityPrivate() @@ -218,8 +255,8 @@ void QOrbitCameraControllerPrivate::_q_onTriggered(float dt) m_camera->translate(QVector3D(clampInputs(m_rxAxis->value(), m_txAxis->value()) * m_linearSpeed, clampInputs(m_ryAxis->value(), m_tyAxis->value()) * m_linearSpeed, 0) * dt); - return; } + return; } else if (m_rightMouseButtonAction->isActive()) { // Orbit @@ -258,24 +295,47 @@ QOrbitCameraController::~QOrbitCameraController() { } +/*! + \property QOrbitCameraController::camera + + Holds the currently controlled camera. +*/ Qt3DRender::QCamera *QOrbitCameraController::camera() const { Q_D(const QOrbitCameraController); return d->m_camera; } +/*! + \property QOrbitCameraController::linearSpeed + + Holds the current linear speed of the camera controller. Linear speed determines the + movement speed of the camera. +*/ float QOrbitCameraController::linearSpeed() const { Q_D(const QOrbitCameraController); return d->m_linearSpeed; } +/*! + \property QOrbitCameraController::lookSpeed + + Holds the current look speed of the camera controller. The look speed determines the turn rate + of the camera pan and tilt. +*/ float QOrbitCameraController::lookSpeed() const { Q_D(const QOrbitCameraController); return d->m_lookSpeed; } +/*! + \property QOrbitCameraController::zoomInLimit + + Holds the current zoom-in limit. The zoom-in limit determines how close to the view center + the camera can be zoomed. +*/ float QOrbitCameraController::zoomInLimit() const { Q_D(const QOrbitCameraController); diff --git a/src/extras/defaults/qorbitcameracontroller.h b/src/extras/defaults/qorbitcameracontroller.h index fb4d0aa7a..e48e39142 100644 --- a/src/extras/defaults/qorbitcameracontroller.h +++ b/src/extras/defaults/qorbitcameracontroller.h @@ -62,7 +62,6 @@ public: explicit QOrbitCameraController(Qt3DCore::QNode *parent = nullptr); ~QOrbitCameraController(); - float clampInputs(float input1, float input2); Qt3DRender::QCamera *camera() const; float linearSpeed() const; float lookSpeed() const; |