summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-20 10:39:32 +0200
committerLiang Qi <liang.qi@qt.io>2016-09-20 10:39:32 +0200
commit0e3d54f8d7f9be26687afebcc9f456e4cefc2357 (patch)
treef3826c927305cc137006aed968be6fbf57b42009
parent52121396c55e6100316f006c87b4fdaa8b5a0719 (diff)
parent7e638edbd15640302516f9a69d20f62d26d4af06 (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
-rw-r--r--examples/qt3d/simple-cpp/main.cpp4
-rw-r--r--src/doc/src/qmlextracontrollers.qdoc170
-rw-r--r--src/extras/defaults/qfirstpersoncameracontroller.cpp54
-rw-r--r--src/extras/defaults/qforwardrenderer.cpp99
-rw-r--r--src/extras/defaults/qorbitcameracontroller.cpp68
-rw-r--r--src/extras/defaults/qorbitcameracontroller.h1
-rw-r--r--src/extras/geometries/qcuboidgeometry.cpp34
-rw-r--r--src/input/frontend/qinputsettings.cpp56
-rw-r--r--src/input/frontend/qmousedevice.cpp63
-rw-r--r--src/logic/qframeaction.cpp26
-rw-r--r--src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml18
-rw-r--r--src/render/backend/renderview.cpp9
-rw-r--r--src/render/framegraph/qcameraselector.cpp38
-rw-r--r--src/render/framegraph/qclearbuffers.cpp56
-rw-r--r--src/render/framegraph/qframegraphnode.cpp109
-rw-r--r--src/render/framegraph/qlayerfilter.cpp32
-rw-r--r--src/render/framegraph/qrendersurfaceselector.cpp106
-rw-r--r--src/render/framegraph/qsortpolicy.cpp63
-rw-r--r--src/render/framegraph/qviewport.cpp54
-rw-r--r--src/render/frontend/qcameralens.cpp287
-rw-r--r--src/render/frontend/qpickingsettings.cpp89
-rw-r--r--src/render/frontend/qrendersettings.cpp96
-rw-r--r--src/render/io/qsceneloader.cpp130
-rw-r--r--src/render/jobs/loadscenejob.cpp16
-rw-r--r--src/render/jobs/renderviewjobutils.cpp17
-rw-r--r--src/render/jobs/renderviewjobutils_p.h5
-rw-r--r--src/render/materialsystem/qeffect.cpp40
-rw-r--r--src/render/materialsystem/qfilterkey.cpp40
-rw-r--r--src/render/materialsystem/qmaterial.cpp80
-rw-r--r--src/render/materialsystem/qrenderpass.cpp112
-rw-r--r--src/render/materialsystem/qrenderpass.h4
-rw-r--r--src/render/materialsystem/qshaderprogram.cpp139
-rw-r--r--src/render/materialsystem/qtechnique.cpp92
-rw-r--r--src/render/materialsystem/shaderdata.cpp195
-rw-r--r--src/render/materialsystem/shaderdata_p.h25
-rw-r--r--tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp180
-rw-r--r--tests/auto/render/loadscenejob/loadscenejob.pro12
-rw-r--r--tests/auto/render/loadscenejob/tst_loadscenejob.cpp287
-rw-r--r--tests/auto/render/render.pro1
-rw-r--r--tests/auto/render/renderviewutils/tst_renderviewutils.cpp46
-rw-r--r--tests/manual/bigscene-cpp/main.cpp2
-rw-r--r--tests/manual/deferred-renderer-cpp/main.cpp4
42 files changed, 2065 insertions, 894 deletions
diff --git a/examples/qt3d/simple-cpp/main.cpp b/examples/qt3d/simple-cpp/main.cpp
index d3a6728ca..32f19c194 100644
--- a/examples/qt3d/simple-cpp/main.cpp
+++ b/examples/qt3d/simple-cpp/main.cpp
@@ -59,8 +59,8 @@
#include <Qt3DInput/QInputAspect>
#include <Qt3DRender/QRenderAspect>
-#include <Qt3DExtras//QForwardRenderer>
-#include <Qt3DExtras//QPhongMaterial>
+#include <Qt3DExtras/QForwardRenderer>
+#include <Qt3DExtras/QPhongMaterial>
#include <Qt3DExtras/QCylinderMesh>
#include <Qt3DExtras/QSphereMesh>
#include <Qt3DExtras/QTorusMesh>
diff --git a/src/doc/src/qmlextracontrollers.qdoc b/src/doc/src/qmlextracontrollers.qdoc
new file mode 100644
index 000000000..737d0f823
--- /dev/null
+++ b/src/doc/src/qmlextracontrollers.qdoc
@@ -0,0 +1,170 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \qmltype FirstPersonCameraController
+ \inqmlmodule Qt3D.Extras
+ \brief The FirstPersonCameraController allows controlling the scene camera
+ from the first person perspective.
+ \since 5.7
+ \inherits Qt3D.Core::Entity
+
+ The FirstPersonCameraController allows controlling the scene camera from the first person
+ perspective.
+
+ 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
+*/
+/*!
+ \qmlproperty Camera FirstPersonCameraController::camera
+
+ Holds the currently controlled camera.
+*/
+/*!
+ \qmlproperty real FirstPersonCameraController::linearSpeed
+
+ Holds the current linear speed of the camera controller. Linear speed determines the
+ movement speed of the camera.
+*/
+/*!
+ \qmlproperty real FirstPersonCameraController::lookSpeed
+
+ Holds the current look speed of the camera controller. The look speed determines the turn rate
+ of the camera pan and tilt.
+*/
+/*!
+ \qmlproperty real FirstPersonCameraController::acceleration
+
+ Holds the current acceleration.
+ Specifies the rate at which the camera linear speed increases when a key is held.
+ If the acceleration is negative, the linear speed stays constant.
+ Defaults to -1.0.
+*/
+/*!
+ \qmlproperty real FirstPersonCameraController::deceleration
+
+ Specifies the rate at which the camera linear speed decreases when a key is released.
+ If the deceleration is negative, the linear speed stays constant.
+ Defaults to -1.0.
+*/
+
+/*!
+ \qmltype OrbitCameraController
+ \inqmlmodule Qt3D.Extras
+ \brief The OrbitCameraController class allows controlling the scene camera along orbital path.
+ \since 5.7
+ \inherits Qt3D.Core::Entity
+
+ The OrbitCameraController class allows controlling the scene camera along orbital path.
+
+ 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
+*/
+/*!
+ \qmlproperty Camera OrbitCameraController::camera
+
+ Holds the currently controlled camera.
+*/
+/*!
+ \qmlproperty real OrbitCameraController::linearSpeed
+
+ Holds the current linear speed of the camera controller. Linear speed determines the
+ movement speed of the camera.
+*/
+/*!
+ \qmlproperty real OrbitCameraController::lookSpeed
+
+ Holds the current look speed of the camera controller. The look speed determines the turn rate
+ of the camera pan and tilt.
+*/
+/*!
+ \qmlproperty real OrbitCameraController::zoomLimit
+
+ Holds the current zoom-in limit. The zoom-in limit determines how close to the view center
+ the camera can be zoomed.
+*/
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;
diff --git a/src/extras/geometries/qcuboidgeometry.cpp b/src/extras/geometries/qcuboidgeometry.cpp
index 49f1cbff0..0f7b5220f 100644
--- a/src/extras/geometries/qcuboidgeometry.cpp
+++ b/src/extras/geometries/qcuboidgeometry.cpp
@@ -76,23 +76,23 @@ void createPlaneVertexData(float w, float h, const QSize &resolution,
switch (normal) {
case NegativeX:
// Iterate over z
- for (int j = resolution.width() - 1; j >= 0; --j) {
- const float a = a0 + static_cast<float>(j) * da;
- const float u = static_cast<float>(j) * du;
+ for (int j = resolution.height() - 1; j >= 0; --j) {
+ const float b = b0 + static_cast<float>(j) * db;
+ const float v = static_cast<float>(j) * dv;
// Iterate over y
- for (int i = 0; i < resolution.height(); ++i) {
- const float b = b0 + static_cast<float>(i) * db;
- const float v = static_cast<float>(i) * dv;
+ for (int i = 0; i < resolution.width(); ++i) {
+ const float a = a0 + static_cast<float>(i) * da;
+ const float u = static_cast<float>(i) * du;
// position
*vertices++ = planeDistance;
- *vertices++ = b;
*vertices++ = a;
+ *vertices++ = b;
// texture coordinates
- *vertices++ = 1.0f - u;
*vertices++ = v;
+ *vertices++ = u;
// normal
*vertices++ = -1.0f;
@@ -102,8 +102,8 @@ void createPlaneVertexData(float w, float h, const QSize &resolution,
// tangent
*vertices++ = 0.0f;
*vertices++ = 0.0f;
- *vertices++ = -1.0f;
- *vertices++ = -1.0f;
+ *vertices++ = 1.0f;
+ *vertices++ = 1.0f;
}
}
break;
@@ -111,22 +111,22 @@ void createPlaneVertexData(float w, float h, const QSize &resolution,
case PositiveX: {
// Iterate over z
for (int j = 0; j < resolution.height(); ++j) {
- const float a = a0 + static_cast<float>(j) * da;
- const float u = static_cast<float>(j) * du;
+ const float b = b0 + static_cast<float>(j) * db;
+ const float v = static_cast<float>(j) * dv;
// Iterate over y
for (int i = 0; i < resolution.width(); ++i) {
- const float b = b0 + static_cast<float>(i) * db;
- const float v = static_cast<float>(i) * dv;
+ const float a = a0 + static_cast<float>(i) * da;
+ const float u = static_cast<float>(i) * du;
// position
*vertices++ = planeDistance;
- *vertices++ = b;
*vertices++ = a;
+ *vertices++ = b;
// texture coordinates
+ *vertices++ = 1.0f - v;
*vertices++ = u;
- *vertices++ = v;
// normal
*vertices++ = 1.0f;
@@ -136,8 +136,8 @@ void createPlaneVertexData(float w, float h, const QSize &resolution,
// tangent
*vertices++ = 0.0f;
*vertices++ = 0.0f;
- *vertices++ = 1.0f;
*vertices++ = -1.0f;
+ *vertices++ = 1.0f;
}
}
break;
diff --git a/src/input/frontend/qinputsettings.cpp b/src/input/frontend/qinputsettings.cpp
index 08e3ce300..34ed3b438 100644
--- a/src/input/frontend/qinputsettings.cpp
+++ b/src/input/frontend/qinputsettings.cpp
@@ -48,10 +48,15 @@ namespace Qt3DInput {
/*!
\class Qt3DInput::QInputSettings
\inmodule Qt3DInput
- \inherits Qt3DCore::QComponant
- \brief QInputSettings stores settings for the specified eventSource.
-
+ \inherits Qt3DCore::QComponent
+ \brief QInputSettings class holds the pointer to an input event source object.
\since 5.7
+
+ The QInputSettings component must be set as a component of the scene root entity.
+ It stores a pointer to the object that acts as the source of input events to be handled
+ by various input classes. For example, a QWindow instance can be an event source.
+
+ \sa QMouseDevice, QKeyboardDevice
*/
/*!
@@ -59,10 +64,14 @@ namespace Qt3DInput {
\inqmlmodule Qt3D.Input
\inherits Component3D
\instantiates Qt3DInput::QInputSettings
- \brief QML frontend for the Qt3DInput::QInputSettings C++ class.
-
- Stores settings the specified eventSource
+ \brief InputSettings holds the pointer to an input event source object.
\since 5.7
+
+ The InputSettings component must be set as a component of the scene root entity.
+ It stores a pointer to the object that acts as the source of input events to be handled
+ by various input classes. For example, a Window instance can be an event source.
+
+ \sa MouseDevice, KeyboardDevice
*/
QInputSettingsPrivate::QInputSettingsPrivate()
@@ -71,15 +80,11 @@ QInputSettingsPrivate::QInputSettingsPrivate()
{
}
-/*!
- Constructs a new QInputSettings instance with \a parent.
- */
QInputSettings::QInputSettings(Qt3DCore::QNode *parent)
: Qt3DCore::QComponent(*new QInputSettingsPrivate(), parent)
{
}
-/*! \internal */
QInputSettings::~QInputSettings()
{
}
@@ -87,41 +92,24 @@ QInputSettings::~QInputSettings()
/*!
\property QInputSettings::eventSource
- Holds the source for the QInputSettings.
+ Holds the current event source. An event source is an object that is capable
+ of receiving various input events, such as mouse or keyboard events.
+ Typically it is a QWindow instance.
*/
-/*!
- \fn QInputSettings::eventSourceChanged(QObject *)
-
- This signal is emitted when the even source associated with the input setting is changed.
-*/
/*!
- \qmlproperty QObject Qt3D.Input::InputSettings::eventSource
+ \qmlproperty Object InputSettings::eventSource
- The current event source of the InputSettings object
+ Holds the current event source. An event source is an object that is capable
+ of receiving various input events, such as mouse or keyboard events.
+ Typically it is a Window instance.
*/
-
-/*!
- \qmlsignal Qt3D.Input::InputSettings::ventSourceChanged(QObject *)
-
- This signal is emitted when the even source associated with the input setting is changed.
-
- The corresponding handler is \c onEventSourceChanged
-*/
-
-/*!
- * \brief QInputSettings::eventSource
- * \return the current event source of the QInputSettings instance.
- */
QObject *QInputSettings::eventSource() const
{
Q_D(const QInputSettings);
return d->m_eventSource;
}
-/*!
- Set the current event source of the QInputSettings instance to \a eventSource.
- */
void QInputSettings::setEventSource(QObject *eventSource)
{
Q_D(QInputSettings);
diff --git a/src/input/frontend/qmousedevice.cpp b/src/input/frontend/qmousedevice.cpp
index d5cdc9478..56d3731ce 100644
--- a/src/input/frontend/qmousedevice.cpp
+++ b/src/input/frontend/qmousedevice.cpp
@@ -45,35 +45,43 @@
QT_BEGIN_NAMESPACE
namespace Qt3DInput {
+
/*! \internal */
QMouseDevicePrivate::QMouseDevicePrivate()
: QAbstractPhysicalDevicePrivate()
, m_sensitivity(0.1f)
{
}
-/*!
- * \qmltype MouseDevice
- * \instantiates Qt3DInput::QMouseDevice
- * \inqmlmodule Qt3D.Input
- * \since 5.5
- * \brief Delegates mouse events to the attached MouseHandler objects.
- * \TODO
- * \sa MouseHandler
- */
/*!
- * \class Qt3DInput::QMouseDevice
- * \inmodule Qt3DInput
- *
- * \brief QMouseDevice is in charge of dispatching mouse events to
- * attached QMouseHandler objects.
- *
- * \since 5.5
- * \sa QMouseHandler
+ \qmltype MouseDevice
+ \instantiates Qt3DInput::QMouseDevice
+ \inqmlmodule Qt3D.Input
+ \since 5.5
+ \brief Delegates mouse events to the attached MouseHandler objects.
+
+ A MouseDevice delegates mouse events from physical mouse device to
+ MouseHandler objects. The sensitivity of the mouse can be controlled
+ with the \l MouseDevice::sensitivity property, which specifies the rate
+ in which the logical mouse coordinates change in response to physical
+ movement of the mouse.
+
+ \sa MouseHandler
*/
/*!
- \qmlproperty real MouseDevice::sensitivity
+ \class Qt3DInput::QMouseDevice
+ \inmodule Qt3DInput
+ \since 5.5
+ \brief Delegates mouse events to the attached MouseHandler objects.
+
+ A QMouseDevice delegates mouse events from physical mouse device to
+ QMouseHandler objects. The sensitivity of the mouse can be controlled
+ with the \l QMouseDevice::sensitivity property, which specifies the rate
+ in which the logical mouse coordinates change in response to physical
+ movement of the mouse.
+
+ \sa QMouseHandler
*/
/*!
@@ -90,6 +98,20 @@ QMouseDevicePrivate::QMouseDevicePrivate()
*/
/*!
+ \qmlproperty real MouseDevice::sensitivity
+
+ Holds the current sensitivity of the mouse device.
+ Default is 0.1.
+ */
+
+/*!
+ \property Qt3DInput::QMouseDevice::sensitivity
+
+ Holds the sensitivity of the mouse device.
+ Default is 0.1.
+ */
+
+/*!
Constructs a new QMouseDevice instance with parent \a parent.
*/
QMouseDevice::QMouseDevice(QNode *parent)
@@ -165,11 +187,6 @@ int QMouseDevice::axisIdentifier(const QString &name) const
return -1;
}
-/*!
- \property Qt3DInput::QMouseDevice::sensitivity
-
- The sensitivity of the device.
- */
float QMouseDevice::sensitivity() const
{
Q_D(const QMouseDevice);
diff --git a/src/logic/qframeaction.cpp b/src/logic/qframeaction.cpp
index a7ca8d5d4..fa4cefe06 100644
--- a/src/logic/qframeaction.cpp
+++ b/src/logic/qframeaction.cpp
@@ -55,8 +55,8 @@ QFrameActionPrivate::QFrameActionPrivate()
\since 5.5
\brief Provides a way to have a synchronous function executed each frame.
- The QFrameAction provides a way to perform tasks each frame in
- synchronized with the Qt3D backend. This is useful to implement some
+ The QFrameAction provides a way to perform tasks each frame in a
+ synchronized way with the Qt3D backend. This is useful to implement some
aspects of application logic and to prototype functionality that can later
be folded into an additional Qt3D aspect.
@@ -64,7 +64,7 @@ QFrameActionPrivate::QFrameActionPrivate()
with the Qt3D engine where a Qt Quick animation element is not perfectly
synchronized and may lead to stutters in some cases.
- To execute your own code each frame override the onTriggered function.
+ To execute your own code each frame connect to the QFrameAction::triggered signal.
*/
/*!
@@ -73,6 +73,18 @@ QFrameActionPrivate::QFrameActionPrivate()
\instantiates Qt3DLogic::QFrameAction
\inherits Component3D
\since 5.5
+ \brief Provides a way to have a synchronous function executed each frame.
+
+ The FrameAction provides a way to perform tasks each frame in a
+ synchronized way with the Qt3D backend. This is useful to implement some
+ aspects of application logic and to prototype functionality that can later
+ be folded into an additional Qt3D aspect.
+
+ For example, the FrameAction can be used to animate a property in sync
+ with the Qt3D engine where a Qt Quick animation element is not perfectly
+ synchronized and may lead to stutters in some cases.
+
+ To execute your own code each frame connect to the FrameAction::triggered signal.
*/
/*!
@@ -107,15 +119,13 @@ void QFrameAction::onTriggered(float dt)
}
/*!
- \qmlsignal Qt3D.Logic::FrameAction::triggered(float dt)
+ \qmlsignal Qt3D.Logic::FrameAction::triggered(real dt)
This signal is emitted each frame.
-
- The corresponding handler is \c onTriggered
*/
/*!
- \fn QFrameAction::triggered(float dt)
- This signal is emitted each frame with \a dt being the time since the last triggering.
+ \fn QFrameAction::triggered(float dt)
+ This signal is emitted each frame with \a dt being the time since the last triggering.
*/
} // namespace Qt3DLogic
diff --git a/src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml b/src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml
index 4e3af0352..ae8869473 100644
--- a/src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml
+++ b/src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml
@@ -163,13 +163,13 @@ Entity {
id: keyboardZAxis
ButtonAxisInput {
sourceDevice: keyboardSourceDevice
- buttons: [Qt.Key_Up]
- scale: d.shiftPressed ? 1.0 : 0.0
+ buttons: [Qt.Key_PageUp]
+ scale: 1.0
}
ButtonAxisInput {
sourceDevice: keyboardSourceDevice
- buttons: [Qt.Key_Down]
- scale: d.shiftPressed ? -1.0 : 0.0
+ buttons: [Qt.Key_PageDown]
+ scale: -1.0
}
},
Axis {
@@ -177,12 +177,12 @@ Entity {
ButtonAxisInput {
sourceDevice: keyboardSourceDevice
buttons: [Qt.Key_Up]
- scale: d.shiftPressed ? 0.0 : 1.0
+ scale: 1.0
}
ButtonAxisInput {
sourceDevice: keyboardSourceDevice
buttons: [Qt.Key_Down]
- scale: d.shiftPressed ? 0.0 : -1.0
+ scale: -1.0
}
}
] // axes
@@ -206,8 +206,8 @@ Entity {
} else {
// Translate
root.camera.translate(Qt.vector3d(d.translationX, d.translationY, 0).times(dt));
- return
}
+ return
} else if (d.rightMouseButtonPressed) {
// Orbit
root.camera.panAboutViewCenter(d.orbitX * dt, d.firstPersonUp);
@@ -221,14 +221,14 @@ Entity {
} else if (d.shiftPressed) {
if (zoomDistance(root.camera.position, root.camera.viewCenter) > root.zoomLimit * root.zoomLimit) {
// Dolly up to limit
- root.camera.translate(Qt.vector3d(0, 0, d.translationZ).times(dt), Camera.DontTranslateViewCenter);
+ root.camera.translate(Qt.vector3d(0, 0, d.translationY).times(dt), Camera.DontTranslateViewCenter);
} else {
// Too close, Dolly backwards
root.camera.translate(Qt.vector3d(0, 0, -1).times(dt), Camera.DontTranslateViewCenter);
}
} else {
// Translate
- root.camera.translate(Qt.vector3d(d.translationX, d.translationY, 0).times(dt));
+ root.camera.translate(Qt.vector3d(d.translationX, d.translationY, d.translationZ).times(dt));
}
}
}
diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp
index 8594f2d20..df165e2d0 100644
--- a/src/render/backend/renderview.cpp
+++ b/src/render/backend/renderview.cpp
@@ -651,10 +651,8 @@ void RenderView::setDefaultUniformBlockShaderDataValue(ShaderParameterPack &unif
UniformBlockValueBuilder *builder = m_localData.localData();
builder->activeUniformNamesToValue.clear();
- // updates transformed properties;
- // Fix me: this will lead to races when having multiple cameras
- shaderData->updateViewTransform(m_data.m_viewMatrix);
-
+ // Set the view matrix to be used to transform "Transformed" properties in the ShaderData
+ builder->viewMatrix = m_data.m_viewMatrix;
// Force to update the whole block
builder->updatedPropertiesOnly = false;
// Retrieve names and description of each active uniforms in the uniform block
@@ -801,6 +799,9 @@ void RenderView::setShaderAndUniforms(RenderCommand *command, RenderPass *rPass,
setUniformValue(command->m_parameterPack, LIGHT_COLOR_NAMES[lightIdx], QVector3D(1.0f, 1.0f, 1.0f));
setUniformValue(command->m_parameterPack, LIGHT_INTENSITY_NAMES[lightIdx], 0.5f);
+ // There is no risk in doing that even if multithreaded
+ // since we are sure that a shaderData is unique for a given light
+ // and won't ever be referenced as a Component either
QMatrix4x4 *worldTransform = lightEntity->worldTransform();
if (worldTransform)
shaderData->updateWorldTransform(*worldTransform);
diff --git a/src/render/framegraph/qcameraselector.cpp b/src/render/framegraph/qcameraselector.cpp
index a9188cd99..c7d299b9b 100644
--- a/src/render/framegraph/qcameraselector.cpp
+++ b/src/render/framegraph/qcameraselector.cpp
@@ -48,13 +48,15 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
/*!
- \class Qt3DRender::QCameraSelector
- \inmodule Qt3DRender
- \since 5.5
- \ingroup framegraph
+ \class Qt3DRender::QCameraSelector
+ \inmodule Qt3DRender
+ \since 5.5
+ \ingroup framegraph
- \brief Class to allow for selection of camera to be used
+ \brief Class to allow for selection of camera to be used
+ A Qt3DRender::QCameraSelector can be used to select the camera, which is used
+ by the FrameGraph when drawing the entities.
*/
/*!
@@ -63,9 +65,25 @@ namespace Qt3DRender {
\instantiates Qt3DRender::QCameraSelector
\inherits FrameGraphNode
\since 5.5
- \qmlabstract
+ \brief Class to allow for selection of camera to be used
+
+ A CameraSelector can be used to select the camera, which is used
+ by the FrameGraph when drawing the entities.
+*/
+
+/*!
+ \qmlproperty Entity Qt3D.Render::CameraSelector::camera
+
+ Holds the currently selected camera.
*/
+/*!
+ \property Qt3DRender::QCameraSelector::camera
+
+ Holds the currently selected camera.
+*/
+
+
/*! \internal */
QCameraSelector::QCameraSelector(QCameraSelectorPrivate &dd, QNode *parent)
: QFrameGraphNode(dd, parent)
@@ -91,14 +109,6 @@ QCameraSelector::~QCameraSelector()
{
}
-/*!
- \property Qt3DRender::QCameraSelector::camera
-*/
-
-/*!
- \qmlproperty Entity Qt3D.Render::CameraSelector::camera
-
-*/
void QCameraSelector::setCamera(Qt3DCore::QEntity *camera)
{
Q_D(QCameraSelector);
diff --git a/src/render/framegraph/qclearbuffers.cpp b/src/render/framegraph/qclearbuffers.cpp
index 1e8a5c6e3..6fec60364 100644
--- a/src/render/framegraph/qclearbuffers.cpp
+++ b/src/render/framegraph/qclearbuffers.cpp
@@ -45,12 +45,14 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
/*!
- \class Qt3DRender::QClearBuffers
- \inmodule Qt3DRender
- \since 5.7
- \ingroup framegraph
+ \class Qt3DRender::QClearBuffers
+ \inmodule Qt3DRender
+ \since 5.7
+ \ingroup framegraph
+ \brief Class to clear buffers
- \brief Class to clear buffers
+ A Qt3DRender::QClearBuffers FrameGraph node enables clearing of the specific
+ render target buffers with specific values.
*/
/*!
@@ -59,21 +61,24 @@ namespace Qt3DRender {
\instantiates Qt3DRender::QClearBuffers
\inherits FrameGraphNode
\since 5.7
- \qmlabstract
+ \brief Class to clear buffers
+
+ A Qt3DRender::QClearBuffers FrameGraph node enables clearing of the specific
+ render target buffers with specific values.
*/
/*!
\enum QClearBuffers::BufferType
This enum type describes types of buffer to be cleared.
- \value None
- \value ColorBuffer
- \value DepthBuffer
- \value StencilBuffer
- \value DepthStencilBuffer
- \value ColorDepthBuffer
- \value ColorDepthStencilBuffer
- \value AllBuffers
+ \value None No buffers will be cleared
+ \value ColorBuffer Clear color buffers
+ \value DepthBuffer Clear depth buffer
+ \value StencilBuffer Clear stencil buffer
+ \value DepthStencilBuffer Clear depth and stencil buffers
+ \value ColorDepthBuffer Clear color and depth buffers
+ \value ColorDepthStencilBuffer Clear color, depth and stencil buffers
+ \value AllBuffers Clear all buffers
*/
QClearBuffersPrivate::QClearBuffersPrivate()
@@ -86,7 +91,7 @@ QClearBuffersPrivate::QClearBuffersPrivate()
}
/*!
- The constructor creates an instance with the specified \a parent.
+ The constructor creates an instance with the specified \a parent.
*/
QClearBuffers::QClearBuffers(QNode *parent)
: QFrameGraphNode(*new QClearBuffersPrivate, parent)
@@ -141,8 +146,8 @@ QRenderTargetOutput *QClearBuffers::colorBuffer() const
*/
/*!
- \qmlproperty BufferType Qt3D.Render::ClearBuffers::buffers
-
+ \qmlproperty enumeration Qt3D.Render::ClearBuffers::buffers
+ Specifies the buffer type to be used.
*/
void QClearBuffers::setBuffers(QClearBuffers::BufferType buffers)
{
@@ -158,8 +163,8 @@ void QClearBuffers::setBuffers(QClearBuffers::BufferType buffers)
Specifies the clear color to be used.
*/
/*!
- \qmlproperty Color Qt3D.Render::ClearBuffers::color
-
+ \qmlproperty color Qt3D.Render::ClearBuffers::color
+ Specifies the clear color to be used.
*/
void QClearBuffers::setClearColor(const QColor &color)
{
@@ -176,8 +181,8 @@ void QClearBuffers::setClearColor(const QColor &color)
Specifies the clear depth value to be used.
*/
/*!
- \qmlproperty float Qt3D.Render::ClearBuffers::clearDepthValue
-
+ \qmlproperty real Qt3D.Render::ClearBuffers::clearDepthValue
+ Specifies the clear depth value to be used.
*/
void QClearBuffers::setClearDepthValue(float clearDepthValue)
{
@@ -196,8 +201,8 @@ void QClearBuffers::setClearDepthValue(float clearDepthValue)
Specifies the stencil value to be used.
*/
/*!
- \qmlproperty int Qt3D.Render::ClearBuffers::clearStencilValue
-
+ \qmlproperty int Qt3D.Render::ClearBuffers::clearStencilValue
+ Specifies the stencil value to be used.
*/
void QClearBuffers::setClearStencilValue(int clearStencilValue)
{
@@ -214,8 +219,9 @@ void QClearBuffers::setClearStencilValue(int clearStencilValue)
ColorBuffer flag is set, all color buffers will be cleared.
*/
/*!
- \qmlproperty Qt3D.Render::RenderTargetOutput Qt3D.Render::ClearBuffers::colorbuffer
-
+ \qmlproperty RenderTargetOutput Qt3D.Render::ClearBuffers::colorbuffer
+ Specifies a specific color buffer to clear. If set to NULL (default), and
+ ColorBuffer flag is set, all color buffers will be cleared.
*/
void QClearBuffers::setColorBuffer(QRenderTargetOutput *buffer)
{
diff --git a/src/render/framegraph/qframegraphnode.cpp b/src/render/framegraph/qframegraphnode.cpp
index add8fc75d..c60c859ac 100644
--- a/src/render/framegraph/qframegraphnode.cpp
+++ b/src/render/framegraph/qframegraphnode.cpp
@@ -50,14 +50,57 @@ QFrameGraphNodePrivate::QFrameGraphNodePrivate()
}
/*!
- \class Qt3DRender::QFrameGraphNode
- \inmodule Qt3DRender
- \since 5.5
-
- \brief Base class of all FrameGraph configuration nodes.
+ \class Qt3DRender::QFrameGraphNode
+ \inmodule Qt3DRender
+ \since 5.5
- This is an abstract class so it cannot be instanced directly
- but rather through one of its subclasses.
+ \brief Base class of all FrameGraph configuration nodes.
+
+ This is an abstract class so it cannot be instanced directly
+ but rather through one of its subclasses.
+
+ The subclasses are:
+ \table
+ \header
+ \li class
+ \li description
+ \row
+ \li Qt3DRender::QCameraSelector
+ \li Select camera from all available cameras in the scene
+ \row
+ \li Qt3DRender::QClearBuffers
+ \li Specify which buffers to clear and to what values
+ \row
+ \li Qt3DRender::QDispatchCompute
+ \li Specify Compute operation kernels
+ \row
+ \li Qt3DRender::QFrustumCulling
+ \li Enable frustum culling
+ \row
+ \li Qt3DRender::QLayerFilter
+ \li Select which layers to draw
+ \row
+ \li Qt3DRender::QNoDraw
+ \li Disable drawing
+ \row
+ \li Qt3DRender::QRenderPassFilter
+ \li Select which render passes to draw
+ \row
+ \li Qt3DRender::QRenderStateSet
+ \li Set render states
+ \row
+ \li Qt3DRender::QRenderSurfaceSelector
+ \li Select which surface to draw to
+ \row
+ \li Qt3DRender::QSortPolicy
+ \li Specify how entities are sorted to determine draw order
+ \row
+ \li Qt3DRender::QTechniqueFilter
+ \li Select which techniques to draw
+ \row
+ \li Qt3DRender::QViewport
+ \li Specify viewport
+ \endtable
*/
@@ -67,11 +110,57 @@ QFrameGraphNodePrivate::QFrameGraphNodePrivate()
\instantiates Qt3DRender::QFrameGraphNode
\inherits Node
\since 5.5
- \qmlabstract
+ \brief Base class of all FrameGraph configuration nodes.
+
+ This is an abstract class so it cannot be instanced directly
+ but rather through one of its subclasses.
+
+ The subclasses are:
+ \table
+ \header
+ \li class
+ \li description
+ \row
+ \li CameraSelector
+ \li Select camera from all available cameras in the scene
+ \row
+ \li ClearBuffers
+ \li Specify which buffers to clear and to what values
+ \row
+ \li DispatchCompute
+ \li Specify Compute operation kernels
+ \row
+ \li FrustumCulling
+ \li Enable frustum culling
+ \row
+ \li LayerFilter
+ \li Select which layers to draw
+ \row
+ \li NoDraw
+ \li Disable drawing
+ \row
+ \li RenderPassFilter
+ \li Select which render passes to draw
+ \row
+ \li RenderStateSet
+ \li Set render states
+ \row
+ \li RenderSurfaceSelector
+ \li Select which surface to draw to
+ \row
+ \li SortPolicy
+ \li Specify how entities are sorted to determine draw order
+ \row
+ \li TechniqueFilter
+ \li Select which techniques to draw
+ \row
+ \li Viewport
+ \li Specify viewport
+ \endtable
*/
/*!
- The constructor creates an instance with the specified \a parent.
+ The constructor creates an instance with the specified \a parent.
*/
QFrameGraphNode::QFrameGraphNode(QNode *parent)
: QNode(*new QFrameGraphNodePrivate, parent)
@@ -84,7 +173,7 @@ QFrameGraphNode::~QFrameGraphNode()
}
/*!
- Returns a pointer to the parent.
+ Returns a pointer to the parent.
*/
QFrameGraphNode *QFrameGraphNode::parentFrameGraphNode() const
{
diff --git a/src/render/framegraph/qlayerfilter.cpp b/src/render/framegraph/qlayerfilter.cpp
index 92c1e1266..f7f4dd12c 100644
--- a/src/render/framegraph/qlayerfilter.cpp
+++ b/src/render/framegraph/qlayerfilter.cpp
@@ -59,7 +59,10 @@ QLayerFilterPrivate::QLayerFilterPrivate()
\since 5.5
\brief Controls layers Drawn in a frame graph branch.
- A QLayerFiler can be used to instruct the renderer as to which layer(s) to draw in that branch of the frame graph.
+ A Qt3DRender::QLayerFilter can be used to instruct the renderer as to which layer(s)
+ to draw in that branch of the frame graph. The Qt3DRender::QLayerFilter selects which
+ entities to draw based on the Qt3DRender::QLayer instances added to the QLayerFilter
+ and as components to the \l Qt3DCore::QEntity.
*/
/*!
@@ -70,12 +73,20 @@ QLayerFilterPrivate::QLayerFilterPrivate()
\since 5.5
\brief Controls layers Drawn in a frame graph branch.
- A QLayerFiler can be used to instruct the renderer as to which layer(s) to draw in that branch of the frame graph.
+ A LayerFilter can be used to instruct the renderer as to which layer(s)
+ to draw in that branch of the frame graph. The LayerFilter selects which
+ entities to draw based on the \l Layer instances added to the LayerFilter
+ and as components to the \l Entity.
*/
+/*!
+ \qmlproperty list<Layer> Qt3D.Render::LayerFilter::layers
+ Holds a list of layers specifying the layers to select for drawing.
+ \readonly
+ */
/*!
- The constructor creates an instance with the specified \a parent.
+ The constructor creates an instance with the specified \a parent.
*/
QLayerFilter::QLayerFilter(QNode *parent)
: QFrameGraphNode(*new QLayerFilterPrivate, parent)
@@ -94,16 +105,7 @@ QLayerFilter::~QLayerFilter()
}
/*!
- \property Qt3DRender::QLayerFilter::layers
-
- */
-
-/*!
- \qmlproperty stringlist Qt3D.Render::LayerFilter::layers
-
-*/
-/*!
- Add \a layer to the current list of layers
+ Add \a layer to the current list of layers
*/
void QLayerFilter::addLayer(QLayer *layer)
{
@@ -131,7 +133,7 @@ void QLayerFilter::addLayer(QLayer *layer)
}
/*!
- Remove \a layer from the current list of layers
+ Remove \a layer from the current list of layers
*/
void QLayerFilter::removeLayer(QLayer *layer)
{
@@ -148,7 +150,7 @@ void QLayerFilter::removeLayer(QLayer *layer)
}
/*!
- \return the current list of layers
+ \return the current list of layers
*/
QVector<QLayer *> QLayerFilter::layers() const
{
diff --git a/src/render/framegraph/qrendersurfaceselector.cpp b/src/render/framegraph/qrendersurfaceselector.cpp
index 4063f4997..905669ff9 100644
--- a/src/render/framegraph/qrendersurfaceselector.cpp
+++ b/src/render/framegraph/qrendersurfaceselector.cpp
@@ -52,57 +52,70 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
/*!
- * \class Qt3DRender::QRenderSurfaceSelector
- * \inmodule Qt3DRender
- * \brief Provides a way of specifying the render surface
- * \since 5.7
- *
- * \inherits Qt3DRender::QFrameGraphNode
- *
- * Qt3DRender::QRenderSurfaceSelector specifies which window should be used for
- * the rendering of a FrameGraph branch. In some cases you may also want to
- * specify the size of what needs to be drawn when rendering with a frame
- * buffer object. In such cases, the externalRenderTargetSize should be set and
- * updated accordingly. If it is not set, the renderer will assume it should use
- * the surface's size.
- *
+ \class Qt3DRender::QRenderSurfaceSelector
+ \inmodule Qt3DRender
+ \brief Provides a way of specifying the render surface
+ \since 5.7
+
+ The Qt3DRender::QRenderSurfaceSelector can be used to select the surface, where
+ Qt3D renders the content. The surface can either be window surface or offscreen
+ surface. The externalRenderTargetSize is used to specify the actual size of the
+ surface when offscreen surface is used.
+
+ When DPI scaling is used by the system, the logical surface size, which is used
+ by mouse events, and the actual 'physical' size of the surface can differ.
+ The surfacePixelRatio is the factor to convert the logical size to the physical
+ size.
+
+ \sa QWindow, QOffscreenSurface, QSurface
*/
/*!
- * \qmltype RenderSurfaceSelector
- * \inqmlmodule Qt3D.Render
- * \since 5.7
- * \ingroup
- * \instantiates Qt3DRender::QRenderSurfaceSelector
- * \brief Provides a way of specifying the render surface
- *
- * RenderSurfaceSelector specifies which window should be used for
- * the rendering of a FrameGraph branch. In some cases you may also want to
- * specify the size of what needs to be drawn when rendering with a frame
- * buffer object. In such cases, the externalRenderTargetSize should be set and
- * updated accordingly. If it is not set, the renderer will assume it should use
- * the surface's size.
- *
+ \qmltype RenderSurfaceSelector
+ \inqmlmodule Qt3D.Render
+ \since 5.7
+ \instantiates Qt3DRender::QRenderSurfaceSelector
+ \inherits FrameGraphNode
+ \brief Provides a way of specifying the render surface
+
+ The RenderSurfaceSelector can be used to select the surface, where
+ Qt3D renders the content. The surface can either be window surface or offscreen
+ surface. The externalRenderTargetSize is used to specify the actual size of the
+ render target when offscreen surface is used.
+
+ When DPI scaling is used by the system, the logical surface size, which is used
+ by mouse events, and the actual 'physical' size of the surface can differ.
+ The surfacePixelRatio is the factor to convert the logical size to the physical
+ size.
*/
/*! \qmlproperty QSurface Qt3D.Render::RenderSurfaceSelector::surface
- *
- * Holds the surface.
+ Holds the surface.
*/
-/*!
- * \property QRenderSurfaceSelector::surface
- * Holds the surface
+/*! \qmlproperty size Qt3D.Render::RenderSurfaceSelector::externalRenderTargetSize
+
+ Holds the size of the external render target.
+ */
+
+/*! \qmlproperty real Qt3D.Render::RenderSurfaceSelector::surfacePixelRatio
+
+ Holds the surfacePixelRatio of the surface.
*/
-/*! \qmlproperty QSize Qt3D.Render::RenderSurfaceSelector::externalRenderTargetSize
- *
- * Holds the size of the external render target.
+/*!
+ \property QRenderSurfaceSelector::surface
+ Holds the surface
*/
/*!
- * \property QRenderSurfaceSelector::externalRenderTargetSize
- * Holds the size of the external render target.
+ \property QRenderSurfaceSelector::externalRenderTargetSize
+ Holds the size of the external render target.
+ */
+
+/*! \property QRenderSurfaceSelector::surfacePixelRatio
+
+ Holds the surfacePixelRatio of the surface.
*/
QRenderSurfaceSelectorPrivate::QRenderSurfaceSelectorPrivate()
@@ -150,7 +163,7 @@ void QRenderSurfaceSelectorPrivate::setExternalRenderTargetSize(const QSize &siz
}
/*!
- * Constructs QRenderSurfaceSelector with given \a parent.
+ Constructs QRenderSurfaceSelector with given \a parent.
*/
QRenderSurfaceSelector::QRenderSurfaceSelector(Qt3DCore::QNode *parent)
: Qt3DRender::QFrameGraphNode(*new QRenderSurfaceSelectorPrivate, parent)
@@ -158,14 +171,14 @@ QRenderSurfaceSelector::QRenderSurfaceSelector(Qt3DCore::QNode *parent)
}
/*!
- * \internal
+ \internal
*/
QRenderSurfaceSelector::~QRenderSurfaceSelector()
{
}
/*!
- * \internal
+ \internal
*/
QRenderSurfaceSelector::QRenderSurfaceSelector(QRenderSurfaceSelectorPrivate &dd, Qt3DCore::QNode *parent)
: Qt3DRender::QFrameGraphNode(dd, parent)
@@ -192,9 +205,8 @@ QObject *QRenderSurfaceSelector::surface() const
return surfaceObj;
}
-/*! \property QRenderSurfaceSelector::surface
- *
- * Sets \a surface.
+/*!
+ Sets \a surfaceObject.
*/
void QRenderSurfaceSelector::setSurface(QObject *surfaceObject)
{
@@ -211,7 +223,7 @@ void QRenderSurfaceSelector::setSurface(QObject *surfaceObject)
surface = static_cast<QSurface *>(offscreen);
}
- Q_ASSERT_X(surface, Q_FUNC_INFO, "surfaceObject is not a valid QSurface * object");
+ Q_ASSERT_X(surface, Q_FUNC_INFO, "surfaceObject is not a valid QSurface object");
}
if (d->m_surface == surface)
@@ -299,8 +311,8 @@ float QRenderSurfaceSelector::surfacePixelRatio() const
return d->m_surfacePixelRatio;
}
/*!
- * Sets render target \a size if different than underlying surface size.
- * Tells picking the correct size.
+ Sets render target \a size if different than underlying surface size.
+ Tells picking the correct size.
*/
void QRenderSurfaceSelector::setExternalRenderTargetSize(const QSize &size)
{
diff --git a/src/render/framegraph/qsortpolicy.cpp b/src/render/framegraph/qsortpolicy.cpp
index 50fcae50f..a20ebd201 100644
--- a/src/render/framegraph/qsortpolicy.cpp
+++ b/src/render/framegraph/qsortpolicy.cpp
@@ -53,23 +53,34 @@ QSortPolicyPrivate::QSortPolicyPrivate()
}
/*!
- * \class Qt3DRender::QSortPolicy
- * \inmodule Qt3DRender
- * \brief Provides storage for the sort types to be used
- * \since 5.7
- *
- * \inherits Qt3DRender::QFrameGraphNode
- *
+ \class Qt3DRender::QSortPolicy
+ \inmodule Qt3DRender
+ \brief Provides storage for the sort types to be used
+ \since 5.7
+
+ \inherits Qt3DRender::QFrameGraphNode
+
+ A Qt3DRender::QSortPolicy class stores the sorting type used by the FrameGraph.
+ The sort types determine how drawable entities are sorted before drawing to
+ determine the drawing order. When QSortPolicy is present in the FrameGraph,
+ the sorting mechanism is determined by the SortTypes list. Multiple sort types
+ can be used simultanously. If QSortPolicy is not present in the FrameGraph,
+ entities are drawn in the order they appear in the entity hierarchy.
*/
/*!
- * \qmltype SortPolicy
- * \inqmlmodule Qt3D.Render
- * \since 5.7
- * \ingroup
- * \instantiates Qt3DRender::QSortPolicy
- * \brief Provides storage for the sort types to be used
- *
+ \qmltype SortPolicy
+ \inqmlmodule Qt3D.Render
+ \since 5.7
+ \instantiates Qt3DRender::QSortPolicy
+ \brief Provides storage for the sort types to be used
+
+ A SortPolicy class stores the sorting type used by the FrameGraph.
+ The sort types determine how drawable entities are sorted before drawing to
+ determine the drawing order. When SortPolicy is present in the FrameGraph,
+ the sorting mechanism is determined by the SortTypes list. Multiple sort
+ types can be used simultanously. If SortPolicy is not present in the FrameGraph,
+ entities are drawn in the order they appear in the entity hierarchy.
*/
/*!
@@ -82,7 +93,17 @@ QSortPolicyPrivate::QSortPolicyPrivate()
*/
/*!
- * Constructs QSortPolicy with given \a parent.
+ \property QSortPolicy::sortTypes
+ Specifies the sorting types to be used.
+*/
+
+/*!
+ \qmlproperty QVariantList SortPolicy::sortTypes
+ Specifies the sorting types to be used.
+*/
+
+/*!
+ Constructs QSortPolicy with given \a parent.
*/
QSortPolicy::QSortPolicy(QNode *parent)
: QFrameGraphNode(*new QSortPolicyPrivate, parent)
@@ -110,17 +131,7 @@ QNodeCreatedChangeBasePtr QSortPolicy::createNodeCreationChange() const
}
/*!
- \property Qt3DRender::QSortPolicy::sortTypes
- Specifies the sorting types to be used.
-*/
-
-/*!
- \qmlproperty QVariantList Qt3D.Render::QSortPolicy::sortTypes
- Specifies the sorting types to be used.
-
-*/
-/*!
- * \return the current sort types in use
+ \return the current sort types in use
*/
QVector<QSortPolicy::SortType> QSortPolicy::sortTypes() const
{
diff --git a/src/render/framegraph/qviewport.cpp b/src/render/framegraph/qviewport.cpp
index c68ff141f..cf7667289 100644
--- a/src/render/framegraph/qviewport.cpp
+++ b/src/render/framegraph/qviewport.cpp
@@ -53,27 +53,39 @@ QViewportPrivate::QViewportPrivate()
}
/*!
- * \class Qt3DRender::QViewport
- * \inmodule Qt3DRender
- * \brief A viewport on the Qt3D Scene
- * \since 5.7
- *
- * \inherits Qt3DRender::QFrameGraphNode
- *
+ \class Qt3DRender::QViewport
+ \inmodule Qt3DRender
+ \brief A viewport on the Qt3D Scene
+ \since 5.7
+
+ \inherits Qt3DRender::QFrameGraphNode
+
+ Qt3DRender::QViewport of the scene specifies at which portion of the render surface Qt3D
+ is rendering to. Area outside the viewport is left untouched.
*/
/*!
- * \qmltype Viewport
- * \inqmlmodule Qt3D.Render
- * \since 5.7
- * \ingroup
- * \instantiates Qt3DRender::QViewport
- * \brief A viewport on the Qt3D Scene
- *
+ \qmltype Viewport
+ \inqmlmodule Qt3D.Render
+ \since 5.7
+ \ingroup
+ \instantiates Qt3DRender::QViewport
+ \brief A viewport on the Qt3D Scene
+
+ Viewport of the scene specifies at which portion of the render surface Qt3D is
+ rendering to. Area outside the viewport is left untouched.
*/
/*!
- * Constructs QViewport with given \a parent.
+ \qmlproperty rect Viewport::normalizedRect
+
+ Specifies the normalised rectangle for the viewport, i.e. the viewport rectangle
+ is specified relative to the render surface size. Whole surface sized viewport
+ is specified as [0.0, 0.0, 1.0, 1.0], which is the default.
+ */
+
+/*!
+ Constructs QViewport with given \a parent.
*/
QViewport::QViewport(QNode *parent)
: QFrameGraphNode(*new QViewportPrivate, parent)
@@ -99,14 +111,12 @@ QRectF QViewport::normalizedRect() const
}
/*!
- \property Qt3DRender::QViewport::normalizedRect
- Specifies the normalise rect for the viewport
-*/
-
-/*!
- \qmlproperty QRectF Qt3D.Render::QViewport::normalizedRect
+ \property QViewport::normalizedRect
-*/
+ Specifies the normalised rectangle for the viewport, i.e. the viewport rectangle
+ is specified relative to the render surface size. Whole surface sized viewport
+ is specified as [0.0, 0.0, 1.0, 1.0], which is the default.
+ */
void QViewport::setNormalizedRect(const QRectF &normalizedRect)
{
Q_D(QViewport);
diff --git a/src/render/frontend/qcameralens.cpp b/src/render/frontend/qcameralens.cpp
index 8c730c763..4725251b5 100644
--- a/src/render/frontend/qcameralens.cpp
+++ b/src/render/frontend/qcameralens.cpp
@@ -45,8 +45,164 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
/*!
- \internal
-*/
+ * \class Qt3DRender::QCameraLens
+ * \inmodule Qt3DRender
+ *
+ * \brief Qt3DRender::QCameraLens specifies the projection matrix that will be used to
+ * define a Camera for a 3D scene.
+ *
+ * \since 5.5
+ */
+
+/*!
+ * \qmltype CameraLens
+ * \instantiates Qt3DRender::QCameraLens
+ * \inqmlmodule Qt3D.Render
+ * \inherits Component3D
+ * \since 5.5
+ * \brief Provides the projection matrix that is used to define a Camera for 3D scene.
+ */
+
+/*!
+ * \enum Qt3DRender::QCameraLens::ProjectionType
+ *
+ * Specifies which parameters of Qt3DRender::QCameraLens are used to compute the projection matrix.
+ *
+ * \value OrthographicProjection Orthogonal projection
+ * \value PerspectiveProjection Perspective projection
+ * \value FrustumProjection Frustum projection
+ * \value CustomProjection Custom user-defined projection
+ */
+
+/*!
+ * \qmlproperty enumeration CameraLens::projectionType
+ *
+ * Holds the type of the camera projection.
+ *
+ * \list
+ * \li CameraLens.OrthographicProjection
+ * \li CameraLens.PerspectiveProjection
+ * \li CameraLens.FrustumProjection
+ * \li CameraLens.CustomProjection
+ * \endlist
+ * \sa Qt3DRender::QCameraLens::ProjectionType
+ */
+
+/*!
+ * \qmlproperty real CameraLens::nearPlane
+ * Holds the current near plane of the camera lens.
+ */
+
+/*!
+ * \qmlproperty real CameraLens::farPlane
+ * Holds the current near plane of the camera lens.
+ */
+
+/*!
+ * \qmlproperty real CameraLens::fieldOfView
+ * Holds the current field of view of the camera lens in degrees.
+ */
+
+/*!
+ * \qmlproperty real CameraLens::aspectRatio
+ * Holds the current aspect ratio of the camera lens.
+ */
+
+/*!
+ * \qmlproperty real CameraLens::left
+ * Holds the current left plane of the camera lens.
+ */
+
+/*!
+ * \qmlproperty real CameraLens::right
+ * Holds the current right plane of the camera lens.
+ */
+
+/*!
+ * \qmlproperty real CameraLens::bottom
+ * Holds the current bottom plane of the camera lens.
+ */
+
+/*!
+ * \qmlproperty real CameraLens::top
+ * Holds the current top plane of the camera lens.
+ */
+
+/*!
+ * \qmlproperty matrix4x4 CameraLens::projectionMatrix
+ * Holds the current projection matrix of the camera lens.
+ * \readonly
+ */
+
+
+/*!
+ * \property QCameraLens::projectionType
+ *
+ * Holds the type of the camera projection.
+ * \sa Qt3DRender::QCameraLens::ProjectionType
+ */
+
+/*!
+ * \property QCameraLens::nearPlane
+ * Holds the current near plane of the camera lens.
+ */
+
+/*!
+ * \property QCameraLens::farPlane
+ * Holds the current near plane of the camera lens.
+ */
+
+/*!
+ * \property QCameraLens::fieldOfView
+ * Holds the current field of view of the camera lens.
+ * \note: The return value may be undefined if the projection type is not
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+
+/*!
+ * \property QCameraLens::aspectRatio
+ * Holds the current aspect ratio of the camera lens.
+ * \note: The return value may be undefined if the projection type is not
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+
+/*!
+ * \property QCameraLens::left
+ * Holds the current left plane of the camera lens.
+ * \note The return value may be undefined if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+
+/*!
+ * \property QCameraLens::right
+ * Holds the current right plane of the camera lens.
+ * \note The return value may be undefined if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+
+/*!
+ * \property QCameraLens::bottom
+ * Holds the current bottom plane of the camera lens.
+ * \note The return value may be undefined if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+
+/*!
+ * \property QCameraLens::top
+ * Holds the current top plane of the camera lens.
+ * \note The return value may be undefined if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+
+/*!
+ * \property QCameraLens::projectionMatrix
+ * Holds the current projection matrix of the camera lens.
+ * \readonly
+ */
+
+/*!
+ * \internal
+ */
QCameraLensPrivate::QCameraLensPrivate()
: Qt3DCore::QComponentPrivate()
, m_projectionType(QCameraLens::PerspectiveProjection)
@@ -61,6 +217,9 @@ QCameraLensPrivate::QCameraLensPrivate()
{
}
+/*!
+ * Constructs a QCameraLens with given \a parent
+ */
QCameraLens::QCameraLens(QNode *parent)
: Qt3DCore::QComponent(*new QCameraLensPrivate, parent)
{
@@ -73,14 +232,6 @@ QCameraLens::~QCameraLens()
{
}
-/*! \class Qt3DRender::QCameraLens
- * \inmodule Qt3DCore
- *
- * \brief Qt3DRender::QCameraLens specifies the projection matrix that will be used to
- * define a Camera for a 3D scene.
- *
- * \since 5.5
- */
QCameraLens::QCameraLens(QCameraLensPrivate &dd, QNode *parent)
: QComponent(dd, parent)
{
@@ -89,17 +240,6 @@ QCameraLens::QCameraLens(QCameraLensPrivate &dd, QNode *parent)
}
/*!
- * \enum Qt3DRender::QCameraLens::ProjectionType
- *
- * Specifies which parameters of Qt3DRender::QCameraLens are used to compute the projection matrix.
- *
- * \value OrthographicProjection
- * \value PerspectiveProjection
- * \value FrustumProjection
- * \value CustomProjection
- */
-
-/*!
* Sets the lens' projection type \a projectionType.
*
* \note Qt3DRender::QCameraLens::Frustum and
@@ -120,9 +260,6 @@ void QCameraLens::setProjectionType(QCameraLens::ProjectionType projectionType)
}
}
-/*!
- * Returns the lens' projection type.
- */
QCameraLens::ProjectionType QCameraLens::projectionType() const
{
Q_D(const QCameraLens);
@@ -207,9 +344,6 @@ void QCameraLens::setNearPlane(float nearPlane)
d->updateProjectionMatrix();
}
-/*!
- * Returns the projection's near plane.
- */
float QCameraLens::nearPlane() const
{
Q_D(const QCameraLens);
@@ -234,9 +368,6 @@ void QCameraLens::setFarPlane(float farPlane)
d->updateProjectionMatrix();
}
-/*!
- * Returns the projection's far plane.
- */
float QCameraLens::farPlane() const
{
Q_D(const QCameraLens);
@@ -264,12 +395,6 @@ void QCameraLens::setFieldOfView(float fieldOfView)
d->updateProjectionMatrix();
}
-/*!
- * Returns the projection's field of view in degrees.
- *
- * \note: The return value may be undefined if the projection type is not
- * Qt3DRender::QCameraLens::PerspectiveProjection.
- */
float QCameraLens::fieldOfView() const
{
Q_D(const QCameraLens);
@@ -297,12 +422,6 @@ void QCameraLens::setAspectRatio(float aspectRatio)
d->updateProjectionMatrix();
}
-/*!
- * Returns the projection's aspect ratio.
- *
- * \note: The return value may be undefined if the projection type is not
- * Qt3DRender::QCameraLens::PerspectiveProjection.
- */
float QCameraLens::aspectRatio() const
{
Q_D(const QCameraLens);
@@ -330,12 +449,6 @@ void QCameraLens::setLeft(float left)
d->updateProjectionMatrix();
}
-/*!
- * Returns the lower left window coordinate of the projection.
- *
- * \note The return value may be undefined if the projection type is
- * Qt3DRender::QCameraLens::PerspectiveProjection.
- */
float QCameraLens::left() const
{
Q_D(const QCameraLens);
@@ -363,12 +476,6 @@ void QCameraLens::setRight(float right)
d->updateProjectionMatrix();
}
-/*!
- * Returns the upper right window coordinate of the projection.
- *
- * \note The return value may be undefined if the projection type is
- * Qt3DRender::QCameraLens::PerspectiveProjection.
- */
float QCameraLens::right() const
{
Q_D(const QCameraLens);
@@ -396,12 +503,6 @@ void QCameraLens::setBottom(float bottom)
d->updateProjectionMatrix();
}
-/*!
- * Returns the bottom window coordinate of the projection.
- *
- * \note The return value may be undefined if the projection type is
- * Qt3DRender::QCameraLens::PerspectiveProjection.
- */
float QCameraLens::bottom() const
{
Q_D(const QCameraLens);
@@ -429,12 +530,6 @@ void QCameraLens::setTop(float top)
d->updateProjectionMatrix();
}
-/*!
- * Returns the bottom window coordinate of the projection.
- *
- * \note The return value may be undefined if the projection type is
- * Qt3DRender::QCameraLens::PerspectiveProjection.
- */
float QCameraLens::top() const
{
Q_D(const QCameraLens);
@@ -442,7 +537,7 @@ float QCameraLens::top() const
}
/*!
- * Sets the project matrix.
+ * Sets the project matrix to \a projectionMatrix.
*
* \note This will set the projection type to Qt3DRender::QCameraLens::CustomProjection and thus
* ignore all other camera parameters that might have been specified.
@@ -457,9 +552,6 @@ void QCameraLens::setProjectionMatrix(const QMatrix4x4 &projectionMatrix)
emit projectionMatrixChanged(projectionMatrix);
}
-/*!
- * Returns the projection matrix.
- */
QMatrix4x4 QCameraLens::projectionMatrix() const
{
Q_D(const QCameraLens);
@@ -476,59 +568,4 @@ Qt3DCore::QNodeCreatedChangeBasePtr QCameraLens::createNodeCreationChange() cons
} // Qt3DRender
-/*!
- \qmltype CameraLens
- \instantiates Qt3DRender::QCameraLens
- \inqmlmodule Qt3D.Core
- \inherits Component3D
- \since 5.5
- \brief Provides the projection matrix that is used to define a Camera for 3D scene.
-*/
-
-/*!
- \qmlproperty enumeration Qt3DCore::CameraLens::projectionType
-
- Holds the type of the camera projection (orthogonal or perspective).
-
- \value CameraLens.OrthographicProjection Orthogonal projection
- \value CameraLens.PerspectiveProjection Perspective projection
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::nearPlane
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::farPlane
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::fieldOfView
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::aspectRatio
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::left
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::right
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::bottom
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::top
-*/
-
-/*!
- \qmlproperty matrix4x4 Qt3DCore::CameraLens::projectionMatrix
- \readonly
-*/
-
QT_END_NAMESPACE
diff --git a/src/render/frontend/qpickingsettings.cpp b/src/render/frontend/qpickingsettings.cpp
index 2805ec5a8..c1524547c 100644
--- a/src/render/frontend/qpickingsettings.cpp
+++ b/src/render/frontend/qpickingsettings.cpp
@@ -45,12 +45,25 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
/*!
- * \class Qt3DRender::QPickingSettings
- * \brief The QPickingSettings class specifies the current framegraph to be used
- * by the renderer and specifies whether rendering is always active or updated
- * only on changes.
- * \since 5.7
- * \inmodule Qt3DRender
+ \class Qt3DRender::QPickingSettings
+ \brief The QPickingSettings class specifies how entity picking is handled.
+ \since 5.7
+ \inmodule Qt3DRender
+ \inherits Qt3DCore::QNode
+
+ The picking settings determine how the entity picking is handled. For more details about
+ entity picking, see QObjectPicker component documentation.
+ */
+
+/*!
+ \qmltype PickingSettings
+ \brief The PickingSettings class specifies how entity picking is handled.
+ \since 5.7
+ \inqmlmodule Qt3D.Render
+ \instantiates Qt3DRender::QPickingSettings
+
+ The picking settings determine how the entity picking is handled. For more details about
+ entity picking, see Qt3DRender::QObjectPicker component documentation.
*/
QPickingSettingsPrivate::QPickingSettingsPrivate()
@@ -61,11 +74,6 @@ QPickingSettingsPrivate::QPickingSettingsPrivate()
{
}
-/*!
- * The constructor creates a new Qt3DRender::QPickingSettings
- * instance with the specified \a parent.
- * \param parent
- */
QPickingSettings::QPickingSettings(Qt3DCore::QNode *parent)
: Qt3DCore::QNode(*new QPickingSettingsPrivate, parent)
{
@@ -82,18 +90,12 @@ QPickingSettings::QPickingSettings(QPickingSettingsPrivate &dd, Qt3DCore::QNode
{
}
-/*!
- * \return the current pick method.
- */
QPickingSettings::PickMethod QPickingSettings::pickMethod() const
{
Q_D(const QPickingSettings);
return d->m_pickMethod;
}
-/*!
- * \return the current pick result mode.
- */
QPickingSettings::PickResultMode QPickingSettings::pickResultMode() const
{
Q_D(const QPickingSettings);
@@ -112,16 +114,31 @@ QPickingSettings::FaceOrientationPickingMode QPickingSettings::faceOrientationPi
/*!
* \enum Qt3DRender::QPickingSettings::PickMethod
*
- * Specifies which parameters of Qt3DRender::QPickingSettings are used.
+ * Specifies the picking method.
*
- * \value BoundingVolumePicking
- * \value TrianglePicking
+ * \value BoundingVolumePicking An entity is considered picked if the picking ray intersects
+ * the bounding volume of the entity.
+ * \value TrianglePicking An entity is considered picked if the picking ray intersects with
+ * any triangle of the entity's mesh component.
*/
/*!
- * Sets the pick method to \a pickMethod
- * \param pickMethod
- */
+ \qmlproperty enumeration PickingSettings::pickMethod
+
+ Holds the current pick method.
+
+ \list
+ \li PickingSettings.BoundingVolumePicking
+ \li PickingSettings.TrianglePicking
+ \endlist
+
+ \sa Qt3DRender::QPickingSettings::PickMethod
+*/
+/*!
+ \property QPickingSettings::pickMethod
+
+ Holds the current pick method.
+*/
void QPickingSettings::setPickMethod(QPickingSettings::PickMethod pickMethod)
{
Q_D(QPickingSettings);
@@ -135,16 +152,30 @@ void QPickingSettings::setPickMethod(QPickingSettings::PickMethod pickMethod)
/*!
* \enum Qt3DRender::QPickingSettings::PickResultMode
*
- * Specifies which parameters of Qt3DRender::PickResultMode are used.
+ * Specifies what is included into the picking results.
*
- * \value NearestPick
- * \value AllPicks
+ * \value NearestPick Only the nearest entity to picking ray origin intersected by the picking ray
+ * is picked.
+ * \value AllPicks All entities that intersect the picking ray are picked.
*/
/*!
- * Sets the pick result mode to \a pickResultMode
- * \param pickResultMode
- */
+ \qmlproperty enumeration PickingSettings::pickResultMode
+
+ Holds the current pick results mode.
+
+ \list
+ \li PickingSettings.NearestPick
+ \li PickingSettings.AllPicks
+ \endlist
+
+ \sa Qt3DRender::QPickingSettings::PickResultMode
+*/
+/*!
+ \property QPickingSettings::pickResultMode
+
+ Holds the current pick results mode.
+*/
void QPickingSettings::setPickResultMode(QPickingSettings::PickResultMode pickResultMode)
{
Q_D(QPickingSettings);
diff --git a/src/render/frontend/qrendersettings.cpp b/src/render/frontend/qrendersettings.cpp
index fd0e75b4e..616c3a64e 100644
--- a/src/render/frontend/qrendersettings.cpp
+++ b/src/render/frontend/qrendersettings.cpp
@@ -46,10 +46,29 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
/*!
- * \class Qt3DRender::QRenderSettings
- * \brief The QRenderSettings class
- * \since 5.7
- * \inmodule Qt3DRender
+ \class Qt3DRender::QRenderSettings
+ \brief The QRenderSettings class holds settings related to rendering process and host the active
+ \l{Qt 3D Render Framegraph}{FrameGraph}.
+ \since 5.7
+ \inmodule Qt3DRender
+ \inherits Qt3DCore::QComponent
+
+ The QRenderSettings component must be set as a component of the scene root entity. It specifies
+ render policy and picking settings, as well as hosts the active
+ \l{Qt 3D Render Framegraph}{FrameGraph}.
+ */
+
+/*!
+ \qmltype RenderSettings
+ \brief The RenderSettings type holds settings related to rendering process and host the active
+ \l{Qt 3D Render Framegraph}{FrameGraph}.
+ \since 5.7
+ \inqmlmodule Qt3D.Render
+ \instantiates Qt3DRender::QRenderSettings
+
+ The RenderSettings component must be set as a component of the scene root entity. It specifies
+ render policy and picking settings, as well as hosts the active
+ \l{Qt 3D Render Framegraph}{FrameGraph}.
*/
/*! \internal */
@@ -90,11 +109,6 @@ void QRenderSettingsPrivate::_q_onFaceOrientationPickingModeChanged(QPickingSett
notifyPropertyChange("faceOrientationPickingMode", faceOrientationPickingMode);
}
-/*!
- * The constructor creates a new QRenderSettings::QRenderSettings instance with the
- * specified \a parent.
- * \param parent
- */
QRenderSettings::QRenderSettings(Qt3DCore::QNode *parent)
: QRenderSettings(*new QRenderSettingsPrivate, parent) {}
@@ -112,8 +126,19 @@ QRenderSettings::~QRenderSettings()
}
/*!
- * \return the current picking settings.
- */
+ \qmlproperty PickingSettings RenderSettings::pickingSettings
+
+ Holds the current pick settings for the \l{Qt 3D Render Framegraph}{FrameGraph}.
+
+ \readonly
+*/
+/*!
+ \property QRenderSettings::pickingSettings
+
+ Holds the current pick settings for the \l{Qt 3D Render Framegraph}{FrameGraph}.
+
+ \readonly
+*/
QPickingSettings *QRenderSettings::pickingSettings()
{
Q_D(QRenderSettings);
@@ -121,27 +146,56 @@ QPickingSettings *QRenderSettings::pickingSettings()
}
/*!
- * \return the current active framegraph.
- */
+ \qmlproperty FrameGraphNode RenderSettings::activeFrameGraph
+
+ Holds the currently active \l{Qt 3D Render Framegraph}{FrameGraph}.
+*/
+/*!
+ \property QRenderSettings::activeFrameGraph
+
+ Holds the currently active \l{Qt 3D Render Framegraph}{FrameGraph}.
+*/
QFrameGraphNode *QRenderSettings::activeFrameGraph() const
{
Q_D(const QRenderSettings);
return d->m_activeFrameGraph;
}
+
/*!
- * \return the current render policy
- */
+ \enum QRenderSettings::RenderPolicy
+
+ The render policy.
+
+ \value OnDemand The \l{Qt 3D Render Framegraph}{FrameGraph} is rendered only when something
+ changes.
+ \value Always The \l{Qt 3D Render Framegraph}{FrameGraph} is rendered continuously, even if
+ nothing has changed.
+*/
+
+/*!
+ \qmlproperty enumeration RenderSettings::renderPolicy
+
+ Holds the current render policy.
+
+ \list
+ \li RenderSettings.OnDemand
+ \li RenderSettings.Always
+ \endlist
+
+ \sa Qt3DRender::QRenderSettings::RenderPolicy
+*/
+/*!
+ \property QRenderSettings::renderPolicy
+
+ Holds the current render policy.
+*/
QRenderSettings::RenderPolicy QRenderSettings::renderPolicy() const
{
Q_D(const QRenderSettings);
return d->m_renderPolicy;
}
-/*!
- * Sets the active framegraph to \a activeFrameGraph.
- * \param activeFrameGraph
- */
void QRenderSettings::setActiveFrameGraph(QFrameGraphNode *activeFrameGraph)
{
Q_D(QRenderSettings);
@@ -163,10 +217,6 @@ void QRenderSettings::setActiveFrameGraph(QFrameGraphNode *activeFrameGraph)
emit activeFrameGraphChanged(activeFrameGraph);
}
-/*!
- * Sets the render policy to \a renderPolicy.
- * \param renderPolicy
- */
void QRenderSettings::setRenderPolicy(QRenderSettings::RenderPolicy renderPolicy)
{
Q_D(QRenderSettings);
diff --git a/src/render/io/qsceneloader.cpp b/src/render/io/qsceneloader.cpp
index 69bd8528b..9cb067161 100644
--- a/src/render/io/qsceneloader.cpp
+++ b/src/render/io/qsceneloader.cpp
@@ -51,44 +51,36 @@ using namespace Qt3DCore;
namespace Qt3DRender {
-QSceneLoaderPrivate::QSceneLoaderPrivate()
- : QComponentPrivate()
- , m_status(QSceneLoader::None)
- , m_subTreeRoot(nullptr)
-{
- m_shareable = false;
-}
-
/*!
- \class Qt3DRender::QSceneLoader
- \inmodule Qt3DRender
- \since 5.7
- \ingroup io
+ \class Qt3DRender::QSceneLoader
+ \inmodule Qt3DRender
+ \since 5.7
+ \ingroup io
- \brief Provides the facility to load an existing Scene
+ \brief Provides the facility to load an existing Scene
- Given a 3D source file, the Qt3DRender::QSceneLoader will try to parse it and
- build a tree of Qt3DCore::QEntity with proper Qt3DRender::QGeometryRenderer
- Qt3DCore::QTransform and QtRender::QMaterial components.
+ Given a 3D source file, the Qt3DRender::QSceneLoader will try to parse it and
+ build a tree of Qt3DCore::QEntity objects with proper Qt3DRender::QGeometryRenderer,
+ Qt3DCore::QTransform and Qt3DRender::QMaterial components.
- The loader will try to determine the best material to be used based on the properties
- of the model file. If you wish to use a custom material, you will have to traverse
- the tree and replace the default associated materials with yours.
+ The loader will try to determine the best material to be used based on the properties
+ of the model file. If you wish to use a custom material, you will have to traverse
+ the tree and replace the default associated materials with yours.
- As the name implies, Qt3DRender::QSceneLoader loads a complete scene subtree.
- If you wish to load a single piece of geometry, you should rather be using
- the Qt3DRender::QMesh instead.
+ As the name implies, Qt3DRender::QSceneLoader loads a complete scene subtree.
+ If you wish to load a single piece of geometry, you should rather use
+ the Qt3DRender::QMesh instead.
- Qt3DRender::QSceneLoader internally relies on the use of plugins to support a
- wide variety of 3D file formats. \l
- {http://www.assimp.org/main_features_formats.html}{Here} is a list of formats
- that are supported by Qt3D.
+ Qt3DRender::QSceneLoader internally relies on the use of plugins to support a
+ wide variety of 3D file formats. \l
+ {http://www.assimp.org/main_features_formats.html}{Here} is a list of formats
+ that are supported by Qt3D.
- \note this component shouldn't be shared among several Qt3DCore::QEntity instances.
- Undefined behavior will result.
+ \note this component shouldn't be shared among several Qt3DCore::QEntity instances.
+ Undefined behavior will result.
- \sa Qt3DRender::QMesh
- \sa Qt3DRender::QGeometryRenderer
+ \sa Qt3DRender::QMesh
+ \sa Qt3DRender::QGeometryRenderer
*/
/*!
@@ -97,10 +89,10 @@ QSceneLoaderPrivate::QSceneLoaderPrivate()
\instantiates Qt3DRender::QSceneLoader
\inherits Component
\since 5.7
- \qmlabstract Provides the facility to load an existing Scene
+ \brief Provides the facility to load an existing Scene
Given a 3D source file, the SceneLoader will try to parse it and build a
- tree of Entity with proper GeometryRenderer, Transform and Material
+ tree of Entity objects with proper GeometryRenderer, Transform and Material
components.
The loader will try to determine the best material to be used based on the
@@ -109,7 +101,7 @@ QSceneLoaderPrivate::QSceneLoaderPrivate()
with yours.
As the name implies, SceneLoader loads a complete scene subtree. If you
- wish to load a single piece of geometry, you should rather be using the
+ wish to load a single piece of geometry, you should rather use the
Mesh instead.
SceneLoader internally relies on the use of plugins to support a wide
@@ -122,7 +114,7 @@ QSceneLoaderPrivate::QSceneLoaderPrivate()
\sa Mesh
\sa GeometryRenderer
-*/
+ */
/*!
\enum QSceneLoader::Status
@@ -132,10 +124,58 @@ QSceneLoaderPrivate::QSceneLoaderPrivate()
\value Loading The Qt3DRender::QSceneLoader is currently loading the scene file.
\value Ready The Qt3DRender::QSceneLoader successfully loaded the scene file.
\value Error The Qt3DRender::QSceneLoader encountered an error while loading the scene file.
-*/
+ */
+
+/*!
+ \qmlproperty url SceneLoader::source
+
+ Holds the url to the source to be loaded.
+ */
/*!
- The constructor creates an instance with the specified \a parent.
+ \qmlproperty enumeration SceneLoader::status
+
+ Holds the status of scene loading.
+ \list
+ \li SceneLoader.None
+ \li SceneLoader.Loading
+ \li SceneLoader.Ready
+ \li SceneLoader.Error
+ \endlist
+ \sa Qt3DRender::QSceneLoader::Status
+ \readonly
+ */
+
+/*!
+ \property QSceneLoader::source
+
+ Holds the url to the source to be loaded.
+ */
+
+/*!
+ \property QSceneLoader::status
+
+ Holds the status of scene loading.
+ \list
+ \li SceneLoader.None
+ \li SceneLoader.Loading
+ \li SceneLoader.Ready
+ \li SceneLoader.Error
+ \endlist
+ \sa Qt3DRender::QSceneLoader::Status
+ */
+
+/*! \internal */
+QSceneLoaderPrivate::QSceneLoaderPrivate()
+ : QComponentPrivate()
+ , m_status(QSceneLoader::None)
+ , m_subTreeRoot(nullptr)
+{
+ m_shareable = false;
+}
+
+/*!
+ The constructor creates an instance with the specified \a parent.
*/
QSceneLoader::QSceneLoader(QNode *parent)
: Qt3DCore::QComponent(*new QSceneLoaderPrivate, parent)
@@ -190,15 +230,6 @@ QUrl QSceneLoader::source() const
return d->m_source;
}
-/*!
- \property Qt3DRender::QSceneLoader::source
- Specifies the url for the source to be loaded.
-*/
-
-/*!
- \qmlproperty QUrl Qt3D.Render::SceneLoader::source
-
-*/
void QSceneLoader::setSource(const QUrl &arg)
{
Q_D(QSceneLoader);
@@ -208,15 +239,6 @@ void QSceneLoader::setSource(const QUrl &arg)
}
}
-/*!
- \property Qt3DRender::QSceneLoader::status
- Indicates the status of scene loading.
-*/
-
-/*!
- \qmlproperty Status Qt3D.Render::SceneLoader::status
-
-*/
QSceneLoader::Status QSceneLoader::status() const
{
Q_D(const QSceneLoader);
diff --git a/src/render/jobs/loadscenejob.cpp b/src/render/jobs/loadscenejob.cpp
index 79ac91d9a..701942976 100644
--- a/src/render/jobs/loadscenejob.cpp
+++ b/src/render/jobs/loadscenejob.cpp
@@ -90,9 +90,11 @@ void LoadSceneJob::run()
// Reset status
scene->setStatus(QSceneLoader::None);
+ QSceneLoader::Status finalStatus = QSceneLoader::None;
// Perform the loading only if the source wasn't explicitly set to empty
if (!m_source.isEmpty()) {
+ finalStatus = QSceneLoader::Error;
for (QSceneIOHandler *sceneIOHandler : qAsConst(m_sceneIOHandlers)) {
if (!sceneIOHandler->isFileTypeSupported(m_source))
continue;
@@ -102,15 +104,11 @@ void LoadSceneJob::run()
// File type is supported, try to load it
sceneIOHandler->setSource(m_source);
- Qt3DCore::QEntity *sub = sceneIOHandler->scene();
- if (sub) {
- sceneSubTree = sub;
+ sceneSubTree = sceneIOHandler->scene();
+ if (sceneSubTree != nullptr) {
// Successfully built a subtree
- scene->setStatus(QSceneLoader::Ready);
+ finalStatus = QSceneLoader::Ready;
break;
- } else {
- // Tree wasn't build so something went wrong obviously
- scene->setStatus(QSceneLoader::Error);
}
}
}
@@ -120,6 +118,10 @@ void LoadSceneJob::run()
// Set clone of sceneTree in sceneComponent. This will move the sceneSubTree
// to the QCoreApplication thread which is where the frontend object tree lives.
scene->setSceneSubtree(sceneSubTree);
+
+ // Note: the status is set after the subtree so that bindinds depending on the status
+ // in the frontend will be consistent
+ scene->setStatus(finalStatus);
}
} // namespace Render
diff --git a/src/render/jobs/renderviewjobutils.cpp b/src/render/jobs/renderviewjobutils.cpp
index 798828bd3..3face7197 100644
--- a/src/render/jobs/renderviewjobutils.cpp
+++ b/src/render/jobs/renderviewjobutils.cpp
@@ -438,7 +438,7 @@ UniformBlockValueBuilder::~UniformBlockValueBuilder()
{
}
-void UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(const QString &blockName, const QString &qmlPropertyName, const QVariant &value)
+void UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(ShaderData *currentShaderData, const QString &blockName, const QString &qmlPropertyName, const QVariant &value)
{
// In the end, values are either scalar or a scalar array
// Composed elements (structs, structs array) are simplified into simple scalars
@@ -471,20 +471,29 @@ void UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(const QStrin
QString varName = blockName + QLatin1Char('.') + qmlPropertyName;
if (uniforms.contains(varName)) {
qCDebug(Shaders) << "UBO scalar member " << varName << " set for update";
- activeUniformNamesToValue.insert(StringToInt::lookupId(varName), value);
+
+ // If the property needs to be transformed, we transform it here as
+ // the shaderdata cannot hold transformed properties for multiple
+ // thread contexts at once
+ if (currentShaderData->propertyTransformType(qmlPropertyName) != ShaderData::NoTransform)
+ activeUniformNamesToValue.insert(StringToInt::lookupId(varName),
+ currentShaderData->getTransformedProperty(qmlPropertyName, viewMatrix));
+ else
+ activeUniformNamesToValue.insert(StringToInt::lookupId(varName), value);
}
}
}
void UniformBlockValueBuilder::buildActiveUniformNameValueMapStructHelper(ShaderData *rShaderData, const QString &blockName, const QString &qmlPropertyName)
{
- const QHash<QString, QVariant> &properties = updatedPropertiesOnly ? rShaderData->updatedProperties() : rShaderData->properties();
+ const QHash<QString, QVariant> &properties = rShaderData->properties();
QHash<QString, QVariant>::const_iterator it = properties.begin();
const QHash<QString, QVariant>::const_iterator end = properties.end();
while (it != end) {
const auto prefix = qmlPropertyName.isEmpty() ? QLatin1String("") : QLatin1String(".");
- buildActiveUniformNameValueMapHelper(blockName + prefix + qmlPropertyName,
+ buildActiveUniformNameValueMapHelper(rShaderData,
+ blockName + prefix + qmlPropertyName,
it.key(),
it.value());
++it;
diff --git a/src/render/jobs/renderviewjobutils_p.h b/src/render/jobs/renderviewjobutils_p.h
index df4753980..c08083494 100644
--- a/src/render/jobs/renderviewjobutils_p.h
+++ b/src/render/jobs/renderviewjobutils_p.h
@@ -55,6 +55,7 @@
#include <Qt3DCore/qnodeid.h>
#include <QtCore/qhash.h>
#include <QtCore/qvariant.h>
+#include <QMatrix4x4>
#include <Qt3DRender/private/uniform_p.h>
QT_BEGIN_NAMESPACE
@@ -158,7 +159,8 @@ struct Q_AUTOTEST_EXPORT UniformBlockValueBuilder
UniformBlockValueBuilder();
~UniformBlockValueBuilder();
- void buildActiveUniformNameValueMapHelper(const QString &blockName,
+ void buildActiveUniformNameValueMapHelper(ShaderData *currentShaderData,
+ const QString &blockName,
const QString &qmlPropertyName,
const QVariant &value);
void buildActiveUniformNameValueMapStructHelper(ShaderData *rShaderData,
@@ -169,6 +171,7 @@ struct Q_AUTOTEST_EXPORT UniformBlockValueBuilder
QHash<QString, ShaderUniform> uniforms;
UniformBlockValueBuilderHash activeUniformNamesToValue;
ShaderDataManager *shaderDataManager;
+ QMatrix4x4 viewMatrix;
};
} // namespace Render
diff --git a/src/render/materialsystem/qeffect.cpp b/src/render/materialsystem/qeffect.cpp
index 70810676c..7778b5621 100644
--- a/src/render/materialsystem/qeffect.cpp
+++ b/src/render/materialsystem/qeffect.cpp
@@ -58,12 +58,17 @@ QEffectPrivate::QEffectPrivate()
}
/*!
- \class Qt3DRender::QEffect
- \inmodule Qt3DRender
- \since 5.7
- \brief The base class for effects in a Qt 3D scene.
+ \class Qt3DRender::QEffect
+ \inmodule Qt3DRender
+ \inherits Qt3DCore::QNode
+ \since 5.7
+ \brief The base class for effects in a Qt 3D scene.
- */
+ The QEffect class combines a set of techniques and parameters used by those techniques to
+ produce a rendering effect for a material.
+
+ \sa QMaterial, QTechnique, QParameter
+*/
/*!
\qmltype Effect
@@ -72,18 +77,18 @@ QEffectPrivate::QEffectPrivate()
\inqmlmodule Qt3D.Render
\since 5.7
\brief The base class for effects in a Qt 3D scene.
+
+ The Effect type combines a set of techniques and parameters used by those techniques to
+ produce a rendering effect for a material.
+
+ \sa Material, Technique, Parameter
*/
-/*!
- \fn Qt3DRender::QEffect::QEffect(Qt3DCore::QNode *parent)
- Constructs a new QEffect with the specified \a parent.
- */
QEffect::QEffect(QNode *parent)
: QNode(*new QEffectPrivate, parent)
{
}
-/*! \internal */
QEffect::~QEffect()
{
}
@@ -95,8 +100,21 @@ QEffect::QEffect(QEffectPrivate &dd, QNode *parent)
}
/*!
+ \qmlproperty list<Technique> Effect::techniques
+
+ Holds the list of techniques used by this effect.
+*/
+/*!
+ \qmlproperty list<Parameter> Effect::parameters
+
+ Holds the list of parameters used by this effect.
+ A parameter is used to set a corresponding uniform value in the shader used by this effect.
+*/
+
+/*!
* Adds \a parameter to the effect. It sends a QPropertyNodeAddedChange to the backend.
- * The \a parameter will be used to set a corresponding uniform value in the shader used by this effect.
+ * The \a parameter will be used to set a corresponding uniform value in the shader used
+ * by this effect.
*/
void QEffect::addParameter(QParameter *parameter)
{
diff --git a/src/render/materialsystem/qfilterkey.cpp b/src/render/materialsystem/qfilterkey.cpp
index d4bc26515..547c56d26 100644
--- a/src/render/materialsystem/qfilterkey.cpp
+++ b/src/render/materialsystem/qfilterkey.cpp
@@ -55,8 +55,12 @@ QFilterKeyPrivate::QFilterKeyPrivate()
/*!
\class Qt3DRender::QFilterKey
\inmodule Qt3DRender
+ \inherits Qt3DCore::QNode
\since 5.5
- \brief The QFilterKey class provides storage for filter keys and their values
+ \brief The QFilterKey class provides storage for filter keys and their values.
+
+ Filter keys are used by QTechnique and QRenderPass to specify at which stage of rendering the
+ technique or the render pass is used.
*/
/*!
@@ -65,18 +69,18 @@ QFilterKeyPrivate::QFilterKeyPrivate()
\inherits Node
\inqmlmodule Qt3D.Render
\since 5.5
- \brief For storing filter keys and their value
+ \brief Stores filter keys and their values.
+
+ A FilterKey is a storage type for filter key and value pair.
+ Filter keys are used by Technique and RenderPass to specify at which stage of rendering the
+ technique or the render pass is used.
*/
-/*!
- The constructor creates a new QFilterKey under \a parent.
- */
QFilterKey::QFilterKey(QNode *parent)
: QNode(*new QFilterKeyPrivate, parent)
{
}
-/*! \internal */
QFilterKey::~QFilterKey()
{
}
@@ -100,13 +104,15 @@ void QFilterKey::setName(const QString &name)
}
/*!
- \property QFilterKey::value
- Specifies the value of the filter key
+ \property QFilterKey::value
+
+ Holds the value of the filter key.
*/
/*!
- \qmlproperty variant Qt3D.Render::Annotation::value
- Specifies the value of the filter key
+ \qmlproperty variant FilterKey::value
+
+ Holds the value of the filter key.
*/
QVariant QFilterKey::value() const
@@ -116,14 +122,16 @@ QVariant QFilterKey::value() const
}
/*!
- \property QFilterKey::name
- Specifies the name of the filter key
- */
+ \property QFilterKey::name
+
+ Holds the name of the filter key.
+*/
/*!
- \qmlproperty string Qt3D.Render::Annotation::name
- Specifies the name of the filter key
- */
+ \qmlproperty string FilterKey::name
+
+ Holds the name of the filter key.
+*/
QString QFilterKey::name() const
{
diff --git a/src/render/materialsystem/qmaterial.cpp b/src/render/materialsystem/qmaterial.cpp
index 5b3fe63af..ca0f86463 100644
--- a/src/render/materialsystem/qmaterial.cpp
+++ b/src/render/materialsystem/qmaterial.cpp
@@ -48,29 +48,37 @@
#include <Qt3DCore/qpropertynoderemovedchange.h>
/*!
- * \qmltype Material
- * \instantiates Qt3DRender::QMaterial
- * \inqmlmodule Qt3D.Render
- * \brief Non-creatable abstract base for materials.
- * \inherits Component
- */
+ \qmltype Material
+ \instantiates Qt3DRender::QMaterial
+ \inqmlmodule Qt3D.Render
+ \brief Non-creatable abstract base for materials.
+ \since 5.5
+
+ Material provides a way to specify the rendering of an \l{Qt3D.Core::Entity}{entity}.
+ Any aspect can define its own subtype of Material so that a
+ Material can be used to describe a visual element; for example, the way
+ sound should reflect off an element, the temperature of a surface,
+ and so on.
+
+ \sa Effect
+*/
/*!
- * \class Qt3DRender::QMaterial
- * \inmodule Qt3DRender
- *
- *
- * \brief Provides an abstract class that should be the base of all
- * Material component classes in a scene.
- *
- * QMaterial provides a way to specify the rendering of an Entity.
- * Any aspect can define its own subclass of QMaterial so that a
- * Material can be used to describe a visual element; for example, the way
- * sound should reflect off an element, the temperature of a surface,
- * and so on.
- *
- * \sa QEffect, QMesh, {Qt3DCore::}{QComponent}
- */
+ \class Qt3DRender::QMaterial
+ \inmodule Qt3DRender
+ \inherits Qt3DCore::QComponent
+ \brief Provides an abstract class that should be the base of all material component classes
+ in a scene.
+ \since 5.5
+
+ QMaterial provides a way to specify the rendering of an \l{Qt3DCore::QEntity}{entity}.
+ Any aspect can define its own subclass of QMaterial so that a
+ Material can be used to describe a visual element; for example, the way
+ sound should reflect off an element, the temperature of a surface,
+ and so on.
+
+ \sa QEffect
+*/
QT_BEGIN_NAMESPACE
@@ -88,16 +96,11 @@ QMaterialPrivate::~QMaterialPrivate()
{
}
-/*!
- \fn Qt3DRender::QMaterial::QMaterial(Qt3DCore::QNode *parent)
- Constructs a new QMaterial with the specified \a parent.
- */
QMaterial::QMaterial(QNode *parent)
: QComponent(*new QMaterialPrivate, parent)
{
}
-/*! \internal */
QMaterial::~QMaterial()
{
}
@@ -109,16 +112,20 @@ QMaterial::QMaterial(QMaterialPrivate &dd, QNode *parent)
}
/*!
- \qmlproperty QEffect Qt3D.Render::Material::effect
- Specifies the effect to be used with the material
+ \qmlproperty list<Parameter> Material::parameters
+
+ Holds the list of parameters used by the material.
*/
/*!
- \property Qt3DRender::QMaterial::effect
- Specifies the effect to be used with the material
- */
+ \qmlproperty Effect Material::effect
+
+ Specifies the effect to be used with the material.
+*/
/*!
- * Sets the \a effect to be used with the Material.
+ \property QMaterial::effect
+
+ Specifies the effect to be used with the material.
*/
void QMaterial::setEffect(QEffect *effect)
{
@@ -144,9 +151,6 @@ void QMaterial::setEffect(QEffect *effect)
}
}
-/*!
- * Returns the effect used by the Material.
- */
QEffect *QMaterial::effect() const
{
Q_D(const QMaterial);
@@ -154,7 +158,7 @@ QEffect *QMaterial::effect() const
}
/*!
- * Add \a parameter to the Materials parameter.
+ * Add a \a parameter to the material's parameters.
*/
void QMaterial::addParameter(QParameter *parameter)
{
@@ -182,7 +186,7 @@ void QMaterial::addParameter(QParameter *parameter)
}
/*!
- * Remove \a parameter from the Material parameters.
+ * Remove a \a parameter from the material's parameters.
*/
void QMaterial::removeParameter(QParameter *parameter)
{
@@ -197,7 +201,7 @@ void QMaterial::removeParameter(QParameter *parameter)
}
/*!
- * Returns a vector of the materials current parameters
+ * Returns a vector of the material's current parameters
*/
QVector<QParameter *> QMaterial::parameters() const
{
diff --git a/src/render/materialsystem/qrenderpass.cpp b/src/render/materialsystem/qrenderpass.cpp
index b10660730..dd6363816 100644
--- a/src/render/materialsystem/qrenderpass.cpp
+++ b/src/render/materialsystem/qrenderpass.cpp
@@ -60,19 +60,65 @@ QRenderPassPrivate::QRenderPassPrivate()
{
}
/*!
- * \qmltype RenderPass
- * \instantiates Qt3DRender::QRenderPass
- * \inqmlmodule Qt3D.Render
- * \brief Encapsulates a Render Pass.
+ \qmltype RenderPass
+ \instantiates Qt3DRender::QRenderPass
+ \inqmlmodule Qt3D.Render
+ \inherits Node
+ \since 5.7
+ \brief Encapsulates a Render Pass.
+
+ A RenderPass specifies a single rendering pass - an instance of shader program
+ execution - used by Technique. A Render pass consists of a ShaderProgram and
+ a list of FilterKey objects, a list of RenderState objects and a list
+ of \l Parameter objects.
+
+ RenderPass executes the ShaderProgram using the given render states and parameters
+ when its filter keys match the filter keys in RenderPassFilter or when no filter
+ keys are specified and no RenderPassFilter is present in the FrameGraph.
*/
/*!
- * \class Qt3DRender::QRenderPass
- * \inmodule Qt3DRender
- *
- * \inherits Node
- *
- * \brief Encapsulates a Render Pass.
+ \class Qt3DRender::QRenderPass
+ \inmodule Qt3DRender
+ \since 5.7
+ \brief Encapsulates a Render Pass.
+
+ A Qt3DRender::QRenderPass specifies a single rendering pass - an instance of shader
+ program execution - used by Qt3DRender::QTechnique. Render pass consists
+ of a Qt3DRender::QShaderProgram and a list of Qt3DRender::QFilterKey objects,
+ a list of Qt3DRender::QRenderState objects and a list of Qt3DRender::QParameter objects.
+
+ QRenderPass executes the QShaderProgram using the given render states and parameters
+ when its filter keys match the filter keys in Qt3DRender::QRenderPassFilter or
+ when no filter keys are specified and no QRenderPassFilter is present
+ in the FrameGraph.
+ */
+/*!
+ \typedef ParameterList
+ \relates Qt3DRender::QRenderPass
+
+ A list of Qt3DRender::QParameter parameters.
+*/
+/*!
+ \qmlproperty ShaderProgram Qt3D.Render::RenderPass::shaderProgram
+ Holds the shader program to be used for this render pass.
+*/
+/*!
+ \qmlproperty list<FilterKey> Qt3D.Render::RenderPass::filterKeys
+ Holds the filter keys enabling the use of this render pass.
+*/
+/*!
+ \qmlproperty list<RenderState> Qt3D.Render::RenderPass::renderStates
+ Holds the render states used by the render pass.
+*/
+/*!
+ \qmlproperty list<Parameter> Qt3D.Render::RenderPass::parameters
+ Holds the shader parameter values used by the render pass.
+*/
+
+/*!
+ \property Qt3DRender::QRenderPass::shaderProgram
+ Specifies the shader program to be used for this render pass.
*/
/*!
@@ -95,18 +141,6 @@ QRenderPass::QRenderPass(QRenderPassPrivate &dd, QNode *parent)
{
}
-/*!
- \qmlproperty ShaderProgram Qt3D.Render::RenderPass::shaderProgram
- Specifies the shader program to be used for this render pass
-*/
-
-/*!
- \property Qt3DRender::QRenderPass::shaderProgram
- Specifies the shader program to be used for this render pass
- */
-/*!
- * Sets the pass' \a shaderProgram.
- */
void QRenderPass::setShaderProgram(QShaderProgram *shaderProgram)
{
Q_D(QRenderPass);
@@ -145,7 +179,7 @@ QShaderProgram *QRenderPass::shaderProgram() const
}
/*!
- * Adds \a filterKey from to the Qt3DRender::QRenderPass local filter keys.
+ Adds \a filterKey to the Qt3DRender::QRenderPass local filter keys.
*/
void QRenderPass::addFilterKey(QFilterKey *filterKey)
{
@@ -173,7 +207,7 @@ void QRenderPass::addFilterKey(QFilterKey *filterKey)
}
/*!
- * Removes \a filterKey from the Qt3DRender::QRenderPass local filter keys.
+ Removes \a filterKey from the Qt3DRender::QRenderPass local filter keys.
*/
void QRenderPass::removeFilterKey(QFilterKey *filterKey)
{
@@ -190,8 +224,8 @@ void QRenderPass::removeFilterKey(QFilterKey *filterKey)
}
/*!
- * Returns the list of Qt3DCore::QFilterKey key objects making up the filter keys
- * of the Qt3DRender::QRenderPass.
+ Returns the list of Qt3DRender::QFilterKey key objects making up the filter keys
+ of the Qt3DRender::QRenderPass.
*/
QVector<QFilterKey *> QRenderPass::filterKeys() const
{
@@ -200,12 +234,12 @@ QVector<QFilterKey *> QRenderPass::filterKeys() const
}
/*!
- * Adds a Qt3DCore::QRenderState \a state to the rendering pass. That implies that
- * when the pass is executed at render time, the globally set render state will
- * be modifed by the states defined locally by the Qt3DRender::QRenderPass.
- *
- * \note not defining any Qt3DCore::QRenderState in a pass will result in the pass using
- * the globally set render state for a given FrameGraph branch execution path.
+ Adds a render \a state to the rendering pass. That implies that
+ when the pass is executed at render time, the globally set render state will
+ be modifed by the states defined locally by the Qt3DRender::QRenderPass.
+
+ \note not defining any Qt3DRender::QRenderState in a pass will result in the pass using
+ the globally set render state for a given FrameGraph branch execution path.
*/
void QRenderPass::addRenderState(QRenderState *state)
{
@@ -229,7 +263,7 @@ void QRenderPass::addRenderState(QRenderState *state)
}
/*!
- * Removes \a state from the Qt3DRender::QRenderPass local render state.
+ Removes \a state from the Qt3DRender::QRenderPass local render state.
*/
void QRenderPass::removeRenderState(QRenderState *state)
{
@@ -246,8 +280,8 @@ void QRenderPass::removeRenderState(QRenderState *state)
}
/*!
- * Returns the list of Qt3DCore::QRenderState state objects making up the render
- * state of the Qt3DRender::QRenderPass.
+ Returns the list of Qt3DRender::QRenderState state objects making up the render
+ state of the Qt3DRender::QRenderPass.
*/
QVector<QRenderState *> QRenderPass::renderStates() const
{
@@ -256,7 +290,7 @@ QVector<QRenderState *> QRenderPass::renderStates() const
}
/*!
- * Add \a parameter to the render pass' parameters.
+ Add \a parameter to the render pass' parameters.
*/
void QRenderPass::addParameter(QParameter *parameter)
{
@@ -284,7 +318,7 @@ void QRenderPass::addParameter(QParameter *parameter)
}
/*!
- * Remove \a parameter from the render pass' parameters.
+ Remove \a parameter from the render pass' parameters.
*/
void QRenderPass::removeParameter(QParameter *parameter)
{
@@ -301,9 +335,9 @@ void QRenderPass::removeParameter(QParameter *parameter)
}
/*!
- * Returns a vector of the render pass' current parameters
+ Returns a vector of the render pass' current parameters
*/
-QVector<QParameter *> QRenderPass::parameters() const
+ParameterList QRenderPass::parameters() const
{
Q_D(const QRenderPass);
return d->m_parameters;
diff --git a/src/render/materialsystem/qrenderpass.h b/src/render/materialsystem/qrenderpass.h
index e2eb96a9a..9c608d0c4 100644
--- a/src/render/materialsystem/qrenderpass.h
+++ b/src/render/materialsystem/qrenderpass.h
@@ -70,8 +70,8 @@ public:
QShaderProgram *shaderProgram() const;
- void addFilterKey(QFilterKey*filterKey);
- void removeFilterKey(QFilterKey*filterKey);
+ void addFilterKey(QFilterKey *filterKey);
+ void removeFilterKey(QFilterKey *filterKey);
QVector<QFilterKey*> filterKeys() const;
void addRenderState(QRenderState *state);
diff --git a/src/render/materialsystem/qshaderprogram.cpp b/src/render/materialsystem/qshaderprogram.cpp
index da954210b..522f021aa 100644
--- a/src/render/materialsystem/qshaderprogram.cpp
+++ b/src/render/materialsystem/qshaderprogram.cpp
@@ -47,29 +47,37 @@
#include <QUrl>
/*!
- * \qmltype ShaderProgram
- * \instantiates Qt3DRender::QShaderProgram
- * \inqmlmodule Qt3D.Render
- * \brief Encapsulates a Shader Program.
- */
+ \class Qt3DRender::QShaderProgram
+ \inmodule Qt3DRender
+ \brief Encapsulates a Shader Program.
+ \inherits Qt3DCore::QNode
+ \since 5.5
+
+ A shader program consists of several different shaders, such as vertex and fragment shaders.
+*/
/*!
- * \class Qt3DRender::QShaderProgram
- * \inmodule Qt3DRender
- *
- * \brief Encapsulates a Shader Program.
- */
+ \qmltype ShaderProgram
+ \instantiates Qt3DRender::QShaderProgram
+ \inqmlmodule Qt3D.Render
+ \brief Encapsulates a Shader Program.
+ \since 5.5
+
+ ShaderProgram class encapsulates a shader program. A shader program consists of several
+ different shaders, such as vertex and fragment shaders.
+*/
/*!
\enum QShaderProgram::ShaderType
- This enum identifies the type of shader used
- \value Vertex
- \value Fragment
- \value TessellationControl
- \value TessellationEvaluation
- \value Geometry
- \value Compute
+ This enum identifies the type of shader used.
+
+ \value Vertex Vertex shader
+ \value Fragment Fragment shader
+ \value TessellationControl Tesselation control shader
+ \value TessellationEvaluation Tesselation evaluation shader
+ \value Geometry Geometry shader
+ \value Compute Compute shader
*/
QT_BEGIN_NAMESPACE
@@ -81,16 +89,11 @@ QShaderProgramPrivate::QShaderProgramPrivate()
{
}
-/*!
- \fn Qt3DRender::QShaderProgram::QShaderProgram(Qt3DCore::QNode *parent)
- Constructs a new QShaderProgram with the specified \a parent.
- */
QShaderProgram::QShaderProgram(QNode *parent)
: QNode(*new QShaderProgramPrivate, parent)
{
}
-/*! \internal */
QShaderProgram::~QShaderProgram()
{
}
@@ -102,14 +105,15 @@ QShaderProgram::QShaderProgram(QShaderProgramPrivate &dd, QNode *parent)
}
/*!
- \qmlproperty QByteArray Qt3D.Render::ShaderProgram::vertexShaderCode
- Specifies the vertex shader code to be used
-*/
+ \qmlproperty string ShaderProgram::vertexShaderCode
+ Holds the vertex shader code used by this shader program.
+*/
/*!
- \property Qt3DRender::QShaderProgram::vertexShaderCode
- Specifies the vertex shader code to be used
- */
+ \property QShaderProgram::vertexShaderCode
+
+ Holds the vertex shader code used by this shader program.
+*/
void QShaderProgram::setVertexShaderCode(const QByteArray &vertexShaderCode)
{
Q_D(QShaderProgram);
@@ -126,14 +130,15 @@ QByteArray QShaderProgram::vertexShaderCode() const
}
/*!
- \qmlproperty QByteArray Qt3D.Render::ShaderProgram::tessellationControlShaderCode
- Specifies the tessellation control shader code to be used
-*/
+ \qmlproperty string ShaderProgram::tessellationControlShaderCode
+ Holds the tesselation control shader code used by this shader program.
+*/
/*!
- \property Qt3DRender::QShaderProgram::tessellationControlShaderCode
- Specifies the tessellation control shader code to be used
- */
+ \property QShaderProgram::tessellationControlShaderCode
+
+ Holds the tesselation control shader code used by this shader program.
+*/
void QShaderProgram::setTessellationControlShaderCode(const QByteArray &tessellationControlShaderCode)
{
Q_D(QShaderProgram);
@@ -150,14 +155,15 @@ QByteArray QShaderProgram::tessellationControlShaderCode() const
}
/*!
- \qmlproperty QByteArray Qt3D.Render::ShaderProgram::tessellationEvaluationShaderCode
- Specifies the tessellation evaluation shader code to be used
-*/
+ \qmlproperty string ShaderProgram::tessellationEvaluationShaderCode
+ Holds the tesselation evaluation shader code used by this shader program.
+*/
/*!
- \property Qt3DRender::QShaderProgram::tessellationEvaluationShaderCode
- Specifies the tessellation evaluation shader code to be used
- */
+ \property QShaderProgram::tessellationEvaluationShaderCode
+
+ Holds the tesselation evaluation shader code used by this shader program.
+*/
void QShaderProgram::setTessellationEvaluationShaderCode(const QByteArray &tessellationEvaluationShaderCode)
{
Q_D(QShaderProgram);
@@ -174,14 +180,15 @@ QByteArray QShaderProgram::tessellationEvaluationShaderCode() const
}
/*!
- \qmlproperty QByteArray Qt3D.Render::ShaderProgram::geometryShaderCode
- Specifies the geometry shader code to be used
-*/
+ \qmlproperty string ShaderProgram::geometryShaderCode
+ Holds the geometry shader code used by this shader program.
+*/
/*!
- \property Qt3DRender::QShaderProgram::geometryShaderCode
- Specifies the geometry shader code to be used
- */
+ \property QShaderProgram::geometryShaderCode
+
+ Holds the geometry shader code used by this shader program.
+*/
void QShaderProgram::setGeometryShaderCode(const QByteArray &geometryShaderCode)
{
Q_D(QShaderProgram);
@@ -198,14 +205,15 @@ QByteArray QShaderProgram::geometryShaderCode() const
}
/*!
- \qmlproperty QByteArray Qt3D.Render::ShaderProgram::fragmentShaderCode
- Specifies the fragment shader code to be used
-*/
+ \qmlproperty string ShaderProgram::fragmentShaderCode
+ Holds the fragment shader code used by this shader program.
+*/
/*!
- \property Qt3DRender::QShaderProgram::fragmentShaderCode
- Specifies the fragment shader code to be used
- */
+ \property QShaderProgram::fragmentShaderCode
+
+ Holds the fragment shader code used by this shader program.
+*/
void QShaderProgram::setFragmentShaderCode(const QByteArray &fragmentShaderCode)
{
Q_D(QShaderProgram);
@@ -222,14 +230,15 @@ QByteArray QShaderProgram::fragmentShaderCode() const
}
/*!
- \qmlproperty QByteArray Qt3D.Render::ShaderProgram::computeShaderCode
- Specifies the compute shader code to be used
-*/
+ \qmlproperty string ShaderProgram::computeShaderCode
+ Holds the compute shader code used by this shader program.
+*/
/*!
- \property Qt3DRender::QShaderProgram::computeShaderCode
- Specifies the compute shader code to be used
- */
+ \property QShaderProgram::computeShaderCode
+
+ Holds the compute shader code used by this shader program.
+*/
void QShaderProgram::setComputeShaderCode(const QByteArray &computeShaderCode)
{
Q_D(QShaderProgram);
@@ -247,8 +256,8 @@ QByteArray QShaderProgram::computeShaderCode() const
/*!
- * Sets the \a type shader from raw data in \a shaderCode.
- */
+ Sets the shader code for \a type of shader to the \a shaderCode.
+*/
void QShaderProgram::setShaderCode(ShaderType type, const QByteArray &shaderCode)
{
switch (type) {
@@ -276,8 +285,8 @@ void QShaderProgram::setShaderCode(ShaderType type, const QByteArray &shaderCode
}
/*!
- * Returns the \a type shader code.
- */
+ Returns the shader code for \a type.
+*/
QByteArray QShaderProgram::shaderCode(ShaderType type) const
{
Q_D(const QShaderProgram);
@@ -332,13 +341,13 @@ static QByteArray deincludify(const QString &filePath)
}
/*!
- \qmlmethod QByteArray ShaderProgram::loadSource(const QUrl &sourceUrl)
+ \qmlmethod string ShaderProgram::loadSource(url sourceUrl)
Returns the shader code loaded from \a sourceUrl.
*/
/*!
- * Returns the shader code loaded from \a sourceUrl.
- */
+ Returns the shader code loaded from \a sourceUrl.
+*/
QByteArray QShaderProgram::loadSource(const QUrl &sourceUrl)
{
// TO DO: Handle remote path
diff --git a/src/render/materialsystem/qtechnique.cpp b/src/render/materialsystem/qtechnique.cpp
index f114e2754..74505bfbd 100644
--- a/src/render/materialsystem/qtechnique.cpp
+++ b/src/render/materialsystem/qtechnique.cpp
@@ -61,25 +61,62 @@ QTechniquePrivate::~QTechniquePrivate()
}
/*!
- * \qmltype Technique
- * \instantiates Qt3DRender::QTechnique
- * \inqmlmodule Qt3D.Render
- * \brief Encapsulates a Technique.
+ \qmltype Technique
+ \instantiates Qt3DRender::QTechnique
+ \inqmlmodule Qt3D.Render
+ \inherits Qt3DCore::QNode
+ \since 5.7
+ \brief Encapsulates a Technique.
+
+ A Technique specifies a set of RenderPass objects, FilterKey objects, Parameter objects
+ and a GraphicsApiFilter, which together define a rendering technique the given
+ graphics API can render. The filter keys are used by TechniqueFilter
+ to select specific techinques at specific parts of the FrameGraph.
+ If the same parameter is specified both in Technique and RenderPass, the one
+ in Technique overrides the one used in the RenderPass.
+
+ \sa Qt3D.Render::Effect
*/
/*!
- * \class Qt3DRender::QTechnique
- * \inmodule Qt3DRender
- *
- * \inherits Node
- *
- * \brief Encapsulates a Technique.
+ \class Qt3DRender::QTechnique
+ \inmodule Qt3DRender
+ \inherits Node
+ \since 5.7
+ \brief Encapsulates a Technique.
+
+ A Qt3DRender::QTechnique specifies a set of Qt3DRender::QRenderPass objects,
+ Qt3DRender::QFilterKey objects, Qt3DRender::QParameter objects and
+ a Qt3DRender::QGraphicsApiFilter, which together define a rendering technique the given
+ graphics API can render. The filter keys are used by Qt3DRender::QTechniqueFilter
+ to select specific techinques at specific parts of the FrameGraph.
+ If the same parameter is specified both in QTechnique and QRenderPass, the one
+ in QTechnique overrides the one used in the QRenderPass.
+
+ \sa Qt3DRender::QEffect
*/
/*!
- \fn Qt3DRender::QTechnique::QTechnique(Qt3DCore::QNode *parent)
- Constructs a new QTechnique with the specified \a parent.
+ \qmlproperty GraphicsApiFilter Qt3D.Render::Technique::graphicsApiFilter
+ Specifies the graphics API filter being used
+*/
+/*!
+ \qmlproperty list<FilterKey> Qt3D.Render::Technique::filterKeys
+ Specifies the list of filter keys enabling this technique
+*/
+/*!
+ \qmlproperty list<RenderPass> Qt3D.Render::Technique::renderPasses
+ Specifies the render passes used by the tehcnique
+*/
+/*!
+ \qmlproperty list<Parameter> Qt3D.Render::Technique::parameters
+ Specifies the parameters used by the technique
+*/
+/*!
+ \property Qt3DRender::QTechnique::graphicsApiFilter
+ Specifies the graphics API filter being used
*/
+
QTechnique::QTechnique(QNode *parent)
: QNode(*new QTechniquePrivate, parent)
{
@@ -112,7 +149,7 @@ void QTechniquePrivate::_q_graphicsApiFilterChanged()
}
/*!
- * Add \a filterKey to the Qt3DRender::QTechnique local filter keys.
+ Add \a filterKey to the Qt3DRender::QTechnique local filter keys.
*/
void QTechnique::addFilterKey(QFilterKey *filterKey)
{
@@ -140,7 +177,7 @@ void QTechnique::addFilterKey(QFilterKey *filterKey)
}
/*!
- * Removes \a filterKey from the Qt3DRender::QTechnique local filter keys.
+ Removes \a filterKey from the Qt3DRender::QTechnique local filter keys.
*/
void QTechnique::removeFilterKey(QFilterKey *filterKey)
{
@@ -157,8 +194,8 @@ void QTechnique::removeFilterKey(QFilterKey *filterKey)
}
/*!
- * Returns the list of Qt3DCore::QFilterKey key objects making up the filter keys
- * of the Qt3DRender::QTechnique.
+ Returns the list of Qt3DCore::QFilterKey key objects making up the filter keys
+ of the Qt3DRender::QTechnique.
*/
QVector<QFilterKey *> QTechnique::filterKeys() const
{
@@ -167,7 +204,7 @@ QVector<QFilterKey *> QTechnique::filterKeys() const
}
/*!
- * Add \a parameter to the techniques parameters.
+ Add \a parameter to the technique's parameters.
*/
void QTechnique::addParameter(QParameter *parameter)
{
@@ -195,7 +232,7 @@ void QTechnique::addParameter(QParameter *parameter)
}
/*!
- * Remove \a parameter from the techniques parameters.
+ Remove \a parameter from the technique's parameters.
*/
void QTechnique::removeParameter(QParameter *parameter)
{
@@ -212,7 +249,7 @@ void QTechnique::removeParameter(QParameter *parameter)
}
/*!
- * Appends a \a pass to the technique.
+ Appends a \a pass to the technique.
*/
void QTechnique::addRenderPass(QRenderPass *pass)
{
@@ -240,14 +277,14 @@ void QTechnique::addRenderPass(QRenderPass *pass)
}
/*!
- * Removes a \a pass from the technique.
+ Removes a \a pass from the technique.
*/
void QTechnique::removeRenderPass(QRenderPass *pass)
{
Q_ASSERT(pass);
Q_D(QTechnique);
if (d->m_changeArbiter) {
- const auto change = QPropertyNodeAddedChangePtr::create(id(), pass);
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), pass);
change->setPropertyName("pass");
d->notifyObservers(change);
}
@@ -257,7 +294,7 @@ void QTechnique::removeRenderPass(QRenderPass *pass)
}
/*!
- * Returns the list of render passes contained in the technique.
+ Returns the list of render passes contained in the technique.
*/
QVector<QRenderPass *> QTechnique::renderPasses() const
{
@@ -266,7 +303,7 @@ QVector<QRenderPass *> QTechnique::renderPasses() const
}
/*!
- * Returns a vector of the techniques current parameters
+ Returns a vector of the techniques current parameters
*/
QVector<QParameter *> QTechnique::parameters() const
{
@@ -274,15 +311,6 @@ QVector<QParameter *> QTechnique::parameters() const
return d->m_parameters;
}
-/*!
- \qmlproperty QByteArray Qt3D.Render::Technique::graphicsApiFilter
- Specifies the graphics API filter being used
-*/
-
-/*!
- \property Qt3DRender::QTechnique::graphicsApiFilter
- Specifies the graphics API filter being used
- */
QGraphicsApiFilter *QTechnique::graphicsApiFilter()
{
Q_D(QTechnique);
diff --git a/src/render/materialsystem/shaderdata.cpp b/src/render/materialsystem/shaderdata.cpp
index 1f68bed13..e7c8a1c37 100644
--- a/src/render/materialsystem/shaderdata.cpp
+++ b/src/render/materialsystem/shaderdata.cpp
@@ -94,7 +94,6 @@ void ShaderData::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
const QVariant &propertyValue = entry.second;
const QString propertyName = QString::fromLatin1(entry.first);
- m_properties.insert(propertyName, propertyValue);
m_originalProperties.insert(propertyName, propertyValue);
// We check if the property is a QNodeId or QVector<QNodeId> so that we can
@@ -108,14 +107,15 @@ void ShaderData::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
}
}
- // We look for transformed properties
- QHash<QString, QVariant>::iterator it = m_properties.begin();
- const QHash<QString, QVariant>::iterator end = m_properties.end();
+ // We look for transformed properties once the complete hash of
+ // originalProperties is available
+ QHash<QString, QVariant>::iterator it = m_originalProperties.begin();
+ const QHash<QString, QVariant>::iterator end = m_originalProperties.end();
while (it != end) {
if (static_cast<QMetaType::Type>(it.value().type()) == QMetaType::QVector3D) {
// if there is a matching QShaderData::TransformType propertyTransformed
- QVariant value = m_properties.value(it.key() + QLatin1String("Transformed"));
+ QVariant value = m_originalProperties.value(it.key() + QLatin1String("Transformed"));
// if that's the case, we apply a space transformation to the property
if (value.isValid() && value.type() == QVariant::Int)
m_transformedProperties.insert(it.key(), static_cast<TransformType>(value.toInt()));
@@ -138,135 +138,67 @@ ShaderData *ShaderData::lookupResource(QNodeId id)
// Call by cleanup job (single thread)
void ShaderData::clearUpdatedProperties()
{
- m_updatedProperties.clear();
- const QHash<QString, QVariant>::const_iterator end = m_nestedShaderDataProperties.end();
- QHash<QString, QVariant>::const_iterator it = m_nestedShaderDataProperties.begin();
-
- while (it != end) {
- if (it.value().userType() == QMetaType::QVariantList) {
- const auto values = it.value().value<QVariantList>();
- for (const QVariant &v : values) {
- ShaderData *nested = lookupResource(v.value<QNodeId>());
- if (nested != nullptr)
- nested->clearUpdatedProperties();
- }
- } else {
- ShaderData *nested = lookupResource(it.value().value<QNodeId>());
- if (nested != nullptr)
- nested->clearUpdatedProperties();
- }
- ++it;
- }
+ // DISABLED: Is only useful when building UBO from a ShaderData, which is disable since 5.7
+ // const QHash<QString, QVariant>::const_iterator end = m_nestedShaderDataProperties.end();
+ // QHash<QString, QVariant>::const_iterator it = m_nestedShaderDataProperties.begin();
+
+ // while (it != end) {
+ // if (it.value().userType() == QMetaType::QVariantList) {
+ // const auto values = it.value().value<QVariantList>();
+ // for (const QVariant &v : values) {
+ // ShaderData *nested = lookupResource(v.value<QNodeId>());
+ // if (nested != nullptr)
+ // nested->clearUpdatedProperties();
+ // }
+ // } else {
+ // ShaderData *nested = lookupResource(it.value().value<QNodeId>());
+ // if (nested != nullptr)
+ // nested->clearUpdatedProperties();
+ // }
+ // ++it;
+ // }
}
void ShaderData::cleanup(NodeManagers *managers)
{
- for (Qt3DCore::QNodeId id : qAsConst(m_updatedShaderData)) {
- ShaderData *shaderData = ShaderData::lookupResource(managers, id);
- if (shaderData)
- shaderData->clearUpdatedProperties();
- }
+ Q_UNUSED(managers)
+ // DISABLED: Is only useful when building UBO from a ShaderData, which is disable since 5.7
+ // for (Qt3DCore::QNodeId id : qAsConst(m_updatedShaderData)) {
+ // ShaderData *shaderData = ShaderData::lookupResource(managers, id);
+ // if (shaderData)
+ // shaderData->clearUpdatedProperties();
+ // }
m_updatedShaderData.clear();
}
-// Called by renderview jobs (several concurrent threads)
-/*!
- \internal
- Lookup if the current ShaderData or a nested ShaderData has updated properties.
- UpdateProperties contains either the value of the propertie of a QNodeId if it's another ShaderData.
- Transformed properties are updated for all of ShaderData that have ones at the point.
-
- \note This needs to be performed for every top level ShaderData every time it is used.
- As we don't know if the transformed properties use the same viewMatrix for all RenderViews.
- */
-bool ShaderData::updateViewTransform(const QMatrix4x4 &viewMatrix)
+QVariant ShaderData::getTransformedProperty(const QString &name, const QMatrix4x4 &viewMatrix)
{
- // We can't perform this only once as we don't know if we would be call as the root or a
- // nested ShaderData
- QMutexLocker lock(&m_mutex);
-
- // Update transformed properties
- // We check the matrices and decide if the transform has changed since the previous call to needsUpdate
- if (m_viewMatrix != viewMatrix) {
- m_viewMatrix = viewMatrix;
- const QHash<QString, TransformType>::const_iterator transformedEnd = m_transformedProperties.end();
- QHash<QString, TransformType>::const_iterator transformedIt = m_transformedProperties.begin();
-
- while (transformedIt != transformedEnd) {
- if (transformedIt.value() == ModelToEye) {
- m_updatedProperties.insert(transformedIt.key(), m_viewMatrix * m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
- m_properties.insert(transformedIt.key(), m_viewMatrix * m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
- }
- ++transformedIt;
+ // Note protecting m_worldMatrix at this point as we assume all world updates
+ // have been performed when reaching this point
+ auto it = m_transformedProperties.find(name);
+ if (it != m_transformedProperties.end()) {
+ const TransformType transformType = it.value();
+ switch (transformType) {
+ case ModelToEye:
+ return QVariant::fromValue(viewMatrix * m_worldMatrix * m_originalProperties.value(name).value<QVector3D>());
+ case ModelToWorld:
+ return QVariant::fromValue(m_worldMatrix * m_originalProperties.value(it.key()).value<QVector3D>());
+ case ModelToWorldDirection:
+ return QVariant::fromValue((m_worldMatrix * QVector4D(m_originalProperties.value(it.key()).value<QVector3D>(), 0.0f)).toVector3D());
+ case NoTransform:
+ break;
}
}
- const QHash<QString, QVariant>::const_iterator end = m_nestedShaderDataProperties.end();
- QHash<QString, QVariant>::const_iterator it = m_nestedShaderDataProperties.begin();
-
- while (it != end) {
- const int userType = it.value().userType();
-
- if (userType == QMetaType::QVariantList) {
- QVariantList updatedNodes;
- bool nestedNeedsUpdate = false;
- const QVariantList values = variant_value<QVariantList>(it.value());
- for (const QVariant &v : values) {
- if (v.userType() != qNodeIdTypeId)
- continue;
-
- const Qt3DCore::QNodeId nestedId = variant_value<Qt3DCore::QNodeId>(v);
- ShaderData *nested = lookupResource(nestedId);
- if (nested != nullptr) {
- // We need to add the nested nodes to the updated property list
- // as we need to maintain order
- // if node[0] doesn't need update but node[1] does,
- // if we only have a single element, the renderer would update element [0]
- nestedNeedsUpdate |= nested->updateViewTransform(viewMatrix);
- updatedNodes << v;
- }
- }
- // Of course we only add all the nodes if at least one of the nested nodes required and update
- if (nestedNeedsUpdate && !updatedNodes.empty())
- m_updatedProperties.insert(it.key(), updatedNodes);
- } else if (userType == qNodeIdTypeId) {
- const Qt3DCore::QNodeId nestedId = variant_value<Qt3DCore::QNodeId>(it.value());
- ShaderData *nested = lookupResource(nestedId);
- if (nested != nullptr && nested->updateViewTransform(viewMatrix))
- m_updatedProperties.insert(it.key(), it.value());
- }
- ++it;
- }
- return m_updatedProperties.size() > 0;
+ return QVariant();
}
-bool ShaderData::updateWorldTransform(const QMatrix4x4 &worldMatrix)
+// Called by FramePreparationJob or by RenderView when dealing with lights
+void ShaderData::updateWorldTransform(const QMatrix4x4 &worldMatrix)
{
- // TODO: Factor this out into a job that populates data in the corresponding
- // renderview or other intermediate data structure. See QTBUG-54818
QMutexLocker lock(&m_mutex);
if (m_worldMatrix != worldMatrix) {
m_worldMatrix = worldMatrix;
-
- const QHash<QString, TransformType>::const_iterator transformedEnd = m_transformedProperties.end();
- QHash<QString, TransformType>::const_iterator transformedIt = m_transformedProperties.begin();
-
- while (transformedIt != transformedEnd) {
- if (transformedIt.value() == ModelToEye) {
- m_updatedProperties.insert(transformedIt.key(), m_viewMatrix * m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
- m_properties.insert(transformedIt.key(), m_viewMatrix * m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
- } else if (transformedIt.value() == ModelToWorldDirection) {
- auto localDirection = QVector4D(m_originalProperties.value(transformedIt.key()).value<QVector3D>(), 0.0f);
- auto worldDirection = (m_worldMatrix * localDirection).toVector3D();
- m_updatedProperties.insert(transformedIt.key(), worldDirection);
- m_properties.insert(transformedIt.key(), worldDirection);
- } else {
- m_updatedProperties.insert(transformedIt.key(), m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
- m_properties.insert(transformedIt.key(), m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
- }
- ++transformedIt;
- }
}
- return m_updatedProperties.size() > 0;
}
// This will add the ShaderData to be cleared from updates at the end of the frame
@@ -279,6 +211,21 @@ void ShaderData::markDirty()
ShaderData::m_updatedShaderData.append(peerId());
}
+/*!
+ \internal
+ Lookup if the current ShaderData or a nested ShaderData has updated properties.
+ UpdateProperties contains either the value of the propertie of a QNodeId if it's another ShaderData.
+ Transformed properties are updated for all of ShaderData that have ones at the point.
+
+ \note This needs to be performed for every top level ShaderData every time it is used.
+ As we don't know if the transformed properties use the same viewMatrix for all RenderViews.
+ */
+
+ShaderData::TransformType ShaderData::propertyTransformType(const QString &name) const
+{
+ return m_transformedProperties.value(name, TransformType::NoTransform);
+}
+
void ShaderData::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
if (!m_propertyReader.isNull() && e->type() == PropertyUpdated) {
@@ -297,19 +244,7 @@ void ShaderData::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
// Note we aren't notified about nested QShaderData in this call
// only scalar / vec properties
- if (m_properties.contains(propertyName)) {
- // If this is a Transformed property, we need to multiply against the correct
- // matrices
- m_originalProperties.insert(propertyName, propertyValue);
- if (m_transformedProperties.contains(propertyName)) {
- if (m_transformedProperties[propertyName] == ModelToEye)
- propertyValue = m_viewMatrix * m_worldMatrix * propertyValue.value<QVector3D>();
- else
- propertyValue = m_worldMatrix * propertyValue.value<QVector3D>();
- }
- m_properties.insert(propertyName, propertyValue);
- m_updatedProperties.insert(propertyName, propertyValue);
- }
+ m_originalProperties.insert(propertyName, propertyValue);
BackendNode::markDirty(AbstractRenderer::AllDirty);
}
diff --git a/src/render/materialsystem/shaderdata_p.h b/src/render/materialsystem/shaderdata_p.h
index 46dd26faf..6ce0c734c 100644
--- a/src/render/materialsystem/shaderdata_p.h
+++ b/src/render/materialsystem/shaderdata_p.h
@@ -71,6 +71,7 @@ class Q_AUTOTEST_EXPORT ShaderData : public BackendNode
{
public:
enum TransformType {
+ NoTransform = -1,
ModelToEye = 0,
ModelToWorld,
ModelToWorldDirection
@@ -79,15 +80,16 @@ public:
ShaderData();
~ShaderData();
- QHash<QString, QVariant> properties() const { return m_properties; }
- QHash<QString, QVariant> updatedProperties() const { return m_updatedProperties; }
+ QHash<QString, QVariant> properties() const { return m_originalProperties; }
// Called by FramePreparationJob
- bool updateWorldTransform(const QMatrix4x4 &worldMatrix);
+ void updateWorldTransform(const QMatrix4x4 &worldMatrix);
// Call by RenderViewJob
void markDirty();
- bool updateViewTransform(const QMatrix4x4 &viewMatrix);
+
+ TransformType propertyTransformType(const QString &name) const;
+ QVariant getTransformedProperty(const QString &name, const QMatrix4x4 &viewMatrix);
// Called by FrameCleanupJob
static void cleanup(NodeManagers *managers);
@@ -98,17 +100,18 @@ protected:
void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ PropertyReaderInterfacePtr m_propertyReader;
+
// 1 to 1 match with frontend properties, modified only by sceneChangeEvent
QHash<QString, QVariant> m_originalProperties;
- // 1 to 1 match with frontend properties apart from Transformed
- // properties which contain the matrices product
- QHash<QString, QVariant> m_properties;
- // only updated properties, Transformed properties have the same
- // value as in m_properties
- QHash<QString, QVariant> m_updatedProperties;
- PropertyReaderInterfacePtr m_propertyReader;
+
+ // Contains properties thar are of type ShaderData
QHash<QString, QVariant> m_nestedShaderDataProperties;
+
+ // Contains property that are defined like: postionTransformed: ModelToEye
QHash<QString, TransformType> m_transformedProperties;
+
+
QMutex m_mutex;
static QVector<Qt3DCore::QNodeId> m_updatedShaderData;
QMatrix4x4 m_worldMatrix;
diff --git a/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp b/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp
index ddd9eed22..fa1657732 100644
--- a/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp
+++ b/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp
@@ -286,13 +286,13 @@ private Q_SLOTS:
<< QVector3D(1.0f, 0.0f, 0.0f)
<< QVector3D(1.0f, 0.0f, 0.0f));
const auto texCoords = (QVector<QVector2D>()
- << QVector2D(0.0f, 0.0f)
- << QVector2D(0.0f, 1.0f)
- << QVector2D(1.0f, 0.0f));
+ << QVector2D(1.0f, 0.0f)
+ << QVector2D(1.0f, 1.0f)
+ << QVector2D(0.0f, 0.0f));
const auto tangents = (QVector<QVector4D>()
- << QVector4D(0.0f, 0.0f, 1.0f, -1.0f)
- << QVector4D(0.0f, 0.0f, 1.0f, -1.0f)
- << QVector4D(0.0f, 0.0f, 1.0f, -1.0f));
+ << QVector4D(0.0f, 0.0f, -1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, -1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, -1.0f, 1.0f));
QTest::newRow("default_positiveX_firstTriangle")
<< 1.0f << 1.0f << 1.0f
<< QSize(2,2) << QSize(2,2) << QSize(2,2)
@@ -312,13 +312,13 @@ private Q_SLOTS:
<< QVector3D(-1.0f, 0.0f, 0.0f)
<< QVector3D(-1.0f, 0.0f, 0.0f));
const auto texCoords = (QVector<QVector2D>()
- << QVector2D(1.0f, 0.0f)
- << QVector2D(0.0f, 1.0f)
- << QVector2D(1.0f, 1.0f));
+ << QVector2D(0.0f, 0.0f)
+ << QVector2D(1.0f, 1.0f)
+ << QVector2D(0.0f, 1.0f));
const auto tangents = (QVector<QVector4D>()
- << QVector4D(0.0f, 0.0f, -1.0f, -1.0f)
- << QVector4D(0.0f, 0.0f, -1.0f, -1.0f)
- << QVector4D(0.0f, 0.0f, -1.0f, -1.0f));
+ << QVector4D(0.0f, 0.0f, 1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, 1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, 1.0f, 1.0f));
QTest::newRow("default_negativeX_lastTriangle")
<< 1.0f << 1.0f << 1.0f
<< QSize(2,2) << QSize(2,2) << QSize(2,2)
@@ -429,6 +429,162 @@ private Q_SLOTS:
<< triangleIndex
<< indices << positions << normals << texCoords << tangents;
}
+
+ {
+ const int triangleIndex = 0;
+ const auto indices = (QVector<quint16>() << 0 << 1 << 2);
+ const auto positions = (QVector<QVector3D>()
+ << QVector3D(1.0f, -1.5f, -2.5f)
+ << QVector3D(1.0f, 1.5f, -2.5f)
+ << QVector3D(1.0f, -1.5f, -1.25f));
+ const auto normals = (QVector<QVector3D>()
+ << QVector3D(1.0f, 0.0f, 0.0f)
+ << QVector3D(1.0f, 0.0f, 0.0f)
+ << QVector3D(1.0f, 0.0f, 0.0f));
+ const auto texCoords = (QVector<QVector2D>()
+ << QVector2D(1.0f, 0.0f)
+ << QVector2D(1.0f, 1.0f)
+ << QVector2D(0.75f, 0.0f));
+ const auto tangents = (QVector<QVector4D>()
+ << QVector4D(0.0f, 0.0f, -1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, -1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, -1.0f, 1.0f));
+ QTest::newRow("default_positiveX_firstTriangle_nonSymmetric")
+ << 2.0f << 3.0f << 5.0f
+ << QSize(2,3) << QSize(2,5) << QSize(2,9)
+ << triangleIndex
+ << indices << positions << normals << texCoords << tangents;
+ }
+
+ {
+ const int triangleIndex = 15;
+ const auto indices = (QVector<quint16>() << 18 << 17 << 19);
+ const auto positions = (QVector<QVector3D>()
+ << QVector3D(-1.0f, -1.5f, -2.5f)
+ << QVector3D(-1.0f, 1.5f, -1.25f)
+ << QVector3D(-1.0f, 1.5f, -2.5f));
+ const auto normals = (QVector<QVector3D>()
+ << QVector3D(-1.0f, 0.0f, 0.0f)
+ << QVector3D(-1.0f, 0.0f, 0.0f)
+ << QVector3D(-1.0f, 0.0f, 0.0f));
+ const auto texCoords = (QVector<QVector2D>()
+ << QVector2D(0.0f, 0.0f)
+ << QVector2D(0.25f, 1.0f)
+ << QVector2D(0.0f, 1.0f));
+ const auto tangents = (QVector<QVector4D>()
+ << QVector4D(0.0f, 0.0f, 1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, 1.0f, 1.0f)
+ << QVector4D(0.0f, 0.0f, 1.0f, 1.0f));
+ QTest::newRow("default_negativeX_lastTriangle_nonSymmetric")
+ << 2.0f << 3.0f << 5.0f
+ << QSize(2,3) << QSize(2,5) << QSize(2,9)
+ << triangleIndex
+ << indices << positions << normals << texCoords << tangents;
+ }
+
+ {
+ const int triangleIndex = 16;
+ const auto indices = (QVector<quint16>() << 20 << 21 << 22);
+ const auto positions = (QVector<QVector3D>()
+ << QVector3D(-1.0f, 1.5f, 2.5f)
+ << QVector3D(1.0f, 1.5f, 2.5f)
+ << QVector3D(-1.0f, 1.5f, 1.875f));
+ const auto normals = (QVector<QVector3D>()
+ << QVector3D(0.0f, 1.0f, 0.0f)
+ << QVector3D(0.0f, 1.0f, 0.0f)
+ << QVector3D(0.0f, 1.0f, 0.0f));
+ const auto texCoords = (QVector<QVector2D>()
+ << QVector2D(0.0f, 0.0f)
+ << QVector2D(1.0f, 0.0f)
+ << QVector2D(0.0f, 0.125f));
+ const auto tangents = (QVector<QVector4D>()
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f));
+ QTest::newRow("default_positiveY_firstTriangle_nonSymmetric")
+ << 2.0f << 3.0f << 5.0f
+ << QSize(2,3) << QSize(2,5) << QSize(2,9)
+ << triangleIndex
+ << indices << positions << normals << texCoords << tangents;
+ }
+
+ {
+ const int triangleIndex = 47;
+ const auto indices = (QVector<quint16>() << 54 << 53 << 55);
+ const auto positions = (QVector<QVector3D>()
+ << QVector3D(-1.0f, -1.5f, 2.5f)
+ << QVector3D(1.0f, -1.5f, 1.875f)
+ << QVector3D(1.0f, -1.5f, 2.5f));
+ const auto normals = (QVector<QVector3D>()
+ << QVector3D(0.0f, -1.0f, 0.0f)
+ << QVector3D(0.0f, -1.0f, 0.0f)
+ << QVector3D(0.0f, -1.0f, 0.0f));
+ const auto texCoords = (QVector<QVector2D>()
+ << QVector2D(0.0f, 1.0f)
+ << QVector2D(1.0f, 0.875f)
+ << QVector2D(1.0f, 1.0f));
+ const auto tangents = (QVector<QVector4D>()
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f));
+ QTest::newRow("default_negativeY_lastTriangle_nonSymmetric")
+ << 2.0f << 3.0f << 5.0f
+ << QSize(2,3) << QSize(2,5) << QSize(2,9)
+ << triangleIndex
+ << indices << positions << normals << texCoords << tangents;
+ }
+
+ {
+ const int triangleIndex = 48;
+ const auto indices = (QVector<quint16>() << 56 << 57 << 58);
+ const auto positions = (QVector<QVector3D>()
+ << QVector3D(-1.0f, -1.5f, 2.5f)
+ << QVector3D(1.0f, -1.5f, 2.5f)
+ << QVector3D(-1.0f, 0.0f, 2.5f));
+ const auto normals = (QVector<QVector3D>()
+ << QVector3D(0.0f, 0.0f, 1.0f)
+ << QVector3D(0.0f, 0.0f, 1.0f)
+ << QVector3D(0.0f, 0.0f, 1.0f));
+ const auto texCoords = (QVector<QVector2D>()
+ << QVector2D(0.0f, 0.0f)
+ << QVector2D(1.0f, 0.0f)
+ << QVector2D(0.0f, 0.5f));
+ const auto tangents = (QVector<QVector4D>()
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(1.0f, 0.0f, 0.0f, 1.0f));
+ QTest::newRow("default_positiveZ_firstTriangle_nonSymmetric")
+ << 2.0f << 3.0f << 5.0f
+ << QSize(2,3) << QSize(2,5) << QSize(2,9)
+ << triangleIndex
+ << indices << positions << normals << texCoords << tangents;
+ }
+
+ {
+ const int triangleIndex = 55;
+ const auto indices = (QVector<quint16>() << 66 << 65 << 67);
+ const auto positions = (QVector<QVector3D>()
+ << QVector3D(1.0f, 1.5f, -2.5f)
+ << QVector3D(-1.0f, 0.0f, -2.5f)
+ << QVector3D(-1.0f, 1.5f, -2.5f));
+ const auto normals = (QVector<QVector3D>()
+ << QVector3D(0.0f, 0.0f, -1.0f)
+ << QVector3D(0.0f, 0.0f, -1.0f)
+ << QVector3D(0.0f, 0.0f, -1.0f));
+ const auto texCoords = (QVector<QVector2D>()
+ << QVector2D(0.0f, 1.0f)
+ << QVector2D(1.0f, 0.5f)
+ << QVector2D(1.0f, 1.0f));
+ const auto tangents = (QVector<QVector4D>()
+ << QVector4D(-1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(-1.0f, 0.0f, 0.0f, 1.0f)
+ << QVector4D(-1.0f, 0.0f, 0.0f, 1.0f));
+ QTest::newRow("default_negativeZ_lastTriangle_nonSymmetric")
+ << 2.0f << 3.0f << 5.0f
+ << QSize(2,3) << QSize(2,5) << QSize(2,9)
+ << triangleIndex
+ << indices << positions << normals << texCoords << tangents;
+ }
}
void generatedGeometryShouldBeConsistent()
diff --git a/tests/auto/render/loadscenejob/loadscenejob.pro b/tests/auto/render/loadscenejob/loadscenejob.pro
new file mode 100644
index 000000000..3901c3545
--- /dev/null
+++ b/tests/auto/render/loadscenejob/loadscenejob.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+
+TARGET = tst_loadscenejob
+
+QT += 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_loadscenejob.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/render/loadscenejob/tst_loadscenejob.cpp b/tests/auto/render/loadscenejob/tst_loadscenejob.cpp
new file mode 100644
index 000000000..3428ecbea
--- /dev/null
+++ b/tests/auto/render/loadscenejob/tst_loadscenejob.cpp
@@ -0,0 +1,287 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Paul Lemire <paul.lemire350@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <Qt3DRender/private/scene_p.h>
+#include <Qt3DRender/private/loadscenejob_p.h>
+#include <Qt3DRender/private/qsceneiohandler_p.h>
+#include <Qt3DRender/private/nodemanagers_p.h>
+#include <Qt3DRender/private/scenemanager_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/QEntity>
+#include <Qt3DCore/private/qbackendnode_p.h>
+#include "testpostmanarbiter.h"
+
+class TestIOSceneHandler : public Qt3DRender::QSceneIOHandler
+{
+public:
+ explicit TestIOSceneHandler(bool supportsFormat, bool shouldFail)
+ : m_supportsFormat(supportsFormat)
+ , m_shouldFail(shouldFail)
+ {}
+
+ void setSource(const QUrl &source) Q_DECL_OVERRIDE
+ {
+ m_source = source;
+ }
+
+ bool isFileTypeSupported(const QUrl &) const Q_DECL_OVERRIDE
+ {
+ return m_supportsFormat;
+ }
+
+ Qt3DCore::QEntity *scene(const QString &) Q_DECL_OVERRIDE
+ {
+ return m_shouldFail ? nullptr : new Qt3DCore::QEntity();
+ }
+
+ Qt3DCore::QEntity *node(const QString &) Q_DECL_OVERRIDE
+ {
+ return m_shouldFail ? nullptr : new Qt3DCore::QEntity();
+ }
+
+ QUrl source() const
+ {
+ return m_source;
+ }
+
+private:
+ QUrl m_source;
+ bool m_supportsFormat;
+ bool m_shouldFail;
+};
+
+class tst_LoadSceneJob : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void checkInitialState()
+ {
+ // GIVEN
+ QUrl url;
+ Qt3DCore::QNodeId nodeId;
+ Qt3DRender::Render::LoadSceneJob backendLoadSceneJob(url, nodeId);
+
+ // THEN
+ QCOMPARE(backendLoadSceneJob.source(), url);
+ QCOMPARE(backendLoadSceneJob.sceneComponentId(), nodeId);
+ QVERIFY(backendLoadSceneJob.nodeManagers() == nullptr);
+ QCOMPARE(backendLoadSceneJob.sceneIOHandlers().size(), 0);
+ }
+
+ void checkInitialize()
+ {
+ // GIVEN
+ const QUrl url(QStringLiteral("URL"));
+ const Qt3DCore::QNodeId sceneId = Qt3DCore::QNodeId::createId();
+ Qt3DRender::Render::NodeManagers nodeManagers;
+ TestIOSceneHandler fakeHandler(true, true);
+
+ // WHEN
+ Qt3DRender::Render::LoadSceneJob backendLoadSceneJob(url, sceneId);
+ backendLoadSceneJob.setNodeManagers(&nodeManagers);
+ backendLoadSceneJob.setSceneIOHandlers(QList<Qt3DRender::QSceneIOHandler *>() << &fakeHandler);
+
+ // THEN
+ QCOMPARE(backendLoadSceneJob.source(), url);
+ QCOMPARE(backendLoadSceneJob.sceneComponentId(), sceneId);
+ QVERIFY(backendLoadSceneJob.nodeManagers() == &nodeManagers);
+ QCOMPARE(backendLoadSceneJob.sceneIOHandlers().size(), 1);
+ QCOMPARE(backendLoadSceneJob.sceneIOHandlers().first(), &fakeHandler);
+ }
+
+ void checkRunValidSourceSupportedFormat()
+ {
+ // GIVEN
+ const QUrl url(QStringLiteral("URL"));
+ TestArbiter arbiter;
+ Qt3DRender::Render::NodeManagers nodeManagers;
+ TestIOSceneHandler fakeHandler(true, false);
+ Qt3DCore::QNodeId sceneId = Qt3DCore::QNodeId::createId();
+ Qt3DRender::Render::Scene *scene = nodeManagers.sceneManager()->getOrCreateResource(sceneId);
+
+ // THEN
+ QVERIFY(scene != nullptr);
+ Qt3DCore::QBackendNodePrivate::get(scene)->setArbiter(&arbiter);
+
+ // WHEN
+ Qt3DRender::Render::LoadSceneJob loadSceneJob(url, sceneId);
+ loadSceneJob.setNodeManagers(&nodeManagers);
+ loadSceneJob.setSceneIOHandlers(QList<Qt3DRender::QSceneIOHandler *>() << &fakeHandler);
+ loadSceneJob.run();
+
+ // THEN
+ QCOMPARE(arbiter.events.count(), 4);
+ auto change = arbiter.events.at(0).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None);
+
+ change = arbiter.events.at(1).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Loading);
+
+ change = arbiter.events.at(2).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "scene");
+ QVERIFY(change->value().value<Qt3DCore::QEntity *>() != nullptr);
+ delete change->value().value<Qt3DCore::QEntity *>();
+
+ change = arbiter.events.at(3).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Ready);
+ }
+
+ void checkEmptySource()
+ {
+ // GIVEN
+ QUrl url;
+ TestArbiter arbiter;
+ Qt3DRender::Render::NodeManagers nodeManagers;
+ TestIOSceneHandler fakeHandler(true, false);
+ Qt3DCore::QNodeId sceneId = Qt3DCore::QNodeId::createId();
+ Qt3DRender::Render::Scene *scene = nodeManagers.sceneManager()->getOrCreateResource(sceneId);
+
+ // THEN
+ QVERIFY(scene != nullptr);
+ Qt3DCore::QBackendNodePrivate::get(scene)->setArbiter(&arbiter);
+
+ // WHEN
+ Qt3DRender::Render::LoadSceneJob loadSceneJob(url, sceneId);
+ loadSceneJob.setNodeManagers(&nodeManagers);
+ loadSceneJob.setSceneIOHandlers(QList<Qt3DRender::QSceneIOHandler *>() << &fakeHandler);
+ loadSceneJob.run();
+
+ // THEN
+ QCOMPARE(arbiter.events.count(), 3);
+ auto change = arbiter.events.at(0).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None);
+
+ change = arbiter.events.at(1).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "scene");
+ QVERIFY(change->value().value<Qt3DCore::QEntity *>() == nullptr);
+
+ change = arbiter.events.at(2).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None);
+ }
+
+ void checkRunValidSourceUnsupportedFormat()
+ {
+ // GIVEN
+ const QUrl url(QStringLiteral("URL"));
+ TestArbiter arbiter;
+ Qt3DRender::Render::NodeManagers nodeManagers;
+ TestIOSceneHandler fakeHandler(false, false);
+ Qt3DCore::QNodeId sceneId = Qt3DCore::QNodeId::createId();
+ Qt3DRender::Render::Scene *scene = nodeManagers.sceneManager()->getOrCreateResource(sceneId);
+
+ // THEN
+ QVERIFY(scene != nullptr);
+ Qt3DCore::QBackendNodePrivate::get(scene)->setArbiter(&arbiter);
+
+ // WHEN
+ Qt3DRender::Render::LoadSceneJob loadSceneJob(url, sceneId);
+ loadSceneJob.setNodeManagers(&nodeManagers);
+ loadSceneJob.setSceneIOHandlers(QList<Qt3DRender::QSceneIOHandler *>() << &fakeHandler);
+ loadSceneJob.run();
+
+ // THEN
+ QCOMPARE(arbiter.events.count(), 3);
+ auto change = arbiter.events.at(0).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None);
+
+ change = arbiter.events.at(1).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "scene");
+ QVERIFY(change->value().value<Qt3DCore::QEntity *>() == nullptr);
+
+ change = arbiter.events.at(2).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Error);
+ }
+
+ void checkRunErrorAtLoading()
+ {
+ // GIVEN
+ const QUrl url(QStringLiteral("URL"));
+ TestArbiter arbiter;
+ Qt3DRender::Render::NodeManagers nodeManagers;
+ TestIOSceneHandler fakeHandler(true, true);
+ Qt3DCore::QNodeId sceneId = Qt3DCore::QNodeId::createId();
+ Qt3DRender::Render::Scene *scene = nodeManagers.sceneManager()->getOrCreateResource(sceneId);
+
+ // THEN
+ QVERIFY(scene != nullptr);
+ Qt3DCore::QBackendNodePrivate::get(scene)->setArbiter(&arbiter);
+
+ // WHEN
+ Qt3DRender::Render::LoadSceneJob loadSceneJob(url, sceneId);
+ loadSceneJob.setNodeManagers(&nodeManagers);
+ loadSceneJob.setSceneIOHandlers(QList<Qt3DRender::QSceneIOHandler *>() << &fakeHandler);
+ loadSceneJob.run();
+
+ // THEN
+ QCOMPARE(arbiter.events.count(), 4);
+ auto change = arbiter.events.at(0).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::None);
+
+ change = arbiter.events.at(1).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Loading);
+
+ change = arbiter.events.at(2).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "scene");
+ QVERIFY(change->value().value<Qt3DCore::QEntity *>() == nullptr);
+ delete change->value().value<Qt3DCore::QEntity *>();
+
+ change = arbiter.events.at(3).staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->subjectId(), scene->peerId());
+ QCOMPARE(change->propertyName(), "status");
+ QCOMPARE(change->value().value<Qt3DRender::QSceneLoader::Status>(), Qt3DRender::QSceneLoader::Error);
+ }
+};
+
+QTEST_MAIN(tst_LoadSceneJob)
+
+#include "tst_loadscenejob.moc"
diff --git a/tests/auto/render/render.pro b/tests/auto/render/render.pro
index 34b282610..69080ea47 100644
--- a/tests/auto/render/render.pro
+++ b/tests/auto/render/render.pro
@@ -58,6 +58,7 @@ qtConfig(private_tests) {
qrendertargetoutput \
qcameralens \
qcomputecommand \
+ loadscenejob \
qrendercapture \
uniform
}
diff --git a/tests/auto/render/renderviewutils/tst_renderviewutils.cpp b/tests/auto/render/renderviewutils/tst_renderviewutils.cpp
index df68a61d4..e4681a257 100644
--- a/tests/auto/render/renderviewutils/tst_renderviewutils.cpp
+++ b/tests/auto/render/renderviewutils/tst_renderviewutils.cpp
@@ -47,6 +47,7 @@ private Q_SLOTS:
void topLevelStructValue_data();
void topLevelStructValue();
void topLevelDynamicProperties();
+ void transformedProperties();
void shouldNotifyDynamicPropertyChanges();
private:
@@ -496,6 +497,51 @@ void tst_RenderViewUtils::topLevelDynamicProperties()
shaderData->property("array"));
}
+void tst_RenderViewUtils::transformedProperties()
+{
+ // GIVEN
+ QScopedPointer<Qt3DRender::QShaderData> shaderData(new Qt3DRender::QShaderData());
+ QScopedPointer<Qt3DRender::Render::ShaderDataManager> manager(new Qt3DRender::Render::ShaderDataManager());
+
+ // WHEN
+ const QVector3D position = QVector3D(15.0f, -5.0f, 10.0f);
+ QMatrix4x4 worldMatrix;
+ QMatrix4x4 viewMatrix;
+
+ worldMatrix.translate(-3.0f, 2.0f, 7.5f);
+ viewMatrix.translate(9.0f, 6.0f, 12.0f);
+
+ shaderData->setProperty("position0", position);
+ shaderData->setProperty("position1", position);
+ shaderData->setProperty("position2", position);
+ shaderData->setProperty("position3", position);
+ shaderData->setProperty("position1Transformed", Qt3DRender::Render::ShaderData::ModelToEye);
+ shaderData->setProperty("position2Transformed", Qt3DRender::Render::ShaderData::ModelToWorld);
+ shaderData->setProperty("position3Transformed", Qt3DRender::Render::ShaderData::ModelToWorldDirection);
+ initBackendShaderData(shaderData.data(), manager.data());
+
+ // THEN
+ Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id());
+ QVERIFY(backendShaderData != nullptr);
+ QCOMPARE(backendShaderData->propertyTransformType(QStringLiteral("position0")), Qt3DRender::Render::ShaderData::NoTransform);
+ QCOMPARE(backendShaderData->propertyTransformType(QStringLiteral("position1")), Qt3DRender::Render::ShaderData::ModelToEye);
+ QCOMPARE(backendShaderData->propertyTransformType(QStringLiteral("position2")), Qt3DRender::Render::ShaderData::ModelToWorld);
+ QCOMPARE(backendShaderData->propertyTransformType(QStringLiteral("position3")), Qt3DRender::Render::ShaderData::ModelToWorldDirection);
+
+ // WHEN
+ backendShaderData->updateWorldTransform(worldMatrix);
+ const QVector3D position1Value = backendShaderData->getTransformedProperty(QStringLiteral("position1"), viewMatrix).value<QVector3D>();
+ const QVector3D position2Value = backendShaderData->getTransformedProperty(QStringLiteral("position2"), viewMatrix).value<QVector3D>();
+ const QVector3D position3Value = backendShaderData->getTransformedProperty(QStringLiteral("position3"), viewMatrix).value<QVector3D>();
+ const QVariant position0Value = backendShaderData->getTransformedProperty(QStringLiteral("position0"), viewMatrix);
+
+ // THEN
+ QCOMPARE(position0Value, QVariant());
+ QCOMPARE(position1Value, viewMatrix * worldMatrix * position);
+ QCOMPARE(position2Value, worldMatrix * position);
+ QCOMPARE(position3Value, (worldMatrix * QVector4D(position, 0.0f)).toVector3D());
+}
+
void tst_RenderViewUtils::shouldNotifyDynamicPropertyChanges()
{
// GIVEN
diff --git a/tests/manual/bigscene-cpp/main.cpp b/tests/manual/bigscene-cpp/main.cpp
index ebbd499f3..791aeb19d 100644
--- a/tests/manual/bigscene-cpp/main.cpp
+++ b/tests/manual/bigscene-cpp/main.cpp
@@ -61,7 +61,7 @@
#include <Qt3DCore/qaspectengine.h>
#include <Qt3DInput/QInputAspect>
#include <Qt3DRender/QParameter>
-#include <Qt3DExtras//QCylinderMesh>
+#include <Qt3DExtras/QCylinderMesh>
#include <Qt3DRender/QRenderAspect>
#include <Qt3DRender/QCameraSelector>
#include <Qt3DExtras/QPhongMaterial>
diff --git a/tests/manual/deferred-renderer-cpp/main.cpp b/tests/manual/deferred-renderer-cpp/main.cpp
index baafb4796..47425e7ee 100644
--- a/tests/manual/deferred-renderer-cpp/main.cpp
+++ b/tests/manual/deferred-renderer-cpp/main.cpp
@@ -51,8 +51,8 @@
#include <Qt3DCore/QEntity>
#include <Qt3DRender/QMaterial>
-#include <Qt3DExtras//QSphereMesh>
-#include <Qt3DExtras//QPlaneMesh>
+#include <Qt3DExtras/QSphereMesh>
+#include <Qt3DExtras/QPlaneMesh>
#include <Qt3DRender/QLayer>
#include <Qt3DRender/QParameter>
#include <Qt3DRender/QCamera>