From 10362761821f4beff68cf1ebd2b0703b3e28e7bf Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Fri, 26 Aug 2016 10:28:15 +0200 Subject: QPointSize: update doc Change-Id: Ifcd3e3fbe7198bd9191c16b8d570b240560e400d Reviewed-by: Kevin Ottens --- src/render/renderstates/qpointsize.cpp | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/render/renderstates/qpointsize.cpp b/src/render/renderstates/qpointsize.cpp index 8aa2d7e0c..03c37bc4b 100644 --- a/src/render/renderstates/qpointsize.cpp +++ b/src/render/renderstates/qpointsize.cpp @@ -51,11 +51,36 @@ namespace Qt3DRender { \brief Specifies the size of rasterized points. May either be set statically or by shader programs. - When using StaticValue, the value is set using glPointSize(), if available. - When using Programmable, gl_PointSize must be set within shader programs, - the value provided to this RenderState is ignored in that case. + When the sizeMode property is set to SizeMode::Fixed, the value is set + using glPointSize(), if available. When using SizeMode::Programmable, + gl_PointSize must be set within shader programs, the value provided to this + RenderState is ignored in that case. */ +/*! + \qmltype PointSize + \instantiates Qt3DRender::QPointSize + \inqmlmodule Qt3D.Render + + \brief Specifies the size of rasterized points. May either be set statically + or by shader programs. + + When the sizeMode property is set to SizeMode::Fixed, the value is set + using glPointSize(), if available. When using SizeMode::Programmable, + gl_PointSize must be set within shader programs, the value provided to this + RenderState is ignored in that case. + */ + +/*! + \qmlproperty float Qt3D.Render::QPointSize::value + Specifies the point size value to be used. +*/ + +/*! + \qmlproperty QPointSize::SizeMode Qt3D.Render::QPointSize::sizeMode + Specifies the sizeMode to be used. +*/ + QPointSize::QPointSize(Qt3DCore::QNode *parent) : QRenderState(*new QPointSizePrivate(SizeMode::Programmable, 0.f), parent) { -- cgit v1.2.3 From e75c6e7ec4592631ebc741399577be6420cd54aa Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Fri, 26 Aug 2016 10:24:25 +0200 Subject: LoadSceneJob: make testable Change-Id: I45454defa83f240851192a87e900a2bab47d2acb Reviewed-by: Kevin Ottens --- src/render/jobs/loadscenejob.cpp | 20 ++++++++++++++++++++ src/render/jobs/loadscenejob_p.h | 8 ++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/render/jobs/loadscenejob.cpp b/src/render/jobs/loadscenejob.cpp index 3111e1ba3..79ac91d9a 100644 --- a/src/render/jobs/loadscenejob.cpp +++ b/src/render/jobs/loadscenejob.cpp @@ -60,6 +60,26 @@ LoadSceneJob::LoadSceneJob(const QUrl &source, Qt3DCore::QNodeId m_sceneComponen SET_JOB_RUN_STAT_TYPE(this, JobTypes::LoadScene, 0); } +NodeManagers *LoadSceneJob::nodeManagers() const +{ + return m_managers; +} + +QList LoadSceneJob::sceneIOHandlers() const +{ + return m_sceneIOHandlers; +} + +QUrl LoadSceneJob::source() const +{ + return m_source; +} + +Qt3DCore::QNodeId LoadSceneJob::sceneComponentId() const +{ + return m_sceneComponent; +} + void LoadSceneJob::run() { // Iterate scene IO handlers until we find one that can handle this file type diff --git a/src/render/jobs/loadscenejob_p.h b/src/render/jobs/loadscenejob_p.h index bc122d705..0ed0d2c83 100644 --- a/src/render/jobs/loadscenejob_p.h +++ b/src/render/jobs/loadscenejob_p.h @@ -66,14 +66,18 @@ namespace Render { class NodeManagers; -class LoadSceneJob : public Qt3DCore::QAspectJob +class Q_AUTOTEST_EXPORT LoadSceneJob : public Qt3DCore::QAspectJob { public: explicit LoadSceneJob(const QUrl &source, Qt3DCore::QNodeId sceneComponent); void setNodeManagers(NodeManagers *managers) { m_managers = managers; } void setSceneIOHandlers(const QList sceneIOHandlers) { m_sceneIOHandlers = sceneIOHandlers; } -protected: + NodeManagers *nodeManagers() const; + QList sceneIOHandlers() const; + QUrl source() const; + Qt3DCore::QNodeId sceneComponentId() const; + void run() Q_DECL_OVERRIDE; private: -- cgit v1.2.3 From 663f26e1c16cb1794410281f54156424f67603ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Fri, 12 Aug 2016 15:39:03 +0300 Subject: Add unit tests for QRenderCapture frontend node Unit tests for the frontend node. Change-Id: I5cb97533da655771155815782e68d8ce2ff463aa Reviewed-by: Kevin Ottens --- .../auto/render/qrendercapture/qrendercapture.pro | 11 ++ .../render/qrendercapture/tst_qrendercapture.cpp | 113 +++++++++++++++++++++ tests/auto/render/render.pro | 3 +- 3 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 tests/auto/render/qrendercapture/qrendercapture.pro create mode 100644 tests/auto/render/qrendercapture/tst_qrendercapture.cpp diff --git a/tests/auto/render/qrendercapture/qrendercapture.pro b/tests/auto/render/qrendercapture/qrendercapture.pro new file mode 100644 index 000000000..999f95a58 --- /dev/null +++ b/tests/auto/render/qrendercapture/qrendercapture.pro @@ -0,0 +1,11 @@ +TEMPLATE = app + +TARGET = tst_qrendercapture + +QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib + +CONFIG += testcase + +SOURCES += tst_qrendercapture.cpp + +include(../commons/commons.pri) diff --git a/tests/auto/render/qrendercapture/tst_qrendercapture.cpp b/tests/auto/render/qrendercapture/tst_qrendercapture.cpp new file mode 100644 index 000000000..ef1e9f53c --- /dev/null +++ b/tests/auto/render/qrendercapture/tst_qrendercapture.cpp @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** 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: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 +#include +#include +#include +#include +#include + +#include "testpostmanarbiter.h" + +class MyRenderCapture : public Qt3DRender::QRenderCapture +{ + Q_OBJECT +public: + MyRenderCapture(Qt3DCore::QNode *parent = nullptr) + : Qt3DRender::QRenderCapture(parent) + {} + + void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_FINAL + { + Qt3DRender::QRenderCapture::sceneChangeEvent(change); + } + +private: + friend class tst_QRenderCapture; +}; + +class tst_QRenderCapture : public Qt3DCore::QNode +{ + Q_OBJECT + +private Q_SLOTS: + + void checkCaptureRequest() + { + // GIVEN + TestArbiter arbiter; + QScopedPointer renderCapture(new Qt3DRender::QRenderCapture()); + arbiter.setArbiterOnNode(renderCapture.data()); + + // WHEN + QScopedPointer reply(renderCapture->requestCapture(12)); + + // THEN + QCOMPARE(arbiter.events.size(), 1); + Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast(); + QCOMPARE(change->propertyName(), "renderCaptureRequest"); + QCOMPARE(change->subjectId(),renderCapture->id()); + QCOMPARE(change->type(), Qt3DCore::PropertyUpdated); + QCOMPARE(change->value().toInt(), 12); + + arbiter.events.clear(); + } + + void checkRenderCaptureReply() + { + // GIVEN + QScopedPointer renderCapture(new MyRenderCapture()); + QScopedPointer reply(renderCapture->requestCapture(52)); + QImage img = QImage(20, 20, QImage::Format_ARGB32); + + // WHEN + Qt3DRender::RenderCaptureDataPtr data = Qt3DRender::RenderCaptureDataPtr::create(); + data.data()->captureId = 52; + data.data()->image = img; + + auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(renderCapture->id()); + e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); + e->setPropertyName("renderCaptureData"); + e->setValue(QVariant::fromValue(data)); + + renderCapture->sceneChangeEvent(e); + + // THEN + QCOMPARE(reply->isComplete(), true); + QCOMPARE(reply->captureId(), 52); + QCOMPARE(reply->image().width(), 20); + QCOMPARE(reply->image().height(), 20); + QCOMPARE(reply->image().format(), QImage::Format_ARGB32); + } +}; + +QTEST_MAIN(tst_QRenderCapture) + +#include "tst_qrendercapture.moc" diff --git a/tests/auto/render/render.pro b/tests/auto/render/render.pro index 36eda8afb..95cf94d2f 100644 --- a/tests/auto/render/render.pro +++ b/tests/auto/render/render.pro @@ -57,5 +57,6 @@ qtConfig(private_tests) { qsceneloader \ qrendertargetoutput \ qcameralens \ - qcomputecommand + qcomputecommand \ + qrendercapture } -- cgit v1.2.3 From fef5803681ae48d8e9719b5d6d2728472ec3b56d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Mon, 15 Aug 2016 13:53:56 +0300 Subject: Add new multiplewindows-qml manual test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the new test, which renders to multiple windows simultaniously. Can be used to test that the resume/suspend of render thread works, among other things. Change-Id: I9ace3e833a701674d6021498fca6d8e837e94adf Reviewed-by: Tomi Korpipää Reviewed-by: Paul Lemire --- tests/manual/manual.pro | 3 +- tests/manual/multiplewindows-qml/Scene.qml | 152 +++++++++++++++++++++ tests/manual/multiplewindows-qml/main.cpp | 68 +++++++++ tests/manual/multiplewindows-qml/main.qml | 77 +++++++++++ .../multiplewindows-qml/multiplewindows-qml.pro | 16 +++ tests/manual/multiplewindows-qml/qml.qrc | 6 + 6 files changed, 321 insertions(+), 1 deletion(-) create mode 100644 tests/manual/multiplewindows-qml/Scene.qml create mode 100644 tests/manual/multiplewindows-qml/main.cpp create mode 100644 tests/manual/multiplewindows-qml/main.qml create mode 100644 tests/manual/multiplewindows-qml/multiplewindows-qml.pro create mode 100644 tests/manual/multiplewindows-qml/qml.qrc diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro index 534f0e21f..13c5bf5be 100644 --- a/tests/manual/manual.pro +++ b/tests/manual/manual.pro @@ -28,6 +28,7 @@ SUBDIRS += \ tessellation-modes \ transforms-qml \ transparency-qml \ - transparency-qml-scene3d + transparency-qml-scene3d \ + multiplewindows-qml qtHaveModule(widgets): SUBDIRS += assimp-cpp diff --git a/tests/manual/multiplewindows-qml/Scene.qml b/tests/manual/multiplewindows-qml/Scene.qml new file mode 100644 index 000000000..06107667d --- /dev/null +++ b/tests/manual/multiplewindows-qml/Scene.qml @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.2 as QQ2 +import Qt3D.Core 2.0 +import Qt3D.Render 2.0 +import Qt3D.Input 2.0 +import Qt3D.Extras 2.0 + +Entity { + id: sceneRoot + + property alias view1: renderer.window + property alias view2: renderer2.window + + Camera { + id: camera + projectionType: CameraLens.PerspectiveProjection + fieldOfView: 45 + aspectRatio: 16/9 + nearPlane : 0.1 + farPlane : 1000.0 + position: Qt.vector3d( 0.0, 0.0, -40.0 ) + upVector: Qt.vector3d( 0.0, 1.0, 0.0 ) + viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) + } + + OrbitCameraController { + camera: camera + } + + components: [ + RenderSettings { + activeFrameGraph: TechniqueFilter { + ForwardRenderer { + id: renderer + clearColor: Qt.rgba(0, 0.5, 1, 1) + camera: camera + } + ForwardRenderer { + id: renderer2 + clearColor: Qt.rgba(0, 0.5, 1, 1) + camera: camera + } + } + }, + // Event Source will be set by the Qt3DQuickWindow + InputSettings { } + ] + + PhongMaterial { + id: material + } + + TorusMesh { + id: torusMesh + radius: 5 + minorRadius: 1 + rings: 100 + slices: 20 + } + + Transform { + id: torusTransform + scale3D: Qt.vector3d(1.5, 1, 0.5) + rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45) + } + + Entity { + id: torusEntity + components: [ torusMesh, material, torusTransform ] + } + + SphereMesh { + id: sphereMesh + radius: 3 + } + + Transform { + id: sphereTransform + property real userAngle: 0.0 + matrix: { + var m = Qt.matrix4x4(); + m.rotate(userAngle, Qt.vector3d(0, 1, 0)); + m.translate(Qt.vector3d(20, 0, 0)); + return m; + } + } + + QQ2.NumberAnimation { + target: sphereTransform + property: "userAngle" + duration: 10000 + from: 0 + to: 360 + + loops: QQ2.Animation.Infinite + running: true + } + + Entity { + id: sphereEntity + components: [ sphereMesh, material, sphereTransform ] + } +} diff --git a/tests/manual/multiplewindows-qml/main.cpp b/tests/manual/multiplewindows-qml/main.cpp new file mode 100644 index 000000000..3b9480828 --- /dev/null +++ b/tests/manual/multiplewindows-qml/main.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** 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:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + Qt3DExtras::Quick::Qt3DQuickWindow view; + view.setWidth(600); + view.setHeight(600); + view.engine()->qmlEngine()->rootContext()->setContextProperty("_view", &view); + view.setSource(QUrl(QStringLiteral("qrc:/main.qml"))); + view.show(); + + return app.exec(); +} diff --git a/tests/manual/multiplewindows-qml/main.qml b/tests/manual/multiplewindows-qml/main.qml new file mode 100644 index 000000000..4c6c4b740 --- /dev/null +++ b/tests/manual/multiplewindows-qml/main.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** 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:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import QtQuick.Window 2.2 as QQW + +import Qt3D.Core 2.0 +import Qt3D.Render 2.0 +import Qt3D.Input 2.0 +import Qt3D.Extras 2.0 +import QtQuick.Scene3D 2.0 + +Entity { + id: rootItem + + QQW.Window { + id: window2 + title: "window2" + visible: true + width: 600 + height: 600 + } + + Scene { + id: scene + view1: _view + view2: window2 + Component.onCompleted: scene.view1 = _view + } +} diff --git a/tests/manual/multiplewindows-qml/multiplewindows-qml.pro b/tests/manual/multiplewindows-qml/multiplewindows-qml.pro new file mode 100644 index 000000000..1b899fc8f --- /dev/null +++ b/tests/manual/multiplewindows-qml/multiplewindows-qml.pro @@ -0,0 +1,16 @@ +!include( ../manual.pri ) { + error( "Couldn't find the manual.pri file!" ) +} + +TEMPLATE = app + +QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras + +CONFIG += c++11 + +SOURCES += main.cpp + +RESOURCES += qml.qrc + +DISTFILES += \ + Scene.qml diff --git a/tests/manual/multiplewindows-qml/qml.qrc b/tests/manual/multiplewindows-qml/qml.qrc new file mode 100644 index 000000000..72868031a --- /dev/null +++ b/tests/manual/multiplewindows-qml/qml.qrc @@ -0,0 +1,6 @@ + + + main.qml + Scene.qml + + -- cgit v1.2.3 From 2f4639a95902a51f99f40513dcaa91c836be315d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Wed, 24 Aug 2016 09:25:05 +0300 Subject: Use full type in the return value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use full type in return value of requestRenderCapture so that QML can see it. Change-Id: I7ba123b64da8b4492d0b3267f8920cb882bfe7c0 Reviewed-by: Tomi Korpipää Reviewed-by: Paul Lemire --- src/render/framegraph/qrendercapture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/framegraph/qrendercapture.h b/src/render/framegraph/qrendercapture.h index 810cedb99..f3be273f3 100644 --- a/src/render/framegraph/qrendercapture.h +++ b/src/render/framegraph/qrendercapture.h @@ -79,7 +79,7 @@ class QT3DRENDERSHARED_EXPORT QRenderCapture : public QFrameGraphNode public: explicit QRenderCapture(Qt3DCore::QNode *parent = nullptr); - Q_INVOKABLE QRenderCaptureReply *requestCapture(int captureId); + Q_INVOKABLE Qt3DRender::QRenderCaptureReply *requestCapture(int captureId); protected: void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE; -- cgit v1.2.3 From 320bdb45cf3a76e4a7c2b2ac79481e65280bb27a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Wed, 31 Aug 2016 09:10:46 +0300 Subject: Add fbx to supported file formats list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The assimp loader should support fbx files, so add it to the supported file formats list Task-number: QTBUG-55327 Change-Id: Ie7bb58e4fc216db7db7f35337a7780e6edf550e8 Reviewed-by: Paul Lemire Reviewed-by: Tomi Korpipää --- src/plugins/sceneparsers/assimp/assimpio.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/sceneparsers/assimp/assimpio.cpp b/src/plugins/sceneparsers/assimp/assimpio.cpp index fe170f25c..b2638563f 100644 --- a/src/plugins/sceneparsers/assimp/assimpio.cpp +++ b/src/plugins/sceneparsers/assimp/assimpio.cpp @@ -301,6 +301,7 @@ QStringList AssimpIO::assimpSupportedFormats() formats.append(QStringLiteral("vta")); formats.append(QStringLiteral("x")); formats.append(QStringLiteral("xml")); + formats.append(QStringLiteral("fbx")); return formats; } -- cgit v1.2.3 From 5688464a384a6cb1b233bc53a3fa604ae9143dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Wed, 31 Aug 2016 10:19:41 +0300 Subject: MSVC2015_64 "internal compiler error" fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8b67b6932eca7ada6ac44521b8a1a526eb0553e5 Reviewed-by: Paul Lemire Reviewed-by: Antti Määttä --- src/quick3d/quick3drender/items/quick3dbuffer.cpp | 5 +++-- src/quick3d/quick3drender/items/quick3dparameter.cpp | 4 ++-- src/quick3d/quick3drender/items/quick3dshaderdata.cpp | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/quick3d/quick3drender/items/quick3dbuffer.cpp b/src/quick3d/quick3drender/items/quick3dbuffer.cpp index 68ac21577..5701adf07 100644 --- a/src/quick3d/quick3drender/items/quick3dbuffer.cpp +++ b/src/quick3d/quick3drender/items/quick3dbuffer.cpp @@ -37,9 +37,10 @@ ** ****************************************************************************/ -#include "quick3dbuffer_p.h" -#include #include +#include + +#include "quick3dbuffer_p.h" #include #include #include diff --git a/src/quick3d/quick3drender/items/quick3dparameter.cpp b/src/quick3d/quick3drender/items/quick3dparameter.cpp index 22b6bba96..783f152c1 100644 --- a/src/quick3d/quick3drender/items/quick3dparameter.cpp +++ b/src/quick3d/quick3drender/items/quick3dparameter.cpp @@ -37,11 +37,11 @@ ** ****************************************************************************/ -#include "quick3dparameter_p_p.h" - #include #include +#include "quick3dparameter_p_p.h" + QT_BEGIN_NAMESPACE namespace Qt3DRender { diff --git a/src/quick3d/quick3drender/items/quick3dshaderdata.cpp b/src/quick3d/quick3drender/items/quick3dshaderdata.cpp index e5901e8fb..dbf351695 100644 --- a/src/quick3d/quick3drender/items/quick3dshaderdata.cpp +++ b/src/quick3d/quick3drender/items/quick3dshaderdata.cpp @@ -37,12 +37,12 @@ ** ****************************************************************************/ -#include "quick3dshaderdata_p.h" -#include - #include #include +#include "quick3dshaderdata_p.h" +#include + QT_BEGIN_NAMESPACE namespace Qt3DRender { -- cgit v1.2.3 From ce1db34bf273c397bb7b4be182f274547c35ea3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Wed, 31 Aug 2016 11:56:30 +0300 Subject: Reset bound fbo at the end of the rendering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The last bound fbo must be reset at the end of the rendering if the bound fbo was changed due to render-to-texture. Otherwise offscreen rendering(in scene3d case) might have wrong bound fbo. Also in threaded mode, if the last renderview was rtt, the current fbo remains bound, and the next frame doesn't render to the surface as expected. Change-Id: I842040766aa6010740b008a36f7f9f2c935b0561 Reviewed-by: Tomi Korpipää Reviewed-by: Paul Lemire --- src/render/backend/renderer.cpp | 6 ++++++ src/render/graphicshelpers/graphicscontext.cpp | 5 +++++ src/render/graphicshelpers/graphicscontext_p.h | 1 + 3 files changed, 12 insertions(+) diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp index c91eff86e..49f2f4434 100644 --- a/src/render/backend/renderer.cpp +++ b/src/render/backend/renderer.cpp @@ -908,6 +908,12 @@ Renderer::ViewSubmissionResultData Renderer::submitRenderViews(const QVectoractiveFBO() when the last FrameGraph leaf node/renderView + // contains RenderTargetSelector/RenderTarget + if (lastBoundFBOId != m_graphicsContext->activeFBO()) + m_graphicsContext->bindFramebuffer(lastBoundFBOId); + // Reset state and call doneCurrent if the surface // is valid and was actually activated if (surface && m_graphicsContext->hasValidGLHelper()) { diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp index 2fc36c306..3a67db729 100644 --- a/src/render/graphicshelpers/graphicscontext.cpp +++ b/src/render/graphicshelpers/graphicscontext.cpp @@ -843,6 +843,11 @@ void GraphicsContext::alphaTest(GLenum mode1, GLenum mode2) m_glHelper->alphaTest(mode1, mode2); } +void GraphicsContext::bindFramebuffer(GLuint fbo) +{ + m_glHelper->bindFrameBufferObject(fbo); +} + void GraphicsContext::depthTest(GLenum mode) { m_glHelper->depthTest(mode); diff --git a/src/render/graphicshelpers/graphicscontext_p.h b/src/render/graphicshelpers/graphicscontext_p.h index 1aa4c3e5a..cc63a03b6 100644 --- a/src/render/graphicshelpers/graphicscontext_p.h +++ b/src/render/graphicshelpers/graphicscontext_p.h @@ -180,6 +180,7 @@ public: // Wrapper methods void alphaTest(GLenum mode1, GLenum mode2); + void bindFramebuffer(GLuint fbo); void bindBufferBase(GLenum target, GLuint bindingIndex, GLuint buffer); void bindFragOutputs(GLuint shader, const QHash &outputs); void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -- cgit v1.2.3 From 78e8f5ac9ace0701682723551cd2a70f47967168 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 1 Sep 2016 12:50:40 +0300 Subject: Update mesh and geometry documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Meshes and geometries that were moved to Qt3DExtras were still part of Qt3DRender according to the documentation. Also added some missing documentation and a few clarifications. Change-Id: I62216d718758b9f6b82df2ccc060b3c1e91b9ad4 Reviewed-by: Paul Lemire Reviewed-by: Antti Määttä --- src/extras/geometries/qconegeometry.cpp | 200 +++++++++++++++++++++------- src/extras/geometries/qconemesh.cpp | 93 +++++++++++++ src/extras/geometries/qcuboidgeometry.cpp | 48 +++++-- src/extras/geometries/qcuboidmesh.cpp | 58 ++++---- src/extras/geometries/qcylindergeometry.cpp | 27 ++-- src/extras/geometries/qcylindermesh.cpp | 12 +- src/extras/geometries/qplanegeometry.cpp | 27 ++-- src/extras/geometries/qplanemesh.cpp | 16 ++- src/extras/geometries/qspheregeometry.cpp | 31 +++-- src/extras/geometries/qspheremesh.cpp | 16 ++- src/extras/geometries/qtorusgeometry.cpp | 27 ++-- src/extras/geometries/qtorusmesh.cpp | 16 +-- 12 files changed, 422 insertions(+), 149 deletions(-) diff --git a/src/extras/geometries/qconegeometry.cpp b/src/extras/geometries/qconegeometry.cpp index ef7cd20bb..6e6cceda3 100644 --- a/src/extras/geometries/qconegeometry.cpp +++ b/src/extras/geometries/qconegeometry.cpp @@ -38,18 +38,16 @@ ****************************************************************************/ /*! - * \class QConeGeometry + * \class Qt3DExtras::QConeGeometry + * \inmodule Qt3DExtras * \brief The QConeGeometry class allows creation of a cone in 3D space. * \since 5.7 * \ingroup geometries + * \inherits Qt3DRender::QGeometry * - * The Cone is a common sight in 3D software shape libraries. - * - * The QConeGeometry class is most commonly used as part of the QConeMesh - * but can also be used in custom QGeometryRenderer subclasses. The class - * allows for creation of both the cone and truncated cone. - * - * \sa Qt3DExtras::QCylinderGeometry, Qt3DExtras::QConeMesh, Qt3DExtras::QGeometryRenderer + * The QConeGeometry class is most commonly used internally by the QConeMesh + * but can also be used in custom Qt3DRender::QGeometryRenderer subclasses. The class + * allows for creation of both a cone and a truncated cone. */ #ifndef _USE_MATH_DEFINES @@ -417,6 +415,83 @@ void QConeGeometryPrivate::init() q->addAttribute(m_indexAttribute); } +/*! + * \qmltype ConeGeometry + * \instantiates Qt3DExtras::QConeGeometry + * \inqmlmodule Qt3D.Extras + * \brief ConeGeometry allows creation of a cone in 3D space. + * + * The ConeGeometry type is most commonly used internally by the ConeMesh type + * but can also be used in custom GeometryRenderer types. + * The ConeGeometry type allows for creation of both a cone and a truncated cone. + */ + +/*! + * \qmlproperty bool ConeGeometry::hasTopEndcap + * + * Determines if the cone top is capped or open. + */ + +/*! + * \qmlproperty bool ConeGeometry::hasBottomEndcap + * + * Determines if the cone bottom is capped or open. + */ + +/*! + * \qmlproperty int ConeGeometry::rings + * + * Holds the number of rings in the geometry. + */ + +/*! + * \qmlproperty int ConeGeometry::slices + * + * Holds the number of slices in the geometry. + */ + +/*! + * \qmlproperty real ConeGeometry::topRadius + * + * Holds the top radius of the cone. + */ + +/*! + * \qmlproperty real ConeGeometry::bottomRadius + * + * Holds the bottom radius of the cone. + */ + +/*! + * \qmlproperty real ConeGeometry::length + * + * Holds the length of the cone. + */ + +/*! + * \qmlproperty Attribute ConeGeometry::positionAttribute + * + * Holds the geometry position attribute. + */ + +/*! + * \qmlproperty Attribute ConeGeometry::normalAttribute + * + * Holds the geometry normal attribute. + */ + +/*! + * \qmlproperty Attribute ConeGeometry::texCoordAttribute + * + * Holds the geometry texture coordinate attribute. + */ + +/*! + * \qmlproperty Attribute ConeGeometry::indexAttribute + * + * Holds the geometry index attribute. + */ + QConeGeometry::QConeGeometry(QNode *parent) : QGeometry(*new QConeGeometryPrivate, parent) { @@ -437,6 +512,9 @@ QConeGeometry::~QConeGeometry() { } +/*! + * Updates vertices based on geometry properties. + */ void QConeGeometry::updateVertices() { Q_D(QConeGeometry); @@ -448,6 +526,9 @@ void QConeGeometry::updateVertices() d->m_topRadius, d->m_bottomRadius, d->m_length)); } +/*! + * Updates indices based on geometry properties. + */ void QConeGeometry::updateIndices() { Q_D(QConeGeometry); @@ -462,8 +543,70 @@ void QConeGeometry::updateIndices() } /*! - * Sets whether the cone has a sealed top to \a hasTopEndcap. + * \property QConeGeometry::hasTopEndcap + * + * Determines if the cone top is capped or open. + */ +/*! + * \property QConeGeometry::hasBottomEndcap + * + * Determines if the cone bottom is capped or open. */ + +/*! + * \property QConeGeometry::rings + * + * Holds the number of rings in the geometry. + */ + +/*! + * \property QConeGeometry::slices + * + * Holds the number of slices in the geometry. + */ + +/*! + * \property QConeGeometry::topRadius + * + * Holds the top radius of the cone. + */ + +/*! + * \property QConeGeometry::bottomRadius + * + * Holds the bottom radius of the cone. + */ + +/*! + * \property QConeGeometry::length + * + * Holds the length of the cone. + */ + +/*! + * \property QConeGeometry::positionAttribute + * + * Holds the geometry position attribute. + */ + +/*! + * \property QConeGeometry::normalAttribute + * + * Holds the geometry normal attribute. + */ + +/*! + * \property QConeGeometry::texCoordAttribute + * + * Holds the geometry texture coordinate attribute. + */ + +/*! + * \property QConeGeometry::indexAttribute + * + * Holds the geometry index attribute. + */ + void QConeGeometry::setHasTopEndcap(bool hasTopEndcap) { Q_D(QConeGeometry); @@ -474,9 +617,6 @@ void QConeGeometry::setHasTopEndcap(bool hasTopEndcap) } } -/*! - * Sets whether the cone has a sealed bottom to \a hasBottomEndcap. - */ void QConeGeometry::setHasBottomEndcap(bool hasBottomEndcap) { Q_D(QConeGeometry); @@ -487,9 +627,6 @@ void QConeGeometry::setHasBottomEndcap(bool hasBottomEndcap) } } -/*! - * Sets the number of rings used in the cone's construction tp \a rings. - */ void QConeGeometry::setRings(int rings) { Q_D(QConeGeometry); @@ -501,9 +638,6 @@ void QConeGeometry::setRings(int rings) } } -/*! - * Sets the number of slices used in the cone's construction to \a slices. - */ void QConeGeometry::setSlices(int slices) { Q_D(QConeGeometry); @@ -515,9 +649,6 @@ void QConeGeometry::setSlices(int slices) } } -/*! - * Sets the radius for the top of the cone tp \a topRadius. - */ void QConeGeometry::setTopRadius(float topRadius) { Q_D(QConeGeometry); @@ -528,9 +659,6 @@ void QConeGeometry::setTopRadius(float topRadius) } } -/*! - * Sets the radius for the bottom of the cone to \a bottomRadius. - */ void QConeGeometry::setBottomRadius(float bottomRadius) { Q_D(QConeGeometry); @@ -541,9 +669,6 @@ void QConeGeometry::setBottomRadius(float bottomRadius) } } -/*! - * Sets the cone's length to \a length. - */ void QConeGeometry::setLength(float length) { Q_D(QConeGeometry); @@ -555,63 +680,42 @@ void QConeGeometry::setLength(float length) } } -/*! - * \return whether the cone has a top endcap. - */ bool QConeGeometry::hasTopEndcap() const { Q_D(const QConeGeometry); return d->m_hasTopEndcap; } -/*! - * \return whether the cone has a bottom endcap. - */ bool QConeGeometry::hasBottomEndcap() const { Q_D(const QConeGeometry); return d->m_hasBottomEndcap; } -/*! - * \return the top radius of the cone. - */ float QConeGeometry::topRadius() const { Q_D(const QConeGeometry); return d->m_topRadius; } -/*! - * \return the bottom radius of the cone. - */ float QConeGeometry::bottomRadius() const { Q_D(const QConeGeometry); return d->m_bottomRadius; } -/*! - * \return the number of rings used in the construction of the cone. - */ int QConeGeometry::rings() const { Q_D(const QConeGeometry); return d->m_rings; } -/*! - * \return the number of slices used in the construction of the cone. - */ int QConeGeometry::slices() const { Q_D(const QConeGeometry); return d->m_slices; } -/*! - * \return the cone's length. - */ float QConeGeometry::length() const { Q_D(const QConeGeometry); diff --git a/src/extras/geometries/qconemesh.cpp b/src/extras/geometries/qconemesh.cpp index e2f43b16d..385c469e0 100644 --- a/src/extras/geometries/qconemesh.cpp +++ b/src/extras/geometries/qconemesh.cpp @@ -53,6 +53,64 @@ QT_BEGIN_NAMESPACE namespace Qt3DExtras { +/*! + * \qmltype ConeMesh + * \instantiates Qt3DExtras::QConeMesh + * \inqmlmodule Qt3D.Extras + * \brief A conical mesh. + */ + +/*! + * \qmlproperty int ConeMesh::rings + * + * Holds the number of rings in the mesh. + */ + +/*! + * \qmlproperty int ConeMesh::slices + * + * Holds the number of slices in the mesh. + */ + +/*! + * \qmlproperty bool ConeMesh::hasTopEndcap + * + * Determines if the cone top is capped or open. + */ + +/*! + * \qmlproperty bool ConeMesh::hasBottomEndcap + * + * Determines if the cone bottom is capped or open. + */ + +/*! + * \qmlproperty real ConeMesh::topRadius + * + * Holds the top radius of the cone. + */ + +/*! + * \qmlproperty real ConeMesh::bottomRadius + * + * Holds the bottom radius of the cone. + */ + +/*! + * \qmlproperty real ConeMesh::length + * + * Holds the length of the cone. + */ + +/*! + * \class Qt3DExtras::QConeMesh + * \inmodule Qt3DExtras + * + * \inherits Qt3DRender::QGeometryRenderer + * + * \brief A conical mesh. + */ + QConeMesh::QConeMesh(QNode *parent) : QGeometryRenderer(parent) { @@ -108,36 +166,71 @@ void QConeMesh::setLength(float length) static_cast(geometry())->setLength(length); } +/*! + * \property QConeMesh::hasTopEndcap + * + * Determines if the cone top is capped or open. + */ bool QConeMesh::hasTopEndcap() const { return static_cast(geometry())->hasTopEndcap(); } +/*! + * \property QConeMesh::hasBottomEndcap + * + * Determines if the cone bottom is capped or open. + */ bool QConeMesh::hasBottomEndcap() const { return static_cast(geometry())->hasBottomEndcap(); } +/*! + * \property QConeMesh::topRadius + * + * Holds the top radius of the cone. + */ float QConeMesh::topRadius() const { return static_cast(geometry())->topRadius(); } +/*! + * \property QConeMesh::bottomRadius + * + * Holds the bottom radius of the cone. + */ float QConeMesh::bottomRadius() const { return static_cast(geometry())->bottomRadius(); } +/*! + * \property QConeMesh::rings + * + * Holds the number of rings in the mesh. + */ int QConeMesh::rings() const { return static_cast(geometry())->rings(); } +/*! + * \property QConeMesh::slices + * + * Holds the number of slices in the mesh. + */ int QConeMesh::slices() const { return static_cast(geometry())->slices(); } +/*! + * \property QConeMesh::length + * + * Holds the length of the cone. + */ float QConeMesh::length() const { return static_cast(geometry())->length(); diff --git a/src/extras/geometries/qcuboidgeometry.cpp b/src/extras/geometries/qcuboidgeometry.cpp index bdee61fde..f720f1367 100644 --- a/src/extras/geometries/qcuboidgeometry.cpp +++ b/src/extras/geometries/qcuboidgeometry.cpp @@ -563,44 +563,54 @@ void QCuboidGeometryPrivate::init() /*! * \qmltype CuboidGeometry - * \instantiates Qt3DRender::QCuboidGeometry - * \inqmlmodule Qt3D.Render + * \instantiates Qt3DExtras::QCuboidGeometry + * \inqmlmodule Qt3D.Extras + * \brief CuboidGeometry allows creation of a cuboid in 3D space. + * + * The CuboidGeometry type is most commonly used internally by the CuboidMesh type + * but can also be used in custom GeometryRenderer types. */ /*! - * \qmlproperty float CuboidGeometry::xExtent + * \qmlproperty real CuboidGeometry::xExtent * - * Holds the x extent. + * Holds the x extent of the geometry. */ /*! - * \qmlproperty float CuboidGeometry::yExtent + * \qmlproperty real CuboidGeometry::yExtent * - * Holds the y extent. + * Holds the y extent of the geometry. */ /*! - * \qmlproperty float CuboidGeometry::zExtent + * \qmlproperty real CuboidGeometry::zExtent * - * Holds the z extent. + * Holds the z extent of the geometry. */ /*! * \qmlproperty size CuboidGeometry::yzMeshResolution * * Holds the y-z resolution. + * The width and height values of this property specify the number of vertices generated for + * the y-z faces of the mesh. */ /*! * \qmlproperty size CuboidGeometry::xzMeshResolution * * Holds the x-z resolution. + * The width and height values of this property specify the number of vertices generated for + * the x-z faces of the mesh. */ /*! * \qmlproperty size CuboidGeometry::xyMeshResolution * * Holds the x-y resolution. + * The width and height values of this property specify the number of vertices generated for + * the x-y faces of the mesh. */ /*! @@ -634,11 +644,15 @@ void QCuboidGeometryPrivate::init() */ /*! - * \class Qt3DRender::QCuboidGeometry - * \inmodule Qt3DRender - * + * \class Qt3DExtras::QCuboidGeometry + * \inmodule Qt3DExtras + * \brief The QCuboidGeometry class allows creation of a cuboid in 3D space. + * \since 5.7 + * \ingroup geometries * \inherits Qt3DRender::QGeometry * + * The QCuboidGeometry class is most commonly used internally by the QCuboidMesh + * but can also be used in custom Qt3DRender::QGeometryRenderer subclasses. */ /*! @@ -770,7 +784,7 @@ void QCuboidGeometry::setXYMeshResolution(const QSize &resolution) /*! * \property QCuboidGeometry::xExtent * - * Holds the x extent. + * Holds the x extent of the geometry. */ float QCuboidGeometry::xExtent() const { @@ -781,7 +795,7 @@ float QCuboidGeometry::xExtent() const /*! * \property QCuboidGeometry::yExtent * - * Holds the y extent. + * Holds the y extent of the geometry. */ float QCuboidGeometry::yExtent() const { @@ -792,7 +806,7 @@ float QCuboidGeometry::yExtent() const /*! * \property QCuboidGeometry::zExtent * - * Holds the z extent. + * Holds the z extent of the geometry. */ float QCuboidGeometry::zExtent() const { @@ -804,6 +818,8 @@ float QCuboidGeometry::zExtent() const * \property QCuboidGeometry::yzMeshResolution * * Holds the y-z resolution. + * The width and height values of this property specify the number of vertices generated for + * the y-z faces of the mesh. */ QSize QCuboidGeometry::yzMeshResolution() const { @@ -815,6 +831,8 @@ QSize QCuboidGeometry::yzMeshResolution() const * \property QCuboidGeometry::xzMeshResolution * * Holds the x-z resolution. + * The width and height values of this property specify the number of vertices generated for + * the x-z faces of the mesh. */ QSize QCuboidGeometry::xyMeshResolution() const { @@ -826,6 +844,8 @@ QSize QCuboidGeometry::xyMeshResolution() const * \property QCuboidGeometry::xyMeshResolution * * Holds the x-y resolution. + * The width and height values of this property specify the number of vertices generated for + * the x-y faces of the mesh. */ QSize QCuboidGeometry::xzMeshResolution() const { diff --git a/src/extras/geometries/qcuboidmesh.cpp b/src/extras/geometries/qcuboidmesh.cpp index 004fca472..7df77ec63 100644 --- a/src/extras/geometries/qcuboidmesh.cpp +++ b/src/extras/geometries/qcuboidmesh.cpp @@ -45,59 +45,65 @@ QT_BEGIN_NAMESPACE namespace Qt3DExtras { /*! - * \qmltype QCuboidMesh - * \instantiates Qt3DRender::QCuboidMesh - * \inqmlmodule Qt3D.Render - * \brief A cube mesh. + * \qmltype CuboidMesh + * \instantiates Qt3DExtras::QCuboidMesh + * \inqmlmodule Qt3D.Extras + * \brief A cuboid mesh. */ /*! - * \qmlproperty float CuboidMesh::xExtent + * \qmlproperty real CuboidMesh::xExtent * - * Holds the x extent. + * Holds the x extent of the mesh. */ /*! - * \qmlproperty float CuboidMesh::yExtent + * \qmlproperty real CuboidMesh::yExtent * - * Holds the y extent. + * Holds the y extent of the mesh. */ /*! - * \qmlproperty float CuboidMesh::zExtent + * \qmlproperty real CuboidMesh::zExtent * - * Holds the z extent. + * Holds the z extent of the mesh. */ /*! * \qmlproperty size CuboidMesh::yzMeshResolution * - * Holds the y-z resolution. + * Holds the y-z resolution of the mesh. + * The width and height values of this property specify the number of vertices generated for + * the y-z faces of the mesh. */ /*! * \qmlproperty size CuboidMesh::xzMeshResolution * - * Holds the x-z resolution. + * Holds the x-z resolution of the mesh. + * The width and height values of this property specify the number of vertices generated for + * the x-z faces of the mesh. */ /*! * \qmlproperty size CuboidMesh::xyMeshResolution * - * Holds the x-y resolution. + * Holds the x-y resolution of the mesh. + * The width and height values of this property specify the number of vertices generated for + * the x-y faces of the mesh. */ /*! - * \class Qt3DRender::QCuboidMesh - * \inmodule Qt3DRender + * \class Qt3DExtras::QCuboidMesh + * \inmodule Qt3DExtras * * \inherits Qt3DRender::QGeometryRenderer * - * \brief A cube mesh. + * \brief A cuboid mesh. */ /*! - * Constructs a new QCuboidMedh with \a parent. + * Constructs a new QCuboidMesh with \a parent. */ QCuboidMesh::QCuboidMesh(QNode *parent) : QGeometryRenderer(parent) @@ -125,7 +131,7 @@ void QCuboidMesh::setXExtent(float xExtent) /*! * \property QCuboidMesh::xExtent * - * Holds the x extent. + * Holds the x extent of the mesh. */ float QCuboidMesh::xExtent() const { @@ -140,7 +146,7 @@ void QCuboidMesh::setYExtent(float yExtent) /*! * \property QCuboidMesh::yExtent * - * Holds the y extent. + * Holds the y extent of the mesh. */ float QCuboidMesh::yExtent() const { @@ -155,7 +161,7 @@ void QCuboidMesh::setZExtent(float zExtent) /*! * \property QCuboidMesh::zExtent * - * Holds the z extent. + * Holds the z extent of the mesh. */ float QCuboidMesh::zExtent() const { @@ -170,7 +176,9 @@ void QCuboidMesh::setYZMeshResolution(const QSize &resolution) /*! * \property QCuboidMesh::yzMeshResolution * - * Holds the y-z resolution. + * Holds the y-z resolution of the mesh. + * The width and height values of this property specify the number of vertices generated for + * the y-z faces of the mesh. */ QSize QCuboidMesh::yzMeshResolution() const { @@ -185,7 +193,9 @@ void QCuboidMesh::setXZMeshResolution(const QSize &resolution) /*! * \property QCuboidMesh::xzMeshResolution * - * Holds the x-z resolution. + * Holds the x-z resolution of the mesh. + * The width and height values of this property specify the number of vertices generated for + * the x-z faces of the mesh. */ QSize QCuboidMesh::xzMeshResolution() const { @@ -200,7 +210,9 @@ void QCuboidMesh::setXYMeshResolution(const QSize &resolution) /*! * \property QCuboidMesh::xyMeshResolution * - * Holds the x-y resolution. + * Holds the x-y resolution of the mesh. + * The width and height values of this property specify the number of vertices generated for + * the x-y faces of the mesh. */ QSize QCuboidMesh::xyMeshResolution() const { diff --git a/src/extras/geometries/qcylindergeometry.cpp b/src/extras/geometries/qcylindergeometry.cpp index 2cbe1939c..c80b45dfa 100644 --- a/src/extras/geometries/qcylindergeometry.cpp +++ b/src/extras/geometries/qcylindergeometry.cpp @@ -338,8 +338,12 @@ void QCylinderGeometryPrivate::init() /*! * \qmltype CylinderGeometry - * \instantiates Qt3DRender::QCylinderGeometry - * \inqmlmodule Qt3D.Render + * \instantiates Qt3DExtras::QCylinderGeometry + * \inqmlmodule Qt3D.Extras + * \brief CylinderGeometry allows creation of a cylinder in 3D space. + * + * The CylinderGeometry type is most commonly used internally by the CylinderMesh type + * but can also be used in custom GeometryRenderer types. */ /*! @@ -355,13 +359,13 @@ void QCylinderGeometryPrivate::init() */ /*! - * \qmlproperty float CylinderGeometry::radius + * \qmlproperty real CylinderGeometry::radius * * Holds the radius of the cylinder. */ /*! - * \qmlproperty float CylinderGeometry::length + * \qmlproperty real CylinderGeometry::length * * Holds the length of the cylinder. */ @@ -391,10 +395,15 @@ void QCylinderGeometryPrivate::init() */ /*! - * \class Qt3DRender::QCylinderGeometry - * \inmodule Qt3DRender - * + * \class Qt3DExtras::QCylinderGeometry + * \inmodule Qt3DExtras + * \brief The QCylinderGeometry class allows creation of a cylinder in 3D space. + * \since 5.7 + * \ingroup geometries * \inherits Qt3DRender::QGeometry + * + * The QCylinderGeometry class is most commonly used internally by the QCylinderMesh + * but can also be used in custom Qt3DRender::QGeometryRenderer subclasses. */ /*! @@ -425,7 +434,7 @@ QCylinderGeometry::~QCylinderGeometry() } /*! - * Updates the vertices based on rings and slices. + * Updates the vertices based on rings, slices, and length properties. */ void QCylinderGeometry::updateVertices() { @@ -439,7 +448,7 @@ void QCylinderGeometry::updateVertices() } /*! - * Updates the indices based on rings and slices. + * Updates the indices based on rings, slices, and length properties. */ void QCylinderGeometry::updateIndices() { diff --git a/src/extras/geometries/qcylindermesh.cpp b/src/extras/geometries/qcylindermesh.cpp index ef405cb6e..875d8ed9a 100644 --- a/src/extras/geometries/qcylindermesh.cpp +++ b/src/extras/geometries/qcylindermesh.cpp @@ -58,8 +58,8 @@ namespace Qt3DExtras { /*! * \qmltype CylinderMesh - * \instantiates Qt3DRender::QCylinderMesh - * \inqmlmodule Qt3D.Render + * \instantiates Qt3DExtras::QCylinderMesh + * \inqmlmodule Qt3D.Extras * \brief A cylindrical mesh. */ @@ -76,20 +76,20 @@ namespace Qt3DExtras { */ /*! - * \qmlproperty float CylinderMesh::radius + * \qmlproperty real CylinderMesh::radius * * Holds the radius of the cylinder. */ /*! - * \qmlproperty float CylinderMesh::length + * \qmlproperty real CylinderMesh::length * * Holds the length of the cylinder. */ /*! - * \class Qt3DRender::QCylinderMesh - * \inmodule Qt3DRender + * \class Qt3DExtras::QCylinderMesh + * \inmodule Qt3DExtras * * \inherits Qt3DRender::QGeometryRenderer * diff --git a/src/extras/geometries/qplanegeometry.cpp b/src/extras/geometries/qplanegeometry.cpp index 59ed9ee21..b7395b67e 100644 --- a/src/extras/geometries/qplanegeometry.cpp +++ b/src/extras/geometries/qplanegeometry.cpp @@ -208,18 +208,22 @@ public: /*! * \qmltype PlaneGeometry - * \instantiates Qt3DRender::QPlaneGeometry - * \inqmlmodule Qt3D.Render + * \instantiates Qt3DExtras::QPlaneGeometry + * \inqmlmodule Qt3D.Extras + * \brief PlaneGeometry allows creation of a plane in 3D space. + * + * The PlaneGeometry type is most commonly used internally by the PlaneMesh type + * but can also be used in custom GeometryRenderer types. */ /*! - * \qmlproperty float PlaneGeometry::width + * \qmlproperty real PlaneGeometry::width * * Holds the plane width. */ /*! - * \qmlproperty float PlaneGeometry::height + * \qmlproperty real PlaneGeometry::height * * Holds the plane height. */ @@ -261,10 +265,15 @@ public: */ /*! - * \class Qt3DRender::QPlaneGeometry - * \inmodule Qt3DRender - * + * \class Qt3DExtras::QPlaneGeometry + * \inmodule Qt3DExtras + * \brief The QPlaneGeometry class allows creation of a plane in 3D space. + * \since 5.7 + * \ingroup geometries * \inherits Qt3DRender::QGeometry + * + * The QPlaneGeometry class is most commonly used internally by the QPlaneMesh + * but can also be used in custom Qt3DRender::QGeometryRenderer subclasses. */ /*! @@ -295,7 +304,7 @@ QPlaneGeometry::~QPlaneGeometry() } /*! - * Updates vertices based on resolution. + * Updates vertices based on mesh resolution, width, and height properties. */ void QPlaneGeometry::updateVertices() { @@ -310,7 +319,7 @@ void QPlaneGeometry::updateVertices() } /*! - * Updates indices based on resolution. + * Updates indices based on mesh resolution. */ void QPlaneGeometry::updateIndices() { diff --git a/src/extras/geometries/qplanemesh.cpp b/src/extras/geometries/qplanemesh.cpp index f9d1a105b..f14d7cb97 100644 --- a/src/extras/geometries/qplanemesh.cpp +++ b/src/extras/geometries/qplanemesh.cpp @@ -46,19 +46,19 @@ namespace Qt3DExtras { /*! * \qmltype PlaneMesh - * \instantiates Qt3DRender::QPlaneMesh - * \inqmlmodule Qt3D.Render + * \instantiates Qt3DExtras::QPlaneMesh + * \inqmlmodule Qt3D.Extras * \brief A square planar mesh. */ /*! - * \qmlproperty float PlaneMesh::width + * \qmlproperty real PlaneMesh::width * * Holds the plane width. */ /*! - * \qmlproperty float PlaneMesh::height + * \qmlproperty real PlaneMesh::height * * Holds the plane height. */ @@ -67,11 +67,13 @@ namespace Qt3DExtras { * \qmlproperty size PlaneMesh::meshResolution * * Holds the plane resolution. + * The width and height values of this property specify the number of vertices generated for + * the mesh in the respective dimensions. */ /*! - * \class Qt3DRender::QPlaneMesh - * \inmodule Qt3DRender + * \class Qt3DExtras::QPlaneMesh + * \inmodule Qt3DExtras * * \inherits Qt3DRender::QGeometryRenderer * @@ -135,6 +137,8 @@ void QPlaneMesh::setMeshResolution(const QSize &resolution) * \property QPlaneMesh::meshResolution * * Holds the plane resolution. + * The width and height values of this property specify the number of vertices generated for + * the mesh in the respective dimensions. */ QSize QPlaneMesh::meshResolution() const { diff --git a/src/extras/geometries/qspheregeometry.cpp b/src/extras/geometries/qspheregeometry.cpp index 0c582f441..5d64d0f35 100644 --- a/src/extras/geometries/qspheregeometry.cpp +++ b/src/extras/geometries/qspheregeometry.cpp @@ -315,8 +315,12 @@ void QSphereGeometryPrivate::init() /*! * \qmltype SphereGeometry - * \instantiates QSphereGeometry - * \inqmlmodule Qt3D.Render + * \instantiates Qt3DExtras::QSphereGeometry + * \inqmlmodule Qt3D.Extras + * \brief SphereGeometry allows creation of a sphere in 3D space. + * + * The SphereGeometry type is most commonly used internally by the SphereMesh type + * but can also be used in custom GeometryRenderer types. */ /*! @@ -332,7 +336,7 @@ void QSphereGeometryPrivate::init() */ /*! - * \qmlproperty float SphereGeometry::radius + * \qmlproperty real SphereGeometry::radius * * Holds the radius of the sphere. */ @@ -340,7 +344,8 @@ void QSphereGeometryPrivate::init() /*! * \qmlproperty bool SphereGeometry::generateTangents * - * Holds the value of the automatic tangent generation flag. + * Holds the value of the automatic tangent vectors generation flag. + * Tangent vectors are orthogonal to normal vectors. */ /*! @@ -374,10 +379,15 @@ void QSphereGeometryPrivate::init() */ /*! - * \class QSphereGeometry - * \inmodule Qt3DRender + * \class Qt3DExtras::QSphereGeometry + * \inmodule Qt3DExtras + * \brief The QSphereGeometry class allows creation of a sphere in 3D space. + * \since 5.7 + * \ingroup geometries + * \inherits Qt3DRender::QGeometry * - * \inherits QGeometry + * The QSphereGeometry class is most commonly used internally by the QSphereMesh + * but can also be used in custom Qt3DRender::QGeometryRenderer subclasses. */ /*! @@ -408,7 +418,7 @@ QSphereGeometry::~QSphereGeometry() } /*! - * Updates vertices based on rings and slices. + * Updates vertices based on rings, slices, and radius properties */ void QSphereGeometry::updateVertices() { @@ -422,7 +432,7 @@ void QSphereGeometry::updateVertices() } /*! - * Updates indices based on rings and slices. + * Updates indices based on rings and slices properties. */ void QSphereGeometry::updateIndices() { @@ -481,7 +491,8 @@ void QSphereGeometry::setGenerateTangents(bool gen) /*! * \property QSphereGeometry::generateTangents * - * Holds the value of the automatic tangent generation flag. + * Holds the value of the automatic tangent vectors generation flag. + * Tangent vectors are orthogonal to normal vectors. */ bool QSphereGeometry::generateTangents() const { diff --git a/src/extras/geometries/qspheremesh.cpp b/src/extras/geometries/qspheremesh.cpp index 205f6437f..90cf5a872 100644 --- a/src/extras/geometries/qspheremesh.cpp +++ b/src/extras/geometries/qspheremesh.cpp @@ -47,8 +47,8 @@ namespace Qt3DExtras { /*! * \qmltype SphereMesh - * \instantiates Qt3DRender::QSphereMesh - * \inqmlmodule Qt3D.Render + * \instantiates Qt3DExtras::QSphereMesh + * \inqmlmodule Qt3D.Extras * \brief A spherical mesh. */ @@ -65,7 +65,7 @@ namespace Qt3DExtras { */ /*! - * \qmlproperty float SphereMesh::radius + * \qmlproperty real SphereMesh::radius * * Holds the radius of the sphere. */ @@ -73,12 +73,13 @@ namespace Qt3DExtras { /*! * \qmlproperty bool SphereMesh::generateTangents * - * Holds the value of the automatic tangent generation flag. + * Holds the value of the automatic tangent vectors generation flag. + * Tangent vectors are orthogonal to normal vectors. */ /*! - * \class Qt3DRender::QSphereMesh - * \inmodule Qt3DRender + * \class Qt3DExtras::QSphereMesh + * \inmodule Qt3DExtras * * \inherits Qt3DRender::QGeometryRenderer * @@ -127,7 +128,8 @@ void QSphereMesh::setGenerateTangents(bool gen) /*! * \property QSphereMesh::generateTangents * - * Holds the value of the automatic tangent generation flag. + * Holds the value of the automatic tangent vectors generation flag. + * Tangent vectors are orthogonal to normal vectors. */ bool QSphereMesh::generateTangents() const { diff --git a/src/extras/geometries/qtorusgeometry.cpp b/src/extras/geometries/qtorusgeometry.cpp index 5ca8c3ce1..09a69a45a 100644 --- a/src/extras/geometries/qtorusgeometry.cpp +++ b/src/extras/geometries/qtorusgeometry.cpp @@ -264,8 +264,12 @@ void QTorusGeometryPrivate::init() /*! * \qmltype TorusGeometry - * \instantiates Qt3DRender::QTorusGeometry - * \inqmlmodule Qt3D.Render + * \instantiates Qt3DExtras::QTorusGeometry + * \inqmlmodule Qt3D.Extras + * \brief TorusGeometry allows creation of a torus in 3D space. + * + * The TorusGeometry type is most commonly used internally by the TorusMesh type + * but can also be used in custom GeometryRenderer types. */ /*! @@ -281,13 +285,13 @@ void QTorusGeometryPrivate::init() */ /*! - * \qmlproperty float TorusGeometry::radius + * \qmlproperty real TorusGeometry::radius * * Holds the outer radius of the torus. */ /*! - * \qmlproperty float TorusGeometry::minorRadius + * \qmlproperty real TorusGeometry::minorRadius * * Holds the inner radius of the torus. */ @@ -317,10 +321,15 @@ void QTorusGeometryPrivate::init() */ /*! - * \class Qt3DRender::QTorusGeometry - * \inmodule Qt3DRender - * + * \class Qt3DExtras::QTorusGeometry + * \inmodule Qt3DExtras + * \brief The QTorusGeometry class allows creation of a torus in 3D space. + * \since 5.7 + * \ingroup geometries * \inherits Qt3DRender::QGeometry + * + * The QTorusGeometry class is most commonly used internally by the QTorusMesh + * but can also be used in custom Qt3DRender::QGeometryRenderer subclasses. */ /*! @@ -351,7 +360,7 @@ QTorusGeometry::~QTorusGeometry() } /*! - * Updates vertices based on rings and slices. + * Updates vertices based on rings, slices, and radius properties. */ void QTorusGeometry::updateVertices() { @@ -364,7 +373,7 @@ void QTorusGeometry::updateVertices() } /*! - * Updates indices based on rings and slices. + * Updates indices based on rings and slices properties. */ void QTorusGeometry::updateIndices() { diff --git a/src/extras/geometries/qtorusmesh.cpp b/src/extras/geometries/qtorusmesh.cpp index e3b5b61d0..a77631b73 100644 --- a/src/extras/geometries/qtorusmesh.cpp +++ b/src/extras/geometries/qtorusmesh.cpp @@ -51,9 +51,9 @@ namespace Qt3DExtras { /*! * \qmltype TorusMesh - * \instantiates Qt3DRender::QTorusMesh - * \inqmlmodule Qt3D.Render - * \brief A custom mesh. + * \instantiates Qt3DExtras::QTorusMesh + * \inqmlmodule Qt3D.Extras + * \brief A toroidal mesh. */ /*! @@ -69,24 +69,24 @@ namespace Qt3DExtras { */ /*! - * \qmlproperty float TorusMesh::radius + * \qmlproperty real TorusMesh::radius * * Holds the outer radius of the torus. */ /*! - * \qmlproperty float TorusMesh::minorRadius + * \qmlproperty real TorusMesh::minorRadius * * Holds the inner radius of the torus. */ /*! - * \class Qt3DRender::QTorusMesh - * \inmodule Qt3DRender + * \class Qt3DExtras::QTorusMesh + * \inmodule Qt3DExtras * * \inherits Qt3DRender::QGeometryRenderer * - * \brief A custom mesh. + * \brief A toroidal mesh. */ /*! -- cgit v1.2.3 From 3eb9fd4272783967fe1118f5f9d21b5e911db558 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 1 Sep 2016 14:24:17 +0300 Subject: Improve QBlendEquationArguments and QBlendEquation docs a bit Change-Id: Icb736b4cf4e1fcc44f9ad89ef69b678ce3ef36ab Reviewed-by: Paul Lemire --- src/render/renderstates/qblendequation.cpp | 43 +++++++++++++++++++--- .../renderstates/qblendequationarguments.cpp | 38 ++++++++++++++----- 2 files changed, 65 insertions(+), 16 deletions(-) diff --git a/src/render/renderstates/qblendequation.cpp b/src/render/renderstates/qblendequation.cpp index de999a19f..e48e83883 100644 --- a/src/render/renderstates/qblendequation.cpp +++ b/src/render/renderstates/qblendequation.cpp @@ -39,9 +39,10 @@ ****************************************************************************/ /*! - * \class QBlendEquation + * \class Qt3DRender::QBlendEquation * \brief The QBlendEquation class specifies the equation used for both the RGB * blend equation and the Alpha blend equation + * \inmodule Qt3DRender * \since 5.7 * \ingroup renderstates * @@ -49,6 +50,19 @@ * already in the framebuffer. */ +/*! + \qmltype BlendEquation + \instantiates Qt3DRender::QBlendEquation + \inherits RenderState + \inqmlmodule Qt3D.Render + \since 5.5 + \brief The BlendEquation class specifies the equation used for both the RGB + blend equation and the Alpha blend equation + + The blend equation is used to determine how a new pixel is combined with a pixel + already in the framebuffer. +*/ + #include "qblendequation.h" #include "qblendequation_p.h" #include @@ -70,17 +84,34 @@ QBlendEquation::~QBlendEquation() { } +/*! + \enum Qt3DRender::QBlendEquation::BlendFunction + + \value Add GL_FUNC_ADD + \value Subtract GL_FUNC_SUBTRACT + \value ReverseSubtract GL_FUNC_REVERSE_SUBTRACT + \value Min GL_MIN + \value Max GL_MAX +*/ + +/*! + \qmlproperty enumeration BlendEquation::blendFunction + + Holds the blend function, which determines how source and destination colors are combined. + */ + +/*! + \property QBlendEquation::blendFunction + + Holds the blend function, which determines how source and destination colors are combined. + */ + QBlendEquation::BlendFunction QBlendEquation::blendFunction() const { Q_D(const QBlendEquation); return d->m_blendFunction; } -/*! - * Sets the function used to decide how the source and destination colors are combined, - * to \a blendFunction. - * \param blendFunction - */ void QBlendEquation::setBlendFunction(QBlendEquation::BlendFunction blendFunction) { Q_D(QBlendEquation); diff --git a/src/render/renderstates/qblendequationarguments.cpp b/src/render/renderstates/qblendequationarguments.cpp index cbb3ff886..58c048138 100644 --- a/src/render/renderstates/qblendequationarguments.cpp +++ b/src/render/renderstates/qblendequationarguments.cpp @@ -125,12 +125,12 @@ QBlendEquationArguments::QBlendEquationArguments(QBlendEquationArgumentsPrivate */ /*! - \qmlproperty enumeration Qt3D.Render::BlendEquationArguments::sourceRgb + \qmlproperty enumeration BlendEquationArguments::sourceRgb */ /*! - \property Qt3DRender::QBlendEquationArguments::sourceRgb + \property QBlendEquationArguments::sourceRgb */ QBlendEquationArguments::Blending QBlendEquationArguments::sourceRgb() const @@ -152,12 +152,12 @@ void QBlendEquationArguments::setSourceRgb(QBlendEquationArguments::Blending sou } /*! - \qmlproperty enumeration Qt3D.Render::BlendEquationArguments::destinationRgb + \qmlproperty enumeration BlendEquationArguments::destinationRgb */ /*! - \property Qt3DRender::QBlendEquationArguments::destinationRgb + \property QBlendEquationArguments::destinationRgb */ QBlendEquationArguments::Blending QBlendEquationArguments::destinationRgb() const @@ -179,12 +179,12 @@ void QBlendEquationArguments::setDestinationRgb(QBlendEquationArguments::Blendin } /*! - \qmlproperty enumeration Qt3D.Render::BlendEquationArguments::sourceAlpha + \qmlproperty enumeration BlendEquationArguments::sourceAlpha */ /*! - \property Qt3DRender::QBlendEquationArguments::sourceAlpha + \property QBlendEquationArguments::sourceAlpha */ QBlendEquationArguments::Blending QBlendEquationArguments::sourceAlpha() const @@ -206,12 +206,12 @@ void QBlendEquationArguments::setSourceAlpha(QBlendEquationArguments::Blending s } /*! - \qmlproperty enumeration Qt3D.Render::BlendEquationArguments::DestinationAlpha + \qmlproperty enumeration BlendEquationArguments::DestinationAlpha */ /*! - \property Qt3DRender::QBlendEquationArguments::destinationAlpha + \property QBlendEquationArguments::destinationAlpha */ QBlendEquationArguments::Blending QBlendEquationArguments::destinationAlpha() const @@ -232,12 +232,30 @@ void QBlendEquationArguments::setDestinationAlpha(QBlendEquationArguments::Blend } } +/*! + \fn QBlendEquationArguments::sourceRgbaChanged(Blending sourceRgba) + + Notify that both sourceRgb and sourceAlpha properties have changed to \a sourceRgba. +*/ +/*! + \fn QBlendEquationArguments::destinationRgbaChanged(Blending destinationRgba) + + Notify that both destinationRgb and destinationAlpha properties have changed to + \a destinationRgba. +*/ + +/*! + Change both sourceRgb and sourceAlpha properties to \a sourceRgba. +*/ void QBlendEquationArguments::setSourceRgba(Blending sourceRgba) { setSourceRgb(sourceRgba); setSourceAlpha(sourceRgba); } +/*! + Change both destinationRgb and destinationAlpha properties to \a destinationRgba. +*/ void QBlendEquationArguments::setDestinationRgba(Blending destinationRgba) { setDestinationRgb(destinationRgba); @@ -245,14 +263,14 @@ void QBlendEquationArguments::setDestinationRgba(Blending destinationRgba) } /*! - \qmlproperty int Qt3D.Render::BlendEquationArguments::bufferIndex + \qmlproperty int BlendEquationArguments::bufferIndex Specifies the index of the Draw Buffer that this BlendEquationArguments applies to. If negative, this will apply to all Draw Buffers. */ /*! - \property Qt3DRender::QBlendEquationArguments::bufferIndex + \property QBlendEquationArguments::bufferIndex Specifies the index of the Draw Buffer that this BlendEquationArguments applies to. If negative, this will apply to all Draw Buffers. -- cgit v1.2.3 From e2ec9ce9f9e91150cce067f5b3b0e04f9b4d12a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Thu, 1 Sep 2016 11:00:00 +0300 Subject: Update QCamera docs Add missing docs Change-Id: I700e47f8e221034b12a165e9e5f0493d8e9d9960 Reviewed-by: Paul Lemire --- src/render/frontend/qcamera.cpp | 391 +++++++++++++++++++++++++++++++--------- 1 file changed, 310 insertions(+), 81 deletions(-) diff --git a/src/render/frontend/qcamera.cpp b/src/render/frontend/qcamera.cpp index b28d3bbbb..7a1f133a8 100644 --- a/src/render/frontend/qcamera.cpp +++ b/src/render/frontend/qcamera.cpp @@ -77,6 +77,298 @@ QCameraPrivate::QCameraPrivate() * \brief Defines a view point through which the scene will be rendered. */ +/*! + * \enum Qt3DRender::QCamera::CameraTranslationOption + * + * This enum specifies how camera view center is translated + * \value TranslateViewCenter Translate the view center causing the view direction to remain the same + * \value DontTranslateViewCenter Don't translate the view center causing the view direction to change + */ + +/*! + * \qmlmethod quaternion Qt3D.Render::Camera::tiltRotation(real angle) + * + * Returns the calculated tilt rotation in relation to the \a angle in degrees taken in + * to adjust the camera's tilt or up/down rotation on the X axis. + */ + +/*! + * \qmlmethod quaternion Qt3D.Render::Camera::panRotation(real angle) + * + * Returns the calculated pan rotation in relation to the \a angle in degrees taken in + * to adjust the camera's pan or left/right rotation on the Y axis. + */ + +/*! + * \qmlmethod quaternion Qt3D.Render::Camera::rollRotation(real angle) + * + * Returns the calculated roll rotation in relation to the \a angle in degrees taken in + * to adjust the camera's roll or lean left/right rotation on the Z axis. + */ + +/*! + * \qmlmethod quaternion Qt3D.Render::Camera::rotation(real angle, vector3d axis) + * + * Returns the calculated rotation in relation to the \a angle in degrees and + * chosen \a axis taken in. + */ + +/*! + * \qmlmethod void Qt3D.Render::Camera::translate(vector3d vLocal, enumeration option) + * + * Translates the camera's position and its view vector by \a vLocal in local coordinates. + * The \a option allows for toggling whether the view center should be translated. + * \list + * \li Camera.TranslateViewCenter + * \li Camera.DontTranslateViewCenter + * \endlist + * \sa Qt3DRender::QCamera::CameraTranslationOption + */ + +/*! + * \qmlmethod void Qt3D.Render::Camera::translateWorld(vector3d vWorld, enumeration option) + * + * Translates the camera's position and its view vector by \a vWorld in world coordinates. + * The \a option allows for toggling whether the view center should be translated. + * \list + * \li Camera.TranslateViewCenter + * \li Camera.DontTranslateViewCenter + * \endlist + * \sa Qt3DRender::QCamera::CameraTranslationOption + */ + +/*! + * \qmlmethod void Qt3D.Render::Camera::tilt(real angle) + * + * Adjusts the tilt angle of the camera by \a angle in degrees. + */ + +/*! + * \qmlmethod void Qt3D.Render::Camera::pan(real angle) + * + * Adjusts the pan angle of the camera by \a angle in degrees. + */ + +/*! + * \qmlmethod void Qt3D.Render::Camera::pan(real angle, vector3d axis) + * + * Adjusts the camera pan about view center by \a angle in degrees on \a axis. + */ + +/*! + * \qmlmethod void Qt3D.Render::Camera::roll(real angle) + * + * Adjusts the camera roll by \a angle in degrees. + */ + +/*! + * \qmlmethod void Qt3D.Render::Camera::tiltAboutViewCenter(real angle) + * + * Adjusts the camera tilt about view center by \a angle in degrees. + */ + +/*! + * \qmlmethod void Qt3D.Render::Camera::panAboutViewCenter(real angle) + * + * Adjusts the camera pan about view center by \a angle in degrees. + */ + +/*! + * \qmlmethod void Qt3D.Render::Camera::panAboutViewCenter(real angle, vector3d axis) + * + * Adjusts the camera pan about view center by \a angle in degrees on \a axis. + */ + +/*! + * \qmlmethod void Qt3D.Render::Camera::rollAboutViewCenter(real angle) + * + * Adjusts the camera roll about view center by \a angle in degrees. + */ + +/*! + * \qmlmethod void Qt3D.Render::Camera::rotate(quaternion q) + * + * Rotates the camera with the use of a Quaternion in \a q. + */ + +/*! + * \qmlmethod void Qt3D.Render::Camera::rotateAboutViewCenter(quaternion q) + * + * Rotates the camera about the view center with the use of a Quaternion in \a q. + */ + +/*! + * \qmlproperty enumeration Qt3D.Render::Camera::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 Qt3D.Render::Camera::nearPlane + * Holds the current camera near plane of the camera. + */ + +/*! + * \qmlproperty real Qt3D.Render::Camera::farPlane + * Holds the current camera far plane of the camera. + */ + +/*! + * \qmlproperty real Qt3D.Render::Camera::fieldOfView + * Holds the current field of view of the camera in degrees. + */ + +/*! + * \qmlproperty real Qt3D.Render::Camera::aspectRatio + * Holds the current aspect ratio of the camera. + */ + +/*! + *\qmlproperty real Qt3D.Render::Camera::left + * Holds the current left of the camera. + */ + +/*! + * \qmlproperty real Qt3D.Render::Camera::right + * Holds the current right of the camera. + */ + +/*! + * \qmlproperty real Qt3D.Render::Camera::bottom + * Holds the current bottom of the camera. + */ + +/*! + * \qmlproperty real Qt3D.Render::Camera::top + * Holds the current top of the camera. + */ + +/*! + * \qmlproperty matrix4x4 Qt3D.Render::Camera::projectionMatrix + * Holds the current projection matrix of the camera. + */ + + +/*! + * \qmlproperty vector3d Qt3D.Render::Camera::position + * Holds the current position of the camera. + */ + +/*! + * \qmlproperty vector3d Qt3D.Render::Camera::upVector + * Holds the current up vector of the camera. + */ + +/*! + * \qmlproperty vector3d Qt3D.Render::Camera::viewCenter + * Holds the current view center of the camera. + * \readonly + */ + +/*! + * \qmlproperty vector3d Qt3D.Render::Camera::viewVector + * Holds the camera's view vector. + * \readonly + */ + +/*! + * \qmlproperty matrix4x4 Qt3D.Render::Camera::viewMatrix + * Holds the camera's view matrix. + * \readonly + */ + +/*! + * \property QCamera::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 + */ + +/*! + * \property QCamera::nearPlane + * Holds the current camera near plane. + */ + +/*! + * \property QCamera::farPlane + * Holds the current camera far plane. + */ + +/*! + * \property QCamera::fieldOfView + * Holds the current field of view in degrees. + */ + +/*! + * \property QCamera::aspectRatio + * Holds the current aspect ratio. + */ + +/*! + *\property QCamera::left + * Holds the current left of the camera. + */ + +/*! + * \property QCamera::right + * Holds the current right of the camera. + */ + +/*! + * \property QCamera::bottom + * Holds the current bottom of the camera. + */ + +/*! + * \property QCamera::top + * Holds the current top of the camera. + */ + +/*! + * \property QCamera::projectionMatrix + * Holds the current projection matrix of the camera. + */ + +/*! + * \property QCamera::position + * Holds the camera's position. + */ + +/*! + * \property QCamera::upVector + * Holds the camera's up vector. + */ + +/*! + * \property QCamera::viewCenter + * Holds the camera's view center. + */ + +/*! + * \property QCamera::viewVector + * Holds the camera's view vector. + */ + +/*! + * \property QCamera::viewMatrix + * Holds the camera's view matrix. + */ + /*! * Creates a new QCamera instance with the * specified \a parent. @@ -202,8 +494,8 @@ void QCamera::translateWorld(const QVector3D &vWorld, CameraTranslationOption op } /*! - * Returns the calculated tilt rotation in relation to the \a angle taken in to adjust the camera's - * tilt or up/down rotation on the X axis. + * Returns the calculated tilt rotation in relation to the \a angle in degrees taken in + * to adjust the camera's tilt or up/down rotation on the X axis. */ QQuaternion QCamera::tiltRotation(float angle) const { @@ -213,8 +505,8 @@ QQuaternion QCamera::tiltRotation(float angle) const } /*! - * Returns the calculated pan rotation in relation to the \a angle taken in to adjust the camera's - * pan or left/right rotation on the Y axis. + * Returns the calculated pan rotation in relation to the \a angle in degrees taken in + * to adjust the camera's pan or left/right rotation on the Y axis. */ QQuaternion QCamera::panRotation(float angle) const { @@ -222,8 +514,8 @@ QQuaternion QCamera::panRotation(float angle) const } /*! - * Returns the calculated roll rotation in relation to the \a angle taken in to adjust the camera's - * roll or lean left/right rotation on the Z axis. + * Returns the calculated roll rotation in relation to the \a angle in degrees taken in + * to adjust the camera's roll or lean left/right rotation on the Z axis. */ QQuaternion QCamera::rollRotation(float angle) const { @@ -232,7 +524,8 @@ QQuaternion QCamera::rollRotation(float angle) const } /*! - * Returns the calculated rotation in relation to the \a angle and chosen \a axis taken in. + * Returns the calculated rotation in relation to the \a angle in degrees and + * chosen \a axis taken in. */ QQuaternion QCamera::rotation(float angle, const QVector3D &axis) const { @@ -240,7 +533,7 @@ QQuaternion QCamera::rotation(float angle, const QVector3D &axis) const } /*! - * Adjusts the tilt angle of the camera by \a angle. + * Adjusts the tilt angle of the camera by \a angle in degrees. */ void QCamera::tilt(float angle) { @@ -249,7 +542,7 @@ void QCamera::tilt(float angle) } /*! - * Adjusts the pan angle of the camera by \a angle. + * Adjusts the pan angle of the camera by \a angle in degrees. */ void QCamera::pan(float angle) { @@ -258,7 +551,7 @@ void QCamera::pan(float angle) } /*! - * Adjusts the pan angle of the camera by \a angle on a chosen \a axis. + * Adjusts the pan angle of the camera by \a angle in degrees on a chosen \a axis. */ void QCamera::pan(float angle, const QVector3D &axis) { @@ -267,7 +560,7 @@ void QCamera::pan(float angle, const QVector3D &axis) } /*! - * Adjusts the camera roll by \a angle. + * Adjusts the camera roll by \a angle in degrees. */ void QCamera::roll(float angle) { @@ -276,7 +569,7 @@ void QCamera::roll(float angle) } /*! - * Adjusts the camera tilt about view center by \a angle. + * Adjusts the camera tilt about view center by \a angle in degrees. */ void QCamera::tiltAboutViewCenter(float angle) { @@ -285,7 +578,7 @@ void QCamera::tiltAboutViewCenter(float angle) } /*! - * Adjusts the camera pan about view center by \a angle. + * Adjusts the camera pan about view center by \a angle in degrees. */ void QCamera::panAboutViewCenter(float angle) { @@ -294,7 +587,7 @@ void QCamera::panAboutViewCenter(float angle) } /*! - * Adjusts the camera pan about view center by \a angle on \a axis. + * Adjusts the camera pan about view center by \a angle in degrees on \a axis. */ void QCamera::panAboutViewCenter(float angle, const QVector3D &axis) { @@ -303,7 +596,7 @@ void QCamera::panAboutViewCenter(float angle, const QVector3D &axis) } /*! - * Adjusts the camera roll about view center by \a angle. + * Adjusts the camera roll about view center by \a angle in degrees. */ void QCamera::rollAboutViewCenter(float angle) { @@ -344,14 +637,6 @@ void QCamera::setProjectionType(QCameraLens::ProjectionType type) d->m_lens->setProjectionType(type); } -/*! - * \qmlproperty enumeration Qt3DCore::Camera::projectionType - * - * Holds the type of the camera projection (orthogonal or perspective). - * - * \value CameraLens.OrthographicProjection Orthographic projection - * \value CameraLens.PerspectiveProjection Perspective projection - */ QCameraLens::ProjectionType QCamera::projectionType() const { Q_D(const QCamera); @@ -367,10 +652,6 @@ void QCamera::setNearPlane(float nearPlane) d->m_lens->setNearPlane(nearPlane); } -/*! - * \qmlproperty float Qt3DCore::Camera::nearPlane - * The current camera near plane. - */ float QCamera::nearPlane() const { Q_D(const QCamera); @@ -386,10 +667,6 @@ void QCamera::setFarPlane(float farPlane) d->m_lens->setFarPlane(farPlane); } -/*! - * \qmlproperty float Qt3DCore::Camera::farPlane - * The current camera far plane. - */ float QCamera::farPlane() const { Q_D(const QCamera); @@ -397,7 +674,7 @@ float QCamera::farPlane() const } /*! - * Sets the camera's field of view to \a fiedOfView. + * Sets the camera's field of view to \a fieldOfView in degrees. */ void QCamera::setFieldOfView(float fieldOfView) { @@ -405,10 +682,6 @@ void QCamera::setFieldOfView(float fieldOfView) d->m_lens->setFieldOfView(fieldOfView); } -/*! - * \qmlproperty float Qt3DCore::Camera::fieldOfView - * The current field of view. - */ float QCamera::fieldOfView() const { Q_D(const QCamera); @@ -424,10 +697,6 @@ void QCamera::setAspectRatio(float aspectRatio) d->m_lens->setAspectRatio(aspectRatio); } -/*! - * \qmlproperty float Qt3DCore::Camera::aspectRatio - * The current aspect ratio. - */ float QCamera::aspectRatio() const { Q_D(const QCamera); @@ -443,10 +712,6 @@ void QCamera::setLeft(float left) d->m_lens->setLeft(left); } -/*! - *\qmlproperty float Qt3DCore::Camera::left - * The current left of the camera. - */ float QCamera::left() const { Q_D(const QCamera); @@ -462,10 +727,6 @@ void QCamera::setRight(float right) d->m_lens->setRight(right); } -/*! - * \qmlproperty float Qt3DCore::Camera::right - * The current right of the camera. - */ float QCamera::right() const { Q_D(const QCamera); @@ -481,10 +742,6 @@ void QCamera::setBottom(float bottom) d->m_lens->setBottom(bottom); } -/*! - * \qmlproperty float Qt3DCore::Camera::bottom - * The current bottom of the camera. - */ float QCamera::bottom() const { Q_D(const QCamera); @@ -500,10 +757,6 @@ void QCamera::setTop(float top) d->m_lens->setTop(top); } -/*! - * \qmlproperty float Qt3DCore::Camera::top - * The current top of the camera. - */ float QCamera::top() const { Q_D(const QCamera); @@ -511,7 +764,7 @@ float QCamera::top() const } /*! - * Sets the camera's projection matrix. + * Sets the camera's projection matrix to \a projectionMatrix. */ void QCamera::setProjectionMatrix(const QMatrix4x4 &projectionMatrix) { @@ -519,10 +772,6 @@ void QCamera::setProjectionMatrix(const QMatrix4x4 &projectionMatrix) d->m_lens->setProjectionMatrix(projectionMatrix); } -/*! - * \qmlproperty QMatri4x4 Qt3DCore::Camera:projectionMatrix - * The current projection matrix of the camera. - */ QMatrix4x4 QCamera::projectionMatrix() const { Q_D(const QCamera); @@ -545,10 +794,6 @@ void QCamera::setPosition(const QVector3D &position) } } -/*! - * \qmlproperty vector3d Qt3DCore::Camera::position - * The camera's position. - */ QVector3D QCamera::position() const { Q_D(const QCamera); @@ -569,10 +814,6 @@ void QCamera::setUpVector(const QVector3D &upVector) } } -/*! - * \qmlproperty vector3d Qt3DCore::Camera::upVector - * The camera's up vector. - */ QVector3D QCamera::upVector() const { Q_D(const QCamera); @@ -595,30 +836,18 @@ void QCamera::setViewCenter(const QVector3D &viewCenter) } } -/*! - * \qmlproperty vector3d Qt3DCore::Camera::viewCenter - * The camera's view center. - */ QVector3D QCamera::viewCenter() const { Q_D(const QCamera); return d->m_viewCenter; } -/*! - * \qmlproperty vector3d Qt3DCore::Camera::viewVector - * The camera's view vector. - */ QVector3D QCamera::viewVector() const { Q_D(const QCamera); return d->m_cameraToCenter; } -/*! - * \qmlproperty matrix4x4 Qt3DCore::Camera::viewMatrix - * The camera's view matrix. - */ QMatrix4x4 QCamera::viewMatrix() const { Q_D(const QCamera); -- cgit v1.2.3 From 72f70ea3bdb2a0800412f35be90fa34b02adf243 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 1 Sep 2016 16:24:31 +0300 Subject: Qt3DExtra materials documentation fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Materials that were moved to Qt3DExtras were still part of Qt3DRender according to the documentation. Also added documentation for QML versions. Change-Id: Icd918599cf9a97a14e65f38a28309316a5f504dd Reviewed-by: Antti Määttä Reviewed-by: Paul Lemire --- src/doc/src/qmlextramaterials.qdoc | 568 +++++++++++++++++++++ src/extras/defaults/qdiffusemapmaterial.cpp | 37 +- .../defaults/qdiffusespecularmapmaterial.cpp | 35 +- src/extras/defaults/qgoochmaterial.cpp | 21 +- .../defaults/qnormaldiffusemapalphamaterial.cpp | 23 +- src/extras/defaults/qnormaldiffusemapmaterial.cpp | 40 +- .../defaults/qnormaldiffusespecularmapmaterial.cpp | 42 +- src/extras/defaults/qpervertexcolormaterial.cpp | 19 +- src/extras/defaults/qphongalphamaterial.cpp | 65 ++- src/extras/defaults/qphongmaterial.cpp | 28 +- 10 files changed, 747 insertions(+), 131 deletions(-) create mode 100644 src/doc/src/qmlextramaterials.qdoc diff --git a/src/doc/src/qmlextramaterials.qdoc b/src/doc/src/qmlextramaterials.qdoc new file mode 100644 index 000000000..48f1a2326 --- /dev/null +++ b/src/doc/src/qmlextramaterials.qdoc @@ -0,0 +1,568 @@ +/**************************************************************************** +** +** 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 DiffuseMapMaterial + \inqmlmodule Qt3D.Extras + \brief The DiffuseMapMaterial provides a default implementation of the phong lighting effect + where the diffuse light component is read from a texture map. + \since 5.7 + \inherits Qt3D.Render::Material + + The specular lighting effect is based on the combination of 3 lighting components ambient, + diffuse and specular. The relative strengths of these components are controlled by means of + their reflectivity coefficients which are modelled as RGB triplets: + + \list + \li Ambient is the color that is emitted by an object without any other light source. + \li Diffuse is the color that is emitted for rought surface reflections with the lights. + \li Specular is the color emitted for shiny surface reflections with the lights. + \li The shininess of a surface is controlled by a float property. + \endlist + + This material uses an effect with a single render pass approach and performs per fragment + lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. +*/ +/*! + \qmlproperty color DiffuseMapMaterial::ambient + + Holds the current ambient color. +*/ +/*! + \qmlproperty color DiffuseMapMaterial::specular + + Holds the current specular color. +*/ +/*! + \qmlproperty real DiffuseMapMaterial::shininess + + Holds the current shininess. +*/ +/*! + \qmlproperty real DiffuseMapMaterial::textureScale + + Holds the current texture scale. It is applied as a multiplier to texture + coordinates at render time. Defaults to 1.0. +*/ +/*! + \qmlproperty TextureImage DiffuseMapMaterial::diffuse + + Holds the current texture used as the diffuse map. + + By default, the diffuse texture has the following properties: + + \list + \li Linear minification and magnification filters + \li Linear mipmap with mipmapping enabled + \li Repeat wrap mode + \li Maximum anisotropy of 16.0 + \endlist +*/ + +/*! + \qmltype DiffuseSpecularMapMaterial + \inqmlmodule Qt3D.Extras + \brief The DiffuseSpecularMapMaterial provides a default implementation of the phong lighting + effect where the diffuse and specular light components are read from texture maps. + \since 5.7 + \inherits Qt3D.Render::Material + + The specular lighting effect is based on the combination of 3 lighting components ambient, + diffuse and specular. The relative strengths of these components are controlled by means of + their reflectivity coefficients which are modelled as RGB triplets: + + \list + \li Ambient is the color that is emitted by an object without any other light source. + \li Diffuse is the color that is emitted for rought surface reflections with the lights. + \li Specular is the color emitted for shiny surface reflections with the lights. + \li The shininess of a surface is controlled by a float property. + \endlist + + This material uses an effect with a single render pass approach and performs per fragment + lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. +*/ +/*! + \qmlproperty color DiffuseSpecularMapMaterial::ambient + + Holds the current ambient color. +*/ +/*! + \qmlproperty TextureImage DiffuseSpecularMapMaterial::diffuse + + Holds the current diffuse map texture. + + By default, the diffuse texture has the following properties: + + \list + \li Linear minification and magnification filters + \li Linear mipmap with mipmapping enabled + \li Repeat wrap mode + \li Maximum anisotropy of 16.0 + \endlist +*/ +/*! + \qmlproperty TextureImage DiffuseSpecularMapMaterial::specular + + Holds the current specular map texture. + + By default, the specular texture has the following properties: + + \list + \li Linear minification and magnification filters + \li Linear mipmap with mipmapping enabled + \li Repeat wrap mode + \li Maximum anisotropy of 16.0 + \endlist +*/ +/*! + \qmlproperty real DiffuseSpecularMapMaterial::shininess + + Holds the current shininess. +*/ +/*! + \qmlproperty real DiffuseSpecularMapMaterial::textureScale + + Holds the current texture scale. It is applied as a multiplier to texture + coordinates at render time. Defaults to 1.0. +*/ + +/*! + \qmltype GoochMaterial + \inqmlmodule Qt3D.Extras + \brief The GoochMaterial provides a material that implements the Gooch + shading model, popular in CAD and CAM applications. + \since 5.7 + \inherits Qt3D.Render::Material + + The Gooch lighting model uses both color and brightness to help show the + curvature of 3D surfaces. This is often better than models such as Phong + that rely purely upon changes in brightness. In situations such as in CAD + and CAM applications where photorealism is not a goal, the Gooch shading + model in conjunction with some kind of silhouette edge inking is a popular + solution. + + The Gooch lighting model is explained fully in the \l{original Gooch + paper}. The Gooch model mixes a diffuse object color with a user-provided + cool color and warm color to produce the end points of a color ramp that is + used to shade the object based upon the cosine of the angle between the + vector from the fragment to the light source and the fragment's normal + vector. Optionally, a specular highlight can be added on top. The relative + contributions to the cool and warm colors by the diffuse color are + controlled by the alpha and beta properties respecitvely. + + This material uses an effect with a single render pass approach and + performs per fragment lighting. Techniques are provided for OpenGL 2, + OpenGL 3 or above as well as OpenGL ES 2. +*/ +/*! + \qmlproperty color GoochMaterial::diffuse + + Holds the current diffuse color. +*/ +/*! + \qmlproperty color GoochMaterial::specular + + Holds the current specular color. +*/ +/*! + \qmlproperty color GoochMaterial::coolColor + + Holds the current coolColor color. +*/ +/*! + \qmlproperty color GoochMaterial::warmColor + + Holds the current warmColor color. +*/ +/*! + \qmlproperty real GoochMaterial::alpha + + Holds the current alpha value. The start point of the color ramp + used by the Gooch shader is calculated as {c = cool + alpha * diffuse}. +*/ +/*! + \qmlproperty real GoochMaterial::beta + + Holds the current beta value. The start point of the color ramp + used by the Gooch shader is calculated as {c = warm + beta * diffuse}. +*/ +/*! + \qmlproperty real GoochMaterial::shininess + + Holds the current shininess value. Higher values of shininess result in + a smaller and brighter highlight. +*/ + +/*! + \qmltype NormalDiffuseMapAlphaMaterial + \inqmlmodule Qt3D.Extras + \brief The NormalDiffuseMapAlphaMaterial provides a specialization of NormalDiffuseMapMaterial + with alpha coverage and a depth test performed in the rendering pass. + \since 5.7 + \inherits Qt3D.Render::Material + + The specular lighting effect is based on the combination of 3 lighting components ambient, + diffuse and specular. The relative strengths of these components are controlled by means of + their reflectivity coefficients which are modelled as RGB triplets: + + \list + \li Ambient is the color that is emitted by an object without any other light source. + \li Diffuse is the color that is emitted for rought surface reflections with the lights. + \li Specular is the color emitted for shiny surface reflections with the lights. + \li The shininess of a surface is controlled by a float property. + \endlist + + This material uses an effect with a single render pass approach and performs per fragment + lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. +*/ +/*! + \qmlproperty color NormalDiffuseMapAlphaMaterial::ambient + + Holds the current ambient color. +*/ +/*! + \qmlproperty TextureImage NormalDiffuseMapAlphaMaterial::diffuse + + Holds the current diffuse map texture. + + By default, the diffuse texture has the following properties: + + \list + \li Linear minification and magnification filters + \li Linear mipmap with mipmapping enabled + \li Repeat wrap mode + \li Maximum anisotropy of 16.0 + \endlist +*/ +/*! + \qmlproperty color NormalDiffuseMapAlphaMaterial::specular + + Holds the current specular color. +*/ +/*! + \qmlproperty TextureImage NormalDiffuseMapAlphaMaterial::normal + + Holds the current normal map texture. + + By default, the normal texture has the following properties: + + \list + \li Linear minification and magnification filters + \li Repeat wrap mode + \li Maximum anisotropy of 16.0 + \endlist +*/ +/*! + \qmlproperty real NormalDiffuseMapAlphaMaterial::shininess + + Holds the current shininess. +*/ +/*! + \qmlproperty real NormalDiffuseMapAlphaMaterial::textureScale + + Holds the current texture scale. It is applied as a multiplier to texture + coordinates at render time. Defaults to 1.0. +*/ + +/*! + \qmltype NormalDiffuseMapMaterial + \inqmlmodule Qt3D.Extras + \brief The NormalDiffuseMapMaterial provides a default implementation of the phong lighting + and bump effect where the diffuse light component is read from a texture map and the normals of + the mesh being rendered from a normal texture map. + \since 5.7 + \inherits Qt3D.Render::Material + + The specular lighting effect is based on the combination of 3 lighting components ambient, + diffuse and specular. The relative strengths of these components are controlled by means of + their reflectivity coefficients which are modelled as RGB triplets: + + \list + \li Ambient is the color that is emitted by an object without any other light source. + \li Diffuse is the color that is emitted for rought surface reflections with the lights. + \li Specular is the color emitted for shiny surface reflections with the lights. + \li The shininess of a surface is controlled by a float property. + \endlist + + This material uses an effect with a single render pass approach and performs per fragment + lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. +*/ +/*! + \qmlproperty color NormalDiffuseMapMaterial::ambient + + Holds the current ambient color. +*/ +/*! + \qmlproperty TextureImage NormalDiffuseMapMaterial::diffuse + + Holds the current diffuse map texture. + + By default, the diffuse texture has the following properties: + + \list + \li Linear minification and magnification filters + \li Linear mipmap with mipmapping enabled + \li Repeat wrap mode + \li Maximum anisotropy of 16.0 + \endlist +*/ +/*! + \qmlproperty color NormalDiffuseMapMaterial::specular + + Holds the current specular color. +*/ +/*! + \qmlproperty TextureImage NormalDiffuseMapMaterial::normal + + Holds the current normal map texture. + + By default, the normal texture has the following properties: + + \list + \li Linear minification and magnification filters + \li Repeat wrap mode + \li Maximum anisotropy of 16.0 + \endlist +*/ +/*! + \qmlproperty real NormalDiffuseMapMaterial::shininess + + Holds the current shininess. +*/ +/*! + \qmlproperty real NormalDiffuseMapMaterial::textureScale + + Holds the current texture scale. It is applied as a multiplier to texture + coordinates at render time. Defaults to 1.0. +*/ + +/*! + \qmltype NormalDiffuseSpecularMapMaterial + \inqmlmodule Qt3D.Extras + \brief The NormalDiffuseSpecularMapMaterial provides a default implementation of the phong + lighting and bump effect where the diffuse and specular light components are read from texture + maps and the normals of the mesh being rendered from a normal texture map. + \since 5.7 + \inherits Qt3D.Render::Material + + The specular lighting effect is based on the combination of 3 lighting components ambient, + diffuse and specular. The relative strengths of these components are controlled by means of + their reflectivity coefficients which are modelled as RGB triplets: + + \list + \li Ambient is the color that is emitted by an object without any other light source. + \li Diffuse is the color that is emitted for rought surface reflections with the lights. + \li Specular is the color emitted for shiny surface reflections with the lights. + \li The shininess of a surface is controlled by a float property. + \endlist + + This material uses an effect with a single render pass approach and performs per fragment + lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. +*/ +/*! + \qmlproperty color NormalDiffuseSpecularMapMaterial::ambient + + Holds the current ambient color. +*/ +/*! + \qmlproperty TextureImage NormalDiffuseSpecularMapMaterial::diffuse + + Holds the current diffuse map texture. + + By default, the diffuse texture has the following properties: + + \list + \li Linear minification and magnification filters + \li Linear mipmap with mipmapping enabled + \li Repeat wrap mode + \li Maximum anisotropy of 16.0 + \endlist +*/ +/*! + \qmlproperty TextureImage NormalDiffuseSpecularMapMaterial::specular + + Holds the current specular map texture. + + By default, the specular texture has the following properties: + + \list + \li Linear minification and magnification filters + \li Linear mipmap with mipmapping enabled + \li Repeat wrap mode + \li Maximum anisotropy of 16.0 + \endlist +*/ +/*! + \qmlproperty TextureImage NormalDiffuseSpecularMapMaterial::normal + + Holds the current normal map texture. + + By default, the normal texture has the following properties: + + \list + \li Linear minification and magnification filters + \li Repeat wrap mode + \li Maximum anisotropy of 16.0 + \endlist +*/ +/*! + \qmlproperty real NormalDiffuseSpecularMapMaterial::shininess + + Holds the current shininess. +*/ +/*! + \qmlproperty real NormalDiffuseSpecularMapMaterial::textureScale + + Holds the current texture scale. It is applied as a multiplier to texture + coordinates at render time. Defaults to 1.0. +*/ + +/*! + \qmltype PerVertexColorMaterial + \inqmlmodule Qt3D.Extras + \brief The PerVertexColorMaterial class provides a default implementation for rendering the + color properties set for each vertex. + \since 5.7 + \inherits Qt3D.Render::Material + + This lighting effect is based on the combination of 2 lighting components ambient and diffuse. + Ambient is set by the vertex color. + Diffuse takes in account the normal distribution of each vertex. + + \list + \li Ambient is the color that is emitted by an object without any other light source. + \li Diffuse is the color that is emitted for rough surface reflections with the lights + \endlist + + This material uses an effect with a single render pass approach and forms fragment lighting. + Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. +*/ + +/*! + \qmltype PhongAlphaMaterial + \inqmlmodule Qt3D.Extras + \brief The PhongAlphaMaterial class provides a default implementation of + the phong lighting effect with alpha. + \since 5.7 + \inherits Qt3D.Render::Material + + The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse + and specular. The relative strengths of these components are controlled by means of their + reflectivity coefficients which are modelled as RGB triplets: + + \list + \li Ambient is the color that is emitted by an object without any other light source. + \li Diffuse is the color that is emitted for rought surface reflections with the lights. + \li Specular is the color emitted for shiny surface reflections with the lights. + \li The shininess of a surface is controlled by a float property. + \li Alpha is the transparency of the surface between 0 (fully transparent) and 1 (opaque). + \endlist + + This material uses an effect with a single render pass approach and performs per fragment + lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. +*/ +/*! + \qmlproperty color PhongAlphaMaterial::ambient + + Holds the current ambient color. +*/ +/*! + \qmlproperty color PhongAlphaMaterial::diffuse + + Holds the current diffuse color. +*/ +/*! + \qmlproperty color PhongAlphaMaterial::specular + + Holds the current specular color. +*/ +/*! + \qmlproperty real PhongAlphaMaterial::shininess + + Holds the current shininess. +*/ +/*! + \qmlproperty real PhongAlphaMaterial::alpha + + Holds the alpha component of the object which varies between 0 and 1. + + The default value is 0.5. +*/ + +/*! + \qmltype PhongMaterial + \inqmlmodule Qt3D.Extras + \brief The PhongMaterial class provides a default implementation of the phong lighting effect. + \since 5.7 + \inherits Qt3D.Render::Material + + The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse + and specular. The relative strengths of these components are controlled by means of their + reflectivity coefficients which are modelled as RGB triplets: + + \list + \li Ambient is the color that is emitted by an object without any other light source. + \li Diffuse is the color that is emitted for rought surface reflections with the lights. + \li Specular is the color emitted for shiny surface reflections with the lights. + \li The shininess of a surface is controlled by a float property. + \endlist + + This material uses an effect with a single render pass approach and performs per fragment + lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. +*/ +/*! + \qmlproperty color PhongMaterial::ambient + + Holds the current ambient color. +*/ +/*! + \qmlproperty color PhongMaterial::diffuse + + Holds the current diffuse color. +*/ +/*! + \qmlproperty color PhongMaterial::specular + + Holds the current specular color. +*/ +/*! + \qmlproperty real PhongMaterial::shininess + + Holds the current shininess. +*/ diff --git a/src/extras/defaults/qdiffusemapmaterial.cpp b/src/extras/defaults/qdiffusemapmaterial.cpp index 854d0a809..b3aa3bf00 100644 --- a/src/extras/defaults/qdiffusemapmaterial.cpp +++ b/src/extras/defaults/qdiffusemapmaterial.cpp @@ -178,14 +178,16 @@ void QDiffuseMapMaterialPrivate::handleTextureScaleChanged(const QVariant &var) } /*! - \class Qt3DRender::QDiffuseMapMaterial - \brief The QDiffuseMapMaterial provides a default implementation of the phong lighting effect where the diffuse light component - is read from a texture map. - \inmodule Qt3DRender - \since 5.5 + \class Qt3DExtras::QDiffuseMapMaterial + \brief The QDiffuseMapMaterial provides a default implementation of the phong lighting effect + where the diffuse light component is read from a texture map. + \inmodule Qt3DExtras + \since 5.7 + \inherits Qt3DRender::QMaterial - The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular. - The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets: + The specular lighting effect is based on the combination of 3 lighting components ambient, + diffuse and specular. The relative strengths of these components are controlled by means of + their reflectivity coefficients which are modelled as RGB triplets: \list \li Ambient is the color that is emitted by an object without any other light source. @@ -194,12 +196,12 @@ void QDiffuseMapMaterialPrivate::handleTextureScaleChanged(const QVariant &var) \li The shininess of a surface is controlled by a float property. \endlist - This material uses an effect with a single render pass approach and performs per fragment lighting. - Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. + This material uses an effect with a single render pass approach and performs per fragment + lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. */ /*! - Constructs a new Qt3DRender::QDiffuseMapMaterial instance with parent object \a parent. + Constructs a new QDiffuseMapMaterial instance with parent object \a parent. */ QDiffuseMapMaterial::QDiffuseMapMaterial(QNode *parent) : QMaterial(*new QDiffuseMapMaterialPrivate, parent) @@ -216,7 +218,7 @@ QDiffuseMapMaterial::~QDiffuseMapMaterial() } /*! - \property Qt3DRender::QDiffuseMapMaterial::ambient + \property QDiffuseMapMaterial::ambient Holds the current ambient color. */ @@ -228,7 +230,7 @@ QColor QDiffuseMapMaterial::ambient() const } /*! - \property Qt3DRender::QDiffuseMapMaterial::specular + \property QDiffuseMapMaterial::specular Holds the current specular color. */ @@ -239,7 +241,7 @@ QColor QDiffuseMapMaterial::specular() const } /*! - \property Qt3DRender::QDiffuseMapMaterial::shininess + \property QDiffuseMapMaterial::shininess Holds the current shininess as a float value. */ @@ -250,9 +252,9 @@ float QDiffuseMapMaterial::shininess() const } /*! - \property Qt3DRender::QDiffuseMapMaterial::diffuse + \property QDiffuseMapMaterial::diffuse - Holds the current QTexture used as the diffuse map. + Holds the current texture used as the diffuse map. By default, the diffuse texture has the following properties: @@ -270,9 +272,10 @@ QAbstractTexture *QDiffuseMapMaterial::diffuse() const } /*! - \property Qt3DRender::QDiffuseMapMaterial::textureScale + \property QDiffuseMapMaterial::textureScale - Holds the current texture scale as a float value. + Holds the current texture scale. It is applied as a multiplier to texture + coordinates at render time. Defaults to 1.0. */ float QDiffuseMapMaterial::textureScale() const diff --git a/src/extras/defaults/qdiffusespecularmapmaterial.cpp b/src/extras/defaults/qdiffusespecularmapmaterial.cpp index a4ccb6121..4b79eea2b 100644 --- a/src/extras/defaults/qdiffusespecularmapmaterial.cpp +++ b/src/extras/defaults/qdiffusespecularmapmaterial.cpp @@ -185,14 +185,16 @@ void QDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged(const QVarian } /*! - \class Qt3DRender::QDiffuseSpecularMapMaterial - \brief The QDiffuseSpecularMapMaterial provides a default implementation of the phong lighting and bump effect where the diffuse and specular light components - are read from texture maps. - \inmodule Qt3DRender - \since 5.5 + \class Qt3DExtras::QDiffuseSpecularMapMaterial + \brief The QDiffuseSpecularMapMaterial provides a default implementation of the phong lighting + effect where the diffuse and specular light components are read from texture maps. + \inmodule Qt3DExtras + \since 5.7 + \inherits Qt3DRender::QMaterial - The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular. - The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets: + The specular lighting effect is based on the combination of 3 lighting components ambient, + diffuse and specular. The relative strengths of these components are controlled by means of + their reflectivity coefficients which are modelled as RGB triplets: \list \li Ambient is the color that is emitted by an object without any other light source. @@ -201,12 +203,12 @@ void QDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged(const QVarian \li The shininess of a surface is controlled by a float property. \endlist - This material uses an effect with a single render pass approach and performs per fragment lighting. - Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. + This material uses an effect with a single render pass approach and performs per fragment + lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. */ /*! - Constructs a new Qt3DRender::QDiffuseSpecularMapMaterial instance with parent object \a parent. + Constructs a new QDiffuseSpecularMapMaterial instance with parent object \a parent. */ QDiffuseSpecularMapMaterial::QDiffuseSpecularMapMaterial(QNode *parent) : QMaterial(*new QDiffuseSpecularMapMaterialPrivate, parent) @@ -223,7 +225,7 @@ QDiffuseSpecularMapMaterial::~QDiffuseSpecularMapMaterial() } /*! - \property Qt3DRender::QDiffuseSpecularMapMaterial::ambient + \property QDiffuseSpecularMapMaterial::ambient Holds the current ambient color. */ @@ -234,7 +236,7 @@ QColor QDiffuseSpecularMapMaterial::ambient() const } /*! - \property Qt3DRender::QDiffuseSpecularMapMaterial::diffuse + \property QDiffuseSpecularMapMaterial::diffuse Holds the current diffuse map texture. @@ -254,7 +256,7 @@ QAbstractTexture *QDiffuseSpecularMapMaterial::diffuse() const } /*! - \property Qt3DRender::QDiffuseSpecularMapMaterial::specular + \property QDiffuseSpecularMapMaterial::specular Holds the current specular map texture. @@ -274,7 +276,7 @@ QAbstractTexture *QDiffuseSpecularMapMaterial::specular() const } /*! - \property Qt3DRender::QDiffuseSpecularMapMaterial::shininess + \property QDiffuseSpecularMapMaterial::shininess Holds the current shininess as a float value. */ @@ -285,9 +287,10 @@ float QDiffuseSpecularMapMaterial::shininess() const } /*! - \property Qt3DRender::QDiffuseSpecularMapMaterial::textureScale + \property QDiffuseSpecularMapMaterial::textureScale - Holds the current texture scale as a float value. + Holds the current texture scale. It is applied as a multiplier to texture + coordinates at render time. Defaults to 1.0. */ float QDiffuseSpecularMapMaterial::textureScale() const { diff --git a/src/extras/defaults/qgoochmaterial.cpp b/src/extras/defaults/qgoochmaterial.cpp index 6b6ea131a..f2f34fc84 100644 --- a/src/extras/defaults/qgoochmaterial.cpp +++ b/src/extras/defaults/qgoochmaterial.cpp @@ -191,7 +191,8 @@ void QGoochMaterialPrivate::handleShininessChanged(const QVariant &var) \brief The QGoochMaterial provides a material that implements the Gooch shading model, popular in CAD and CAM applications. \inmodule Qt3DExtras - \since 5.5 + \since 5.7 + \inherits Qt3DRender::QMaterial The Gooch lighting model uses both color and brightness to help show the curvature of 3D surfaces. This is often better than models such as Phong @@ -201,7 +202,7 @@ void QGoochMaterialPrivate::handleShininessChanged(const QVariant &var) solution. The Gooch lighting model is explained fully in the \l{original Gooch - paper}. The Gooch model mixes a diffuse objetc color with a user-provided + paper}. The Gooch model mixes a diffuse object color with a user-provided cool color and warm color to produce the end points of a color ramp that is used to shade the object based upon the cosine of the angle between the vector from the fragment to the light source and the fragment's normal @@ -215,7 +216,7 @@ void QGoochMaterialPrivate::handleShininessChanged(const QVariant &var) */ /*! - Constructs a new Qt3DExtras::QGoochMaterial instance with parent object \a parent. + Constructs a new QGoochMaterial instance with parent object \a parent. */ QGoochMaterial::QGoochMaterial(QNode *parent) : QMaterial(*new QGoochMaterialPrivate, parent) @@ -237,7 +238,7 @@ QGoochMaterial::QGoochMaterial(QGoochMaterialPrivate &dd, QNode *parent) } /*! - \property Qt3DExtras::QGoochMaterial::diffuse + \property QGoochMaterial::diffuse Holds the current diffuse color. */ @@ -248,7 +249,7 @@ QColor QGoochMaterial::diffuse() const } /*! - \property Qt3DExtras::QGoochMaterial::specular + \property QGoochMaterial::specular Holds the current specular color. */ @@ -259,7 +260,7 @@ QColor QGoochMaterial::specular() const } /*! - \property Qt3DExtras::QGoochMaterial::cool + \property QGoochMaterial::cool Holds the current cool color. */ @@ -270,7 +271,7 @@ QColor QGoochMaterial::cool() const } /*! - \property Qt3DExtras::QGoochMaterial::warm + \property QGoochMaterial::warm Holds the current warm color. */ @@ -281,7 +282,7 @@ QColor QGoochMaterial::warm() const } /*! - \property Qt3DExtras::QGoochMaterial::alpha + \property QGoochMaterial::alpha Holds the current alpha value. The start point of the color ramp used by the Gooch shader is calculated as {c = cool + alpha * diffuse}. @@ -293,7 +294,7 @@ float QGoochMaterial::alpha() const } /*! - \property Qt3DExtras::QGoochMaterial::beta + \property QGoochMaterial::beta Holds the current beta value. The start point of the color ramp used by the Gooch shader is calculated as {c = warm + beta * diffuse}. @@ -305,7 +306,7 @@ float QGoochMaterial::beta() const } /*! - \property Qt3DExtras::QGoochMaterial::shininess + \property QGoochMaterial::shininess Holds the current shininess value. Higher values of shininess result in a smaller and brighter highlight. diff --git a/src/extras/defaults/qnormaldiffusemapalphamaterial.cpp b/src/extras/defaults/qnormaldiffusemapalphamaterial.cpp index 61b8def84..92564ee3f 100644 --- a/src/extras/defaults/qnormaldiffusemapalphamaterial.cpp +++ b/src/extras/defaults/qnormaldiffusemapalphamaterial.cpp @@ -146,15 +146,16 @@ void QNormalDiffuseMapAlphaMaterialPrivate::init() /*! - \class Qt3DRender::QNormalDiffuseMapAlphaMaterial - \brief The QNormalDiffuseMapAlphaMaterial provides a default implementation of the phong lighting and bump effect where the diffuse light component - is read from a texture map and the normals of the mesh being rendered from a normal texture map. In addition, it defines an alpha to coverage and - a depth test to be performed in the rendering pass. - \inmodule Qt3DRender - \since 5.5 + \class Qt3DExtras::QNormalDiffuseMapAlphaMaterial + \brief The QNormalDiffuseMapAlphaMaterial provides a specialization of QNormalDiffuseMapMaterial + with alpha coverage and a depth test performed in the rendering pass. + \inmodule Qt3DExtras + \since 5.7 + \inherits Qt3DExtras::QNormalDiffuseMapMaterial - The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular. - The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets: + The specular lighting effect is based on the combination of 3 lighting components ambient, + diffuse and specular. The relative strengths of these components are controlled by means of + their reflectivity coefficients which are modelled as RGB triplets: \list \li Ambient is the color that is emitted by an object without any other light source. @@ -163,11 +164,11 @@ void QNormalDiffuseMapAlphaMaterialPrivate::init() \li The shininess of a surface is controlled by a float property. \endlist - This material uses an effect with a single render pass approach and performs per fragment lighting. - Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. + This material uses an effect with a single render pass approach and performs per fragment + lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. */ /*! - Constructs a new Qt3DRender::QNormalDiffuseMapAlphaMaterial instance with parent object \a parent. + Constructs a new QNormalDiffuseMapAlphaMaterial instance with parent object \a parent. */ QNormalDiffuseMapAlphaMaterial::QNormalDiffuseMapAlphaMaterial(QNode *parent) : QNormalDiffuseMapMaterial(*new QNormalDiffuseMapAlphaMaterialPrivate, parent) diff --git a/src/extras/defaults/qnormaldiffusemapmaterial.cpp b/src/extras/defaults/qnormaldiffusemapmaterial.cpp index c38756c98..8373c4d5d 100644 --- a/src/extras/defaults/qnormaldiffusemapmaterial.cpp +++ b/src/extras/defaults/qnormaldiffusemapmaterial.cpp @@ -195,14 +195,17 @@ void QNormalDiffuseMapMaterialPrivate::handleTextureScaleChanged(const QVariant } /*! - \class Qt3DRender::QNormalDiffuseMapMaterial - \brief The QNormalDiffuseMapMaterial provides a default implementation of the phong lighting and bump effect where the diffuse light component - is read from a texture map and the normals of the mesh being rendered from a normal texture map. - \inmodule Qt3DRender - \since 5.5 - - The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular. - The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets: + \class Qt3DExtras::QNormalDiffuseMapMaterial + \brief The QNormalDiffuseMapMaterial provides a default implementation of the phong lighting + and bump effect where the diffuse light component is read from a texture map and the normals of + the mesh being rendered from a normal texture map. + \inmodule Qt3DExtras + \since 5.7 + \inherits Qt3DRender::QMaterial + + The specular lighting effect is based on the combination of 3 lighting components ambient, + diffuse and specular. The relative strengths of these components are controlled by means of + their reflectivity coefficients which are modelled as RGB triplets: \list \li Ambient is the color that is emitted by an object without any other light source. @@ -211,12 +214,12 @@ void QNormalDiffuseMapMaterialPrivate::handleTextureScaleChanged(const QVariant \li The shininess of a surface is controlled by a float property. \endlist - This material uses an effect with a single render pass approach and performs per fragment lighting. - Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. + This material uses an effect with a single render pass approach and performs per fragment + lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. */ /*! - Constructs a new Qt3DRender::QNormalDiffuseMapMaterial instance with parent object \a parent. + Constructs a new QNormalDiffuseMapMaterial instance with parent object \a parent. */ QNormalDiffuseMapMaterial::QNormalDiffuseMapMaterial(QNode *parent) : QMaterial(*new QNormalDiffuseMapMaterialPrivate, parent) @@ -241,7 +244,7 @@ QNormalDiffuseMapMaterial::~QNormalDiffuseMapMaterial() } /*! - \property Qt3DRender::QNormalDiffuseMapMaterial::ambient + \property QNormalDiffuseMapMaterial::ambient Holds the current ambient color. */ @@ -252,7 +255,7 @@ QColor QNormalDiffuseMapMaterial::ambient() const } /*! - \property Qt3DRender::QNormalDiffuseMapMaterial::specular + \property QNormalDiffuseMapMaterial::specular Holds the current specular color. */ @@ -263,7 +266,7 @@ QColor QNormalDiffuseMapMaterial::specular() const } /*! - \property Qt3DRender::QNormalDiffuseMapMaterial::diffuse + \property QNormalDiffuseMapMaterial::diffuse Holds the current diffuse map texture. @@ -283,7 +286,7 @@ QAbstractTexture *QNormalDiffuseMapMaterial::diffuse() const } /*! - \property Qt3DRender::QNormalDiffuseMapMaterial::normal + \property QNormalDiffuseMapMaterial::normal Holds the current normal map texture. @@ -302,7 +305,7 @@ QAbstractTexture *QNormalDiffuseMapMaterial::normal() const } /*! - \property Qt3DRender::QNormalDiffuseMapMaterial::shininess + \property QNormalDiffuseMapMaterial::shininess Holds the current shininess as a float value. */ @@ -313,9 +316,10 @@ float QNormalDiffuseMapMaterial::shininess() const } /*! - \property Qt3DRender::QNormalDiffuseMapMaterial::textureScale + \property QNormalDiffuseMapMaterial::textureScale - Holds the current texture scale as a float value. + Holds the current texture scale. It is applied as a multiplier to texture + coordinates at render time. Defaults to 1.0. */ float QNormalDiffuseMapMaterial::textureScale() const { diff --git a/src/extras/defaults/qnormaldiffusespecularmapmaterial.cpp b/src/extras/defaults/qnormaldiffusespecularmapmaterial.cpp index 3c26fde5a..e4a83c50c 100644 --- a/src/extras/defaults/qnormaldiffusespecularmapmaterial.cpp +++ b/src/extras/defaults/qnormaldiffusespecularmapmaterial.cpp @@ -202,14 +202,17 @@ void QNormalDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged(const Q } /*! - \class Qt3DRender::QNormalDiffuseSpecularMapMaterial - \brief The QNormalDiffuseSpecularMapMaterial provides a default implementation of the phong lighting and bump effect where the diffuse and specular light components - are read from texture maps and the normals of the mesh being rendered from a normal texture map. - \inmodule Qt3DRender - \since 5.5 - - The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular. - The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets: + \class Qt3DExtras::QNormalDiffuseSpecularMapMaterial + \brief The QNormalDiffuseSpecularMapMaterial provides a default implementation of the phong + lighting and bump effect where the diffuse and specular light components are read from texture + maps and the normals of the mesh being rendered from a normal texture map. + \inmodule Qt3DExtras + \since 5.7 + \inherits Qt3DRender::QMaterial + + The specular lighting effect is based on the combination of 3 lighting components ambient, + diffuse and specular. The relative strengths of these components are controlled by means of + their reflectivity coefficients which are modelled as RGB triplets: \list \li Ambient is the color that is emitted by an object without any other light source. @@ -218,12 +221,12 @@ void QNormalDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged(const Q \li The shininess of a surface is controlled by a float property. \endlist - This material uses an effect with a single render pass approach and performs per fragment lighting. - Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. + This material uses an effect with a single render pass approach and performs per fragment + lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. */ /*! - Constructs a new Qt3DRender::QNormalDiffuseSpecularMapMaterial instance with parent object \a parent. + Constructs a new QNormalDiffuseSpecularMapMaterial instance with parent object \a parent. */ QNormalDiffuseSpecularMapMaterial::QNormalDiffuseSpecularMapMaterial(QNode *parent) : QMaterial(*new QNormalDiffuseSpecularMapMaterialPrivate, parent) @@ -241,14 +244,14 @@ QNormalDiffuseSpecularMapMaterial::QNormalDiffuseSpecularMapMaterial(QNormalDiff } /*! - Destroys the Qt3DRender::QNormalDiffuseSpecularMapMaterial instance. + Destroys the QNormalDiffuseSpecularMapMaterial instance. */ QNormalDiffuseSpecularMapMaterial::~QNormalDiffuseSpecularMapMaterial() { } /*! - \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::ambient + \property QNormalDiffuseSpecularMapMaterial::ambient Holds the current ambient color. */ @@ -259,7 +262,7 @@ QColor QNormalDiffuseSpecularMapMaterial::ambient() const } /*! - \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::diffuse + \property QNormalDiffuseSpecularMapMaterial::diffuse Holds the current diffuse map texture. @@ -279,7 +282,7 @@ QAbstractTexture *QNormalDiffuseSpecularMapMaterial::diffuse() const } /*! - \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::normal + \property QNormalDiffuseSpecularMapMaterial::normal Holds the current normal map texture. @@ -298,7 +301,7 @@ QAbstractTexture *QNormalDiffuseSpecularMapMaterial::normal() const } /*! - \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::specular + \property QNormalDiffuseSpecularMapMaterial::specular Holds the current specular map texture. @@ -318,7 +321,7 @@ QAbstractTexture *QNormalDiffuseSpecularMapMaterial::specular() const } /*! - \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::shininess + \property QNormalDiffuseSpecularMapMaterial::shininess Holds the current shininess as a float value. */ @@ -329,9 +332,10 @@ float QNormalDiffuseSpecularMapMaterial::shininess() const } /*! - \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::textureScale + \property QNormalDiffuseSpecularMapMaterial::textureScale - Holds the current texture scale as a float value. + Holds the current texture scale. It is applied as a multiplier to texture + coordinates at render time. Defaults to 1.0. */ float QNormalDiffuseSpecularMapMaterial::textureScale() const { diff --git a/src/extras/defaults/qpervertexcolormaterial.cpp b/src/extras/defaults/qpervertexcolormaterial.cpp index 2a301cd3f..514f994c1 100644 --- a/src/extras/defaults/qpervertexcolormaterial.cpp +++ b/src/extras/defaults/qpervertexcolormaterial.cpp @@ -73,12 +73,15 @@ QPerVertexColorMaterialPrivate::QPerVertexColorMaterialPrivate() } /*! - \class Qt3DRender::QPerVertexColorMaterial - \brief The QPerVertexColorMaterial class provides a default implementation for rendering the color properties set for each vertex. - \inmodule Qt3DRender - \since 5.5 - - This lighting effect is based on the combination of 2 lighting components ambient and diffuse. Ambient is set by the vertex color. + \class Qt3DExtras::QPerVertexColorMaterial + \brief The QPerVertexColorMaterial class provides a default implementation for rendering the + color properties set for each vertex. + \inmodule Qt3DExtras + \since 5.7 + \inherits Qt3DRender::QMaterial + + This lighting effect is based on the combination of 2 lighting components ambient and diffuse. + Ambient is set by the vertex color. Diffuse takes in account the normal distribution of each vertex. \list @@ -91,8 +94,6 @@ QPerVertexColorMaterialPrivate::QPerVertexColorMaterialPrivate() */ /*! - \fn Qt3DRender::QPerVertexColorMaterial::QPerVertexColorMaterial(Qt3DCore::QNode *parent) - Constructs a new QPerVertexColorMaterial instance with parent object \a parent. */ QPerVertexColorMaterial::QPerVertexColorMaterial(QNode *parent) @@ -103,8 +104,6 @@ QPerVertexColorMaterial::QPerVertexColorMaterial(QNode *parent) } /*! - \fn Qt3DRender::QPerVertexColorMaterial::~QPerVertexColorMaterial() - Destroys the QPerVertexColorMaterial */ QPerVertexColorMaterial::~QPerVertexColorMaterial() diff --git a/src/extras/defaults/qphongalphamaterial.cpp b/src/extras/defaults/qphongalphamaterial.cpp index efc413a86..7a05610c2 100644 --- a/src/extras/defaults/qphongalphamaterial.cpp +++ b/src/extras/defaults/qphongalphamaterial.cpp @@ -194,15 +194,17 @@ void QPhongAlphaMaterialPrivate::handleAlphaChanged(const QVariant &var) } /*! - \class Qt3DRender::QPhongAlphaMaterial + \class Qt3DExtras::QPhongAlphaMaterial \brief The QPhongAlphaMaterial class provides a default implementation of the phong lighting effect with alpha. - \inmodule Qt3DRenderer - \since 5.5 + \inmodule Qt3DExtras + \since 5.7 + \inherits Qt3DRender::QMaterial - The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular. - The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets: + The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse + and specular. The relative strengths of these components are controlled by means of their + reflectivity coefficients which are modelled as RGB triplets: \list \li Ambient is the color that is emitted by an object without any other light source. @@ -212,13 +214,11 @@ void QPhongAlphaMaterialPrivate::handleAlphaChanged(const QVariant &var) \li Alpha is the transparency of the surface between 0 (fully transparent) and 1 (opaque). \endlist - This material uses an effect with a single render pass approach and performs per fragment lighting. - Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. + This material uses an effect with a single render pass approach and performs per fragment + lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. */ /*! - \fn Qt3DRender::QPhongAlphaMaterial::QPhongAlphaMaterial(Qt3DCore::QNode *parent) - Constructs a new QPhongAlphaMaterial instance with parent object \a parent. */ QPhongAlphaMaterial::QPhongAlphaMaterial(QNode *parent) @@ -247,7 +247,7 @@ QPhongAlphaMaterial::~QPhongAlphaMaterial() } /*! - \property Qt3DRender::QPhongAlphaMaterial::ambient + \property QPhongAlphaMaterial::ambient Holds the ambient color. */ @@ -258,7 +258,7 @@ QColor QPhongAlphaMaterial::ambient() const } /*! - \property Qt3DRender::QPhongAlphaMaterial::diffuse + \property QPhongAlphaMaterial::diffuse Holds the diffuse color. */ @@ -269,7 +269,7 @@ QColor QPhongAlphaMaterial::diffuse() const } /*! - \property Qt3DRender::QPhongAlphaMaterial::specular + \property QPhongAlphaMaterial::specular Holds the specular color. */ @@ -280,7 +280,7 @@ QColor QPhongAlphaMaterial::specular() const } /*! - \property Qt3DRender::QPhongAlphaMaterial::shininess + \property QPhongAlphaMaterial::shininess Holds the shininess exponent. */ @@ -291,11 +291,11 @@ float QPhongAlphaMaterial::shininess() const } /*! - \property Qt3DRender::QPhongAlphaMaterial::alpha + \property QPhongAlphaMaterial::alpha Holds the alpha component of the object which varies between 0 and 1. - \note: default value is 0.5f + The default value is 0.5f. */ float QPhongAlphaMaterial::alpha() const { @@ -303,30 +303,65 @@ float QPhongAlphaMaterial::alpha() const return d->m_alphaParameter->value().toFloat(); } +/*! + \property QPhongAlphaMaterial::sourceRgbArg + + Holds the blend equation source RGB blending argument. + + \sa Qt3DRender::QBlendEquationArguments::Blending +*/ QBlendEquationArguments::Blending QPhongAlphaMaterial::sourceRgbArg() const { Q_D(const QPhongAlphaMaterial); return d->m_blendState->sourceRgb(); } +/*! + \property QPhongAlphaMaterial::destinationRgbArg + + Holds the blend equation destination RGB blending argument. + + \sa Qt3DRender::QBlendEquationArguments::Blending +*/ QBlendEquationArguments::Blending QPhongAlphaMaterial::destinationRgbArg() const { Q_D(const QPhongAlphaMaterial); return d->m_blendState->destinationRgb(); } +/*! + \property QPhongAlphaMaterial::sourceAlphaArg + + Holds the blend equation source alpha blending argument. + + \sa Qt3DRender::QBlendEquationArguments::Blending +*/ QBlendEquationArguments::Blending QPhongAlphaMaterial::sourceAlphaArg() const { Q_D(const QPhongAlphaMaterial); return d->m_blendState->sourceAlpha(); } +/*! + \property QPhongAlphaMaterial::destinationAlphaArg + + Holds the blend equation destination alpha blending argument. + + \sa Qt3DRender::QBlendEquationArguments::Blending +*/ QBlendEquationArguments::Blending QPhongAlphaMaterial::destinationAlphaArg() const { Q_D(const QPhongAlphaMaterial); return d->m_blendState->destinationAlpha(); } +/*! + \property QPhongAlphaMaterial::blendFunctionArg + + Holds the blend equation function argument. + + \sa Qt3DRender::QBlendEquation::BlendFunction +*/ QBlendEquation::BlendFunction QPhongAlphaMaterial::blendFunctionArg() const { Q_D(const QPhongAlphaMaterial); diff --git a/src/extras/defaults/qphongmaterial.cpp b/src/extras/defaults/qphongmaterial.cpp index f9c51bae8..c294984b6 100644 --- a/src/extras/defaults/qphongmaterial.cpp +++ b/src/extras/defaults/qphongmaterial.cpp @@ -162,13 +162,15 @@ void QPhongMaterialPrivate::handleShininessChanged(const QVariant &var) } /*! - \class Qt3DRender::QPhongMaterial + \class Qt3DExtras::QPhongMaterial \brief The QPhongMaterial class provides a default implementation of the phong lighting effect. - \inmodule Qt3DRender - \since 5.5 + \inmodule Qt3DExtras + \since 5.7 + \inherits Qt3DRender::QMaterial - The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular. - The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets: + The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse + and specular. The relative strengths of these components are controlled by means of their + reflectivity coefficients which are modelled as RGB triplets: \list \li Ambient is the color that is emitted by an object without any other light source. @@ -177,13 +179,11 @@ void QPhongMaterialPrivate::handleShininessChanged(const QVariant &var) \li The shininess of a surface is controlled by a float property. \endlist - This material uses an effect with a single render pass approach and performs per fragment lighting. - Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. + This material uses an effect with a single render pass approach and performs per fragment + lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2. */ /*! - \fn Qt3DRender::QPhongMaterial::QPhongMaterial(Qt3DCore::QNode *parent) - Constructs a new QPhongMaterial instance with parent object \a parent. */ QPhongMaterial::QPhongMaterial(QNode *parent) @@ -194,8 +194,6 @@ QPhongMaterial::QPhongMaterial(QNode *parent) } /*! - \fn Qt3DRender::QPhongMaterial::~QPhongMaterial() - Destroys the QPhongMaterial. */ QPhongMaterial::~QPhongMaterial() @@ -203,7 +201,7 @@ QPhongMaterial::~QPhongMaterial() } /*! - \property Qt3DRender::QPhongMaterial::ambient + \property QPhongMaterial::ambient Holds the ambient color. */ @@ -214,7 +212,7 @@ QColor QPhongMaterial::ambient() const } /*! - \property Qt3DRender::QPhongMaterial::diffuse + \property QPhongMaterial::diffuse Holds the diffuse color. */ @@ -225,7 +223,7 @@ QColor QPhongMaterial::diffuse() const } /*! - \property Qt3DRender::QPhongMaterial::specular + \property QPhongMaterial::specular Holds the specular color. */ @@ -236,7 +234,7 @@ QColor QPhongMaterial::specular() const } /*! - \property Qt3DRender::QPhongMaterial::shininess + \property QPhongMaterial::shininess Holds the shininess exponent. */ -- cgit v1.2.3 From 8f8102f0580c14088460c23cde48ad30737ecd76 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 2 Sep 2016 12:55:16 +0300 Subject: Remove unimplemented function from QBlendEquationArguments QBlendEquationArguments::specifiesAllDrawBuffers() has no implementation, so it shouldn't exist. Change-Id: I76a73d4712572e3b1cf675b195c675a033bdc670 Reviewed-by: Paul Lemire --- src/render/renderstates/qblendequationarguments.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/render/renderstates/qblendequationarguments.h b/src/render/renderstates/qblendequationarguments.h index 8e2f86f6c..2f844b8cf 100644 --- a/src/render/renderstates/qblendequationarguments.h +++ b/src/render/renderstates/qblendequationarguments.h @@ -92,7 +92,6 @@ public: Blending sourceAlpha() const; Blending destinationAlpha() const; int bufferIndex() const; - bool specifiesAllDrawBuffers() const; public Q_SLOTS: void setSourceRgb(Blending sourceRgb); -- cgit v1.2.3 From 4bbdcc1fac6b21a6d4607c93a5f8759145248f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Wed, 31 Aug 2016 11:10:43 +0300 Subject: Silence 'no such slot' connect warning on startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add private slot for the function and use correct function name in the connect call. Change-Id: If27e3aa954ced1065fa8828efe156b6561c175ed Reviewed-by: Tomi Korpipää Reviewed-by: Paul Lemire --- src/render/frontend/qrendersettings.cpp | 4 ++-- src/render/frontend/qrendersettings.h | 1 + src/render/frontend/qrendersettings_p.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/render/frontend/qrendersettings.cpp b/src/render/frontend/qrendersettings.cpp index c15a7810c..fd0e75b4e 100644 --- a/src/render/frontend/qrendersettings.cpp +++ b/src/render/frontend/qrendersettings.cpp @@ -69,7 +69,7 @@ void QRenderSettingsPrivate::init() QObject::connect(&m_pickingSettings, SIGNAL(pickResultModeChanged(QPickingSettings::PickResultMode)), q, SLOT(_q_onPickResultModeChanged(QPickingSettings::PickResultMode))); QObject::connect(&m_pickingSettings, SIGNAL(faceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode)), - q, SLOT(_q_onFaceOrientationPickingMode(QPickingSettings::FaceOrientationPickingMode))); + q, SLOT(_q_onFaceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode))); } /*! \internal */ @@ -85,7 +85,7 @@ void QRenderSettingsPrivate::_q_onPickResultModeChanged(QPickingSettings::PickRe } /*! \internal */ -void QRenderSettingsPrivate::_q_onFaceOrientationPickingModeChanged(bool faceOrientationPickingMode) +void QRenderSettingsPrivate::_q_onFaceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode faceOrientationPickingMode) { notifyPropertyChange("faceOrientationPickingMode", faceOrientationPickingMode); } diff --git a/src/render/frontend/qrendersettings.h b/src/render/frontend/qrendersettings.h index 55fe3007a..68e8f8d7f 100644 --- a/src/render/frontend/qrendersettings.h +++ b/src/render/frontend/qrendersettings.h @@ -89,6 +89,7 @@ protected: private: Q_PRIVATE_SLOT(d_func(), void _q_onPickingMethodChanged(QPickingSettings::PickMethod)) Q_PRIVATE_SLOT(d_func(), void _q_onPickResultModeChanged(QPickingSettings::PickResultMode)) + Q_PRIVATE_SLOT(d_func(), void _q_onFaceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode)) Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE; }; diff --git a/src/render/frontend/qrendersettings_p.h b/src/render/frontend/qrendersettings_p.h index b590ada00..f05124296 100644 --- a/src/render/frontend/qrendersettings_p.h +++ b/src/render/frontend/qrendersettings_p.h @@ -72,7 +72,7 @@ public: void _q_onPickingMethodChanged(QPickingSettings::PickMethod pickMethod); void _q_onPickResultModeChanged(QPickingSettings::PickResultMode pickResultMode); - void _q_onFaceOrientationPickingModeChanged(bool faceOrientationPickingMode); + void _q_onFaceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode faceOrientationPickingMode); Q_DECLARE_PUBLIC(QRenderSettings) }; -- cgit v1.2.3 From 17b2060c1e899842be8c952afc8e0a3329178bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Fri, 2 Sep 2016 11:17:42 +0300 Subject: Update QTextureImage docs Update QTextureImage docs and add documentation for QTextureImageDataGenerator and QAbstractFunctor Change-Id: Ia2067ee5ee9283727f4f37e342068a02eda4a901 Reviewed-by: Paul Lemire --- src/render/frontend/qabstractfunctor.cpp | 36 +++++++++++++ src/render/texture/qabstracttextureimage.cpp | 41 ++++++++++++++ src/render/texture/qtextureimage.cpp | 81 ++++++++++++++++++++-------- 3 files changed, 137 insertions(+), 21 deletions(-) diff --git a/src/render/frontend/qabstractfunctor.cpp b/src/render/frontend/qabstractfunctor.cpp index f3367a2b5..817d06a27 100644 --- a/src/render/frontend/qabstractfunctor.cpp +++ b/src/render/frontend/qabstractfunctor.cpp @@ -43,8 +43,44 @@ QT_BEGIN_NAMESPACE namespace Qt3DRender { +/*! + \class Qt3DRender::QAbstractFunctor + \inmodule Qt3DRender + \since 5.7 + \brief QAbstractFunctor is an abstract base class for all functors. + + The QAbstractFunctor is used as a base class for all functors and data + generators in Qt3DRender module. + + When user defines a new functor or generator, they need to implement the + \l QAbstractFunctor::id() method, which should be done using the \c {QT3D_FUNCTOR} + macro in the class definition. + */ +/*! + \fn qintptr QAbstractFunctor::id() const + */ +/*! + \macro QT3D_FUNCTOR(Class) + \relates Qt3DRender::QAbstractFunctor + + This macro assigns functor id to the \a Class, which is used by QAbstractFunctor::functor_cast + to determine if the cast can be done. + */ + +/*! + \fn const T *QAbstractFunctor::functor_cast(const QAbstractFunctor *other) const + + This method is used to cast functor \a other to type T if the other is of + type T (or of subclass); otherwise returns 0. This method works similarly + to \l QObject::qobject_cast, except with functors derived from QAbstractFunctor. + + \warning If T was not declared with \l QT3D_FUNCTOR macro, then the results are undefined. + */ + +/*! Desctructor */ QAbstractFunctor::~QAbstractFunctor() { + } } // Qt3D diff --git a/src/render/texture/qabstracttextureimage.cpp b/src/render/texture/qabstracttextureimage.cpp index d3694efc9..42e78ced6 100644 --- a/src/render/texture/qabstracttextureimage.cpp +++ b/src/render/texture/qabstracttextureimage.cpp @@ -48,6 +48,40 @@ using namespace Qt3DCore; namespace Qt3DRender { +/*! + \class Qt3DRender::QTextureImageDataGenerator + \inmodule Qt3DRender + \since 5.7 + \brief Provides texture image data for QAbstractTextureImage + + QTextureImageDataGenerator is a data provider for QAbstractTexture. + QTextureImageDataGenerator can be used to expand Qt3D with more ways to load + texture image data as well as support user-defined formats and formats Qt3D + does not natively support. The data is returned by the QTextureImageDataPtr + which contains the data that will be loaded to the texture. + QTextureImageDataGenerator is executed by Aspect jobs in the backend. + */ +/*! + \typedef Qt3DRender::QTextureImageDataPtr + \relates Qt3DRender::QTextureImageDataGenerator + + Shared pointer to \l QTextureImageData. +*/ + +/*! + \fn QTextureImageDataPtr QTextureImageDataGenerator::operator()() + + Implement the method to return the texture image data. +*/ + +/*! + \fn bool QTextureImageDataGenerator::operator ==(const QTextureImageDataGenerator &other) const + + Implement the method to compare this texture data generator to \a other. + The operator is used to check if the \l QAbstractTextureImage needs to reload + the \l QTextureImageData. +*/ + QAbstractTextureImagePrivate::QAbstractTextureImagePrivate() : QNodePrivate(), m_mipLevel(0), @@ -89,6 +123,13 @@ QAbstractTextureImagePrivate::~QAbstractTextureImagePrivate() behavior at best if this rule is not respected. */ +/*! + \fn QTextureImageDataGeneratorPtr QAbstractTextureImage::dataGenerator() const + + Implement this method to return the \l QTextureImageDataGeneratorPtr, which will + provide the data for the texture image. +*/ + /*! Constructs a new QAbstractTextureImage instance with \a parent as parent. */ diff --git a/src/render/texture/qtextureimage.cpp b/src/render/texture/qtextureimage.cpp index dab92082a..dbe0ff05c 100644 --- a/src/render/texture/qtextureimage.cpp +++ b/src/render/texture/qtextureimage.cpp @@ -70,6 +70,59 @@ namespace Qt3DRender { image from an image source. */ +/*! + \enum QTextureImage::Status + + This enumeration specifies the status values for texture image loading. + + \value None The texture image loading has not been started yet. + \value Loading The texture image loading has started, but not finised. + \value Ready The texture image loading has finished. + \value Error The texture image loading confronted an error. +*/ + +/*! + \qmlproperty url TextureImage::source + + This property holds the source url from which data for the texture + image will be loaded. +*/ + +/*! + \qmlproperty enumeration TextureImage::status + + This property holds the status of the texture image loading. + + \list + \li TextureImage.None + \li TextureImage.Loading + \li TextureImage.Ready + \li TextureImage.Error + \endlist + \readonly +*/ + +/*! + \property QTextureImage::source + + This property holds the source url from which data for the texture + image will be loaded. +*/ + +/*! + \property QTextureImage::status + + This property holds the status of the texture image loading. + + \list + \li TextureImage.None + \li TextureImage.Loading + \li TextureImage.Ready + \li TextureImage.Error + \endlist + \readonly +*/ + /*! Constructs a new Qt3DRender::QTextureImage instance with \a parent as parent. */ @@ -93,7 +146,7 @@ QUrl QTextureImage::source() const } /*! - * \return the current status. + \return the current status. */ QTextureImage::Status QTextureImage::status() const { @@ -101,20 +154,6 @@ QTextureImage::Status QTextureImage::status() const return d->m_status; } -/*! - \property Qt3DRender::QTextureImage::source - - This property holds the source url from which data for the texture - image will be loaded. -*/ - -/*! - \qmlproperty url Qt3D.Render::TextureImage::source - - This property holds the source url from which data for the texture - image will be loaded. -*/ - /*! Sets the source url of the texture image to \a source. \note This triggers a call to update() @@ -130,8 +169,8 @@ void QTextureImage::setSource(const QUrl &source) } /*! - * Sets the status to \a status. - * \param status + Sets the status to \a status. + \param status */ void QTextureImage::setStatus(Status status) { @@ -152,8 +191,8 @@ QTextureImageDataGeneratorPtr QTextureImage::dataGenerator() const } /*! - * Sets the scene change event to \a change. - * \param change + Sets the scene change event to \a change. + \param change */ void QTextureImage::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) { @@ -164,8 +203,8 @@ void QTextureImage::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) } /*! - * The constructor creats a new QImageTextureDataFunctor::QImageTextureDataFunctor - * instance with the specified \a url. + The constructor creates a new QImageTextureDataFunctor::QImageTextureDataFunctor + instance with the specified \a url. */ QImageTextureDataFunctor::QImageTextureDataFunctor(const QUrl &url) : QTextureImageDataGenerator() -- cgit v1.2.3 From 79aeeba87d3c17b4f652423a660a213f9e2faf25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Thu, 1 Sep 2016 16:50:32 +0300 Subject: Update QEntity docs Change-Id: I4a28761474d961d39074490e12f21b3d0c7ac911 Reviewed-by: Miikka Heikkinen Reviewed-by: Paul Lemire --- src/core/nodes/qentity.cpp | 44 +++++++++++++++-------------- src/quick3d/quick3d/items/quick3dentity.cpp | 27 ++++++++++++++---- 2 files changed, 45 insertions(+), 26 deletions(-) diff --git a/src/core/nodes/qentity.cpp b/src/core/nodes/qentity.cpp index 67238ca7e..ea3523c0c 100644 --- a/src/core/nodes/qentity.cpp +++ b/src/core/nodes/qentity.cpp @@ -55,15 +55,6 @@ QT_BEGIN_NAMESPACE namespace Qt3DCore { -QEntityPrivate::QEntityPrivate() - : QNodePrivate() - , m_parentEntityId() -{} - -QEntityPrivate::~QEntityPrivate() -{ -} - /*! \class Qt3DCore::QEntity \inmodule Qt3DCore @@ -78,14 +69,25 @@ QEntityPrivate::~QEntityPrivate() backend aspect will be able to interpret and process an Entity by recognizing which components it is made up of. One aspect may decide to only process entities composed of a single Qt3DCore::QTransform component whilst - another may focus on Qt3DCore::QMouseHandler. + another may focus on Qt3DInput::QMouseHandler. \sa Qt3DCore::QComponent, Qt3DCore::QTransform -*/ + */ + +/*! \internal */ +QEntityPrivate::QEntityPrivate() + : QNodePrivate() + , m_parentEntityId() +{} + +/*! \internal */ +QEntityPrivate::~QEntityPrivate() +{ +} /*! Constructs a new Qt3DCore::QEntity instance with \a parent as parent. -*/ + */ QEntity::QEntity(QNode *parent) : QEntity(*new QEntityPrivate, parent) {} @@ -113,11 +115,11 @@ QEntity::~QEntity() \relates Qt3DCore::QEntity List of QComponent pointers. -*/ + */ /*! Returns the list of Qt3DCore::QComponent instances the entity is referencing. -*/ + */ QComponentVector QEntity::components() const { Q_D(const QEntity); @@ -129,7 +131,7 @@ QComponentVector QEntity::components() const \note If the Qt3DCore::QComponent has no parent, the Qt3DCore::QEntity will set itself as its parent thereby taking ownership of the component. -*/ + */ void QEntity::addComponent(QComponent *comp) { Q_D(QEntity); @@ -161,7 +163,7 @@ void QEntity::addComponent(QComponent *comp) /*! Removes the reference to \a comp. -*/ + */ void QEntity::removeComponent(QComponent *comp) { Q_CHECK_PTR(comp); @@ -186,7 +188,7 @@ void QEntity::removeComponent(QComponent *comp) immediate parent isn't a Qt3DCore::QEntity, this function traverses up the scene hierarchy until a parent Qt3DCore::QEntity is found. If no Qt3DCore::QEntity parent can be found, returns null. -*/ + */ QEntity *QEntity::parentEntity() const { Q_D(const QEntity); @@ -208,10 +210,10 @@ QEntity *QEntity::parentEntity() const } /*! - Returns the Qt3DCore::QNodeId id of the parent Qt3DCore::QEntity instance of the - current Qt3DCore::QEntity object. The QNodeId isNull method will return true if - there is no Qt3DCore::QEntity parent of the current Qt3DCore::QEntity in the scene - hierarchy. + Returns the Qt3DCore::QNodeId id of the parent Qt3DCore::QEntity instance of the + current Qt3DCore::QEntity object. The QNodeId isNull method will return true if + there is no Qt3DCore::QEntity parent of the current Qt3DCore::QEntity in the scene + hierarchy. */ QNodeId QEntityPrivate::parentEntityId() const { diff --git a/src/quick3d/quick3d/items/quick3dentity.cpp b/src/quick3d/quick3d/items/quick3dentity.cpp index 4eac4400e..ebc92e843 100644 --- a/src/quick3d/quick3d/items/quick3dentity.cpp +++ b/src/quick3d/quick3d/items/quick3dentity.cpp @@ -47,20 +47,37 @@ namespace Quick { /*! \qmltype Entity + \instantiates Qt3DCore::QEntity \inherits Node \inqmlmodule Qt3D.Core \since 5.5 -*/ + + \brief Entity is a \l Node subclass that can aggregate several + \l Component3D instances that will specify its behavior. + + By itself a Entity is an empty shell. The behavior of a Entity + object is defined by the \l Component3D objects it references. Each Qt3D + backend aspect will be able to interpret and process an Entity by + recognizing which components it is made up of. One aspect may decide to only + process entities composed of a single \l Transform component whilst + another may focus on \l MouseHandler. + + \sa Qt3D.Core::Component3D, Qt3D.Core::Transform + */ + +/*! + \qmlproperty list Entity::components + Holds the list of \l Component3D instances, which define the behavior + of the entity. + \readonly + */ Quick3DEntity::Quick3DEntity(QObject *parent) : QObject(parent) { } -/*! - \qmlproperty list Qt3DCore::Entity::components - \readonly -*/ + QQmlListProperty Quick3DEntity::componentList() { return QQmlListProperty(this, 0, -- cgit v1.2.3 From 4d4c7b617276446e87d05e97a1bcedb9e461d26d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Fri, 2 Sep 2016 12:33:50 +0300 Subject: Update QRenderSurfaceSelector docs Change-Id: I8022413e6d6b7bcda469a7a5ec569f7af0cefd1f Reviewed-by: Miikka Heikkinen Reviewed-by: Paul Lemire --- src/render/framegraph/qrendersurfaceselector.cpp | 92 +++++++++++++++--------- 1 file changed, 59 insertions(+), 33 deletions(-) diff --git a/src/render/framegraph/qrendersurfaceselector.cpp b/src/render/framegraph/qrendersurfaceselector.cpp index e76963e72..27d06e264 100644 --- a/src/render/framegraph/qrendersurfaceselector.cpp +++ b/src/render/framegraph/qrendersurfaceselector.cpp @@ -52,43 +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 - * + \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 - * + \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() @@ -136,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) @@ -144,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) @@ -178,9 +205,8 @@ QObject *QRenderSurfaceSelector::surface() const return surfaceObj; } -/*! \property QRenderSurfaceSelector::surface - * - * Sets \a surface. +/*! + Sets \a surfaceObject. */ void QRenderSurfaceSelector::setSurface(QObject *surfaceObject) { @@ -197,7 +223,7 @@ void QRenderSurfaceSelector::setSurface(QObject *surfaceObject) surface = static_cast(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) @@ -286,8 +312,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) { -- cgit v1.2.3 From 69f8f117912af25f5ac513de8627738d9c9dc1b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Fri, 2 Sep 2016 13:29:16 +0300 Subject: Update QLayerFilter docs Change-Id: I4715d22a583f16444ea9f35c6f9352d53e63f114 Reviewed-by: Paul Lemire Reviewed-by: Miikka Heikkinen --- src/render/framegraph/qlayerfilter.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) 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 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 QLayerFilter::layers() const { -- cgit v1.2.3 From 929d45716e3347c06c0e84c6a49e3801d0b65550 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 5 Sep 2016 10:40:10 +0300 Subject: Remove excess slashes from include statements Change-Id: I64f815587947ad2f63462bb38027c533c7aa4bdc Reviewed-by: Paul Lemire --- examples/qt3d/simple-cpp/main.cpp | 4 ++-- tests/manual/bigscene-cpp/main.cpp | 2 +- tests/manual/deferred-renderer-cpp/main.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 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 #include -#include -#include +#include +#include #include #include #include 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 #include #include -#include +#include #include #include #include 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 #include -#include -#include +#include +#include #include #include #include -- cgit v1.2.3 From d323d7e733100dc2417ae90bdebd4d4704606ead Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 2 Sep 2016 13:00:35 +0300 Subject: Fix camera controllers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed a few bugs and inconsistencies between qml and c++ implementations of the camera controllers. Also documented them. Task-number: QTBUG-55697 Change-Id: Ie490b0ca46f60a2a34c04f91572505e908ce65ba Reviewed-by: Antti Määttä Reviewed-by: Paul Lemire --- src/doc/src/qmlextracontrollers.qdoc | 170 +++++++++++++++++++++ .../defaults/qfirstpersoncameracontroller.cpp | 54 ++++++- src/extras/defaults/qorbitcameracontroller.cpp | 68 ++++++++- src/extras/defaults/qorbitcameracontroller.h | 1 - .../extras/defaults/qml/OrbitCameraController.qml | 18 +-- 5 files changed, 295 insertions(+), 16 deletions(-) create mode 100644 src/doc/src/qmlextracontrollers.qdoc 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 0e1af51b3..973566a3c 100644 --- a/src/extras/defaults/qfirstpersoncameracontroller.cpp +++ b/src/extras/defaults/qfirstpersoncameracontroller.cpp @@ -184,12 +184,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) { @@ -201,18 +234,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/qorbitcameracontroller.cpp b/src/extras/defaults/qorbitcameracontroller.cpp index deeec7f0d..d8f468ed0 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() @@ -214,8 +251,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 @@ -254,24 +291,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/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml b/src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml index 328b7b98e..1f5fa5a7a 100644 --- a/src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml +++ b/src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml @@ -162,13 +162,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 { @@ -176,12 +176,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 @@ -205,8 +205,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); @@ -220,14 +220,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)); } } } -- cgit v1.2.3 From 0febc2e9be299475e72c4cd348e830cb267ece95 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 5 Sep 2016 11:26:26 +0300 Subject: Fix QForwardRenderer docs Change-Id: Ic9fcfa41caa8773a1fa12fa42c6345292ae6160e Reviewed-by: Paul Lemire --- src/extras/defaults/qforwardrenderer.cpp | 99 ++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 29 deletions(-) diff --git a/src/extras/defaults/qforwardrenderer.cpp b/src/extras/defaults/qforwardrenderer.cpp index 8e6dc9425..32c4a2968 100644 --- a/src/extras/defaults/qforwardrenderer.cpp +++ b/src/extras/defaults/qforwardrenderer.cpp @@ -84,26 +84,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) { @@ -115,9 +135,6 @@ QForwardRenderer::QForwardRenderer(QNode *parent) d->init(); } -/*! - Destroys the QForwardRenderer instance. -*/ QForwardRenderer::~QForwardRenderer() { } @@ -134,11 +151,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); @@ -152,10 +164,15 @@ void QForwardRenderer::setSurface(QObject *surface) } /*! - \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); @@ -163,9 +180,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 { @@ -174,9 +198,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. */ @@ -186,6 +217,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); -- cgit v1.2.3 From 6eecb253c0a9a5d0c1eaaa031e38d24e3bb5f447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Thu, 1 Sep 2016 12:48:22 +0300 Subject: Update QViewport docs Change-Id: I9a81ddc741af8fb0f1126b431763ccf7a1f07e3a Reviewed-by: Miikka Heikkinen Reviewed-by: Paul Lemire --- src/render/framegraph/qviewport.cpp | 54 ++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 22 deletions(-) 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); -- cgit v1.2.3 From 4cf4e0a1be90e6c7861d7f70c109082555b45455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Thu, 1 Sep 2016 13:15:24 +0300 Subject: Update QSceneLoader docs Change-Id: Idb4210e9d455c9b8c87a6540d486992531778c0e Reviewed-by: Miikka Heikkinen Reviewed-by: Paul Lemire --- src/render/io/qsceneloader.cpp | 130 ++++++++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 54 deletions(-) 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); -- cgit v1.2.3 From 54817963613f5ac81767a6feebc8caf34a901196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Thu, 1 Sep 2016 14:25:39 +0300 Subject: Update QCameraLens docs Change-Id: I3e2cd85d5c85b066fdcf7793adbc969092fc7736 Reviewed-by: Miikka Heikkinen Reviewed-by: Paul Lemire --- src/render/frontend/qcameralens.cpp | 287 ++++++++++++++++++++---------------- 1 file changed, 162 insertions(+), 125 deletions(-) diff --git a/src/render/frontend/qcameralens.cpp b/src/render/frontend/qcameralens.cpp index 8c730c763..3073fbc3f 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 Qt3DCore + * + * \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.Core + * \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) { @@ -88,17 +239,6 @@ QCameraLens::QCameraLens(QCameraLensPrivate &dd, QNode *parent) d->updateOrthographicProjection(); } -/*! - * \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. * @@ -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 -- cgit v1.2.3 From 75ff2892bcaaf586856d28524fd461c2eaee5314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Fri, 2 Sep 2016 14:18:52 +0300 Subject: Update QFrameGraphNode docs Change-Id: I3d974b7ab1f5e0b829b139c71a1469fe35dd5ec1 Reviewed-by: Miikka Heikkinen Reviewed-by: Paul Lemire --- src/render/framegraph/qframegraphnode.cpp | 109 +++++++++++++++++++++++++++--- 1 file changed, 99 insertions(+), 10 deletions(-) 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 { -- cgit v1.2.3 From 62870fd336b04e210d1ac5b7a8e5d653c04512c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Fri, 2 Sep 2016 14:38:07 +0300 Subject: Update QSortPolicy docs Change-Id: I28f5d587d81b8c6f2263b68325847872df40e0c3 Reviewed-by: Miikka Heikkinen Reviewed-by: Paul Lemire --- src/render/framegraph/qsortpolicy.cpp | 63 ++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 26 deletions(-) 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::sortTypes() const { -- cgit v1.2.3 From d804e3026c7e1517ee2dffdabaa7ed31c5d8e629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Fri, 2 Sep 2016 14:56:36 +0300 Subject: Update QCameraSelector docs Change-Id: I349f40e488465a147970f1d52696cf1fa9e22063 Reviewed-by: Miikka Heikkinen Reviewed-by: Paul Lemire --- src/render/framegraph/qcameraselector.cpp | 38 +++++++++++++++++++------------ 1 file changed, 24 insertions(+), 14 deletions(-) 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); -- cgit v1.2.3 From 9c1e382ac01208699d31fa838ba253a42938566f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Mon, 5 Sep 2016 10:24:14 +0300 Subject: Update QFrameAction docs Change-Id: I4bcde9ed1e1ab8a9d127dd1d4c75d30f8c342641 Reviewed-by: Paul Lemire Reviewed-by: Miikka Heikkinen --- src/logic/qframeaction.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) 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 -- cgit v1.2.3 From 0dc1fb59a1f8716dd51e046d5b375468a51f907c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Mon, 5 Sep 2016 10:48:55 +0300 Subject: Update QMouseDevice docs Change-Id: I6739fb95ed549fa02e9308d89e695f028fec4ed7 Reviewed-by: Paul Lemire --- src/input/frontend/qmousedevice.cpp | 63 +++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/src/input/frontend/qmousedevice.cpp b/src/input/frontend/qmousedevice.cpp index d0ae0317d..bbf42b793 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 */ /*! @@ -87,6 +95,20 @@ QMouseDevicePrivate::QMouseDevicePrivate() \sa Qt3DInput::QAnalogAxisInput::setAxis */ +/*! + \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. */ @@ -158,11 +180,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); -- cgit v1.2.3 From c40d48102f853788f079c036beb7eb7113472a01 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 5 Sep 2016 12:20:54 +0300 Subject: Improve QInputSettings docs Change-Id: I583cca3c0af117b97465f84190663908877d51b0 Reviewed-by: Paul Lemire --- src/input/frontend/qinputsettings.cpp | 56 ++++++++++++++--------------------- 1 file changed, 22 insertions(+), 34 deletions(-) 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); -- cgit v1.2.3 From 9b47f02d9cdd720e937ac22296f4873f6bc66c6b Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 5 Sep 2016 13:28:33 +0300 Subject: Update QEffect docs Change-Id: I9266413eec2e23457198016cc63be8aaebab3db0 Reviewed-by: Paul Lemire --- src/render/materialsystem/qeffect.cpp | 40 +++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 11 deletions(-) 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() { } @@ -94,9 +99,22 @@ QEffect::QEffect(QEffectPrivate &dd, QNode *parent) { } +/*! + \qmlproperty list Effect::techniques + + Holds the list of techniques used by this effect. +*/ +/*! + \qmlproperty list 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) { -- cgit v1.2.3 From 27c1f0e1b2a873ecdef1b0c74ca416d6794e7a06 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 2 Sep 2016 16:23:36 +0300 Subject: Fix documentation of QRenderSettings and QPickingSettings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-55697 Change-Id: I7a357f6f00b62c1ef2042f4088374dcd34005110 Reviewed-by: Antti Määttä Reviewed-by: Paul Lemire --- src/render/frontend/qpickingsettings.cpp | 89 +++++++++++++++++++---------- src/render/frontend/qrendersettings.cpp | 96 ++++++++++++++++++++++++-------- 2 files changed, 133 insertions(+), 52 deletions(-) diff --git a/src/render/frontend/qpickingsettings.cpp b/src/render/frontend/qpickingsettings.cpp index 0e152f5f1..e1c403ba3 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() @@ -60,11 +73,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) { @@ -81,18 +89,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); @@ -102,16 +104,31 @@ QPickingSettings::PickResultMode QPickingSettings::pickResultMode() const /*! * \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); @@ -125,16 +142,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 715c9cc5e..d9ce3c3c9 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 */ @@ -82,11 +101,6 @@ void QRenderSettingsPrivate::_q_onPickResultModeChanged(QPickingSettings::PickRe notifyPropertyChange("pickResultMode", pickResultMode); } -/*! - * The constructor creates a new QRenderSettings::QRenderSettings instance with the - * specified \a parent. - * \param parent - */ QRenderSettings::QRenderSettings(Qt3DCore::QNode *parent) : QRenderSettings(*new QRenderSettingsPrivate, parent) {} @@ -104,8 +118,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); @@ -113,27 +138,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); @@ -155,10 +209,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); -- cgit v1.2.3 From 2f0dd9a147d74bb5df58c6f402b50b35313ae3ff Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 5 Sep 2016 14:02:03 +0300 Subject: Update QFilterKey docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id6bb471e11de2bf8b33cec603d382f079d0b0e79 Reviewed-by: Antti Määttä Reviewed-by: Paul Lemire --- src/render/materialsystem/qfilterkey.cpp | 40 +++++++++++++++++++------------- 1 file changed, 24 insertions(+), 16 deletions(-) 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 { -- cgit v1.2.3 From 40fbc1c8e31c3ce10264763f2e9340b789d32563 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 5 Sep 2016 14:39:33 +0300 Subject: Update QShaderProgram docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I733333e6c707d590218fd5b19722e08908e52b49 Reviewed-by: Antti Määttä Reviewed-by: Paul Lemire --- src/render/materialsystem/qshaderprogram.cpp | 139 ++++++++++++++------------- 1 file changed, 74 insertions(+), 65 deletions(-) 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 /*! - * \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 -- cgit v1.2.3 From d41e6f9640c28d85fb5ade26a1a7f91406f6aa9e Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 5 Sep 2016 16:24:13 +0300 Subject: Update QMaterial docs Change-Id: Ib1e5304f96f1d39615102f72584f54dba2586e6c Reviewed-by: Paul Lemire --- src/render/materialsystem/qmaterial.cpp | 80 +++++++++++++++++---------------- 1 file changed, 42 insertions(+), 38 deletions(-) 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 /*! - * \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 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 QMaterial::parameters() const { -- cgit v1.2.3 From c576d9f2ef0ddbab6159d969105c54a9183cfd21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Mon, 5 Sep 2016 14:58:23 +0300 Subject: Update QTechnique docs Change-Id: I5345954047540ef1d03ba42841bfca221cc35b7e Reviewed-by: Miikka Heikkinen Reviewed-by: Paul Lemire --- src/render/materialsystem/qtechnique.cpp | 90 +++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 31 deletions(-) diff --git a/src/render/materialsystem/qtechnique.cpp b/src/render/materialsystem/qtechnique.cpp index f114e2754..768397e76 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 Qt3D.Render::Technique::filterKeys + Specifies the list of filter keys enabling this technique +*/ +/*! + \qmlproperty list Qt3D.Render::Technique::renderPasses + Specifies the render passes used by the tehcnique +*/ +/*! + \qmlproperty list 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 QTechnique::filterKeys() const { @@ -167,7 +204,7 @@ QVector 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,7 +277,7 @@ void QTechnique::addRenderPass(QRenderPass *pass) } /*! - * Removes a \a pass from the technique. + Removes a \a pass from the technique. */ void QTechnique::removeRenderPass(QRenderPass *pass) { @@ -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 QTechnique::renderPasses() const { @@ -266,7 +303,7 @@ QVector QTechnique::renderPasses() const } /*! - * Returns a vector of the techniques current parameters + Returns a vector of the techniques current parameters */ QVector QTechnique::parameters() const { @@ -274,15 +311,6 @@ QVector 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); -- cgit v1.2.3 From 0c7e6a3904624e80e53c15c3ecffac8eb96cdfab Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Fri, 12 Aug 2016 09:04:06 +0200 Subject: ShaderData: refactoring Only store the original properties (does not store transformed values anymore as these can change on a per thread basis and lead to races in the ShaderData). Instead introduce a method to check if a property needs to be transformed and a method which given a viewMatrix returns the transformed value. This can then be used concurrently by each UniformBlockValueBuilder without introducing races. Also since building UBO from a ShaderData has been disabled since 5.7, remove all the nested ShaderData update logic. Unit tests updated. Change-Id: Id0e5956b9f7d93f8d019c3d8999268fc3ad68e79 Task-number: QTBUG-54818 Reviewed-by: Kevin Ottens --- src/render/backend/renderview.cpp | 9 +- src/render/jobs/renderviewjobutils.cpp | 17 +- src/render/jobs/renderviewjobutils_p.h | 5 +- src/render/materialsystem/shaderdata.cpp | 173 +++++++-------------- src/render/materialsystem/shaderdata_p.h | 24 +-- .../render/renderviewutils/tst_renderviewutils.cpp | 44 ++++++ 6 files changed, 132 insertions(+), 140 deletions(-) diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp index 9226f8fac..64f8bacca 100644 --- a/src/render/backend/renderview.cpp +++ b/src/render/backend/renderview.cpp @@ -654,10 +654,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 @@ -802,6 +800,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/jobs/renderviewjobutils.cpp b/src/render/jobs/renderviewjobutils.cpp index f81615959..760e931dd 100644 --- a/src/render/jobs/renderviewjobutils.cpp +++ b/src/render/jobs/renderviewjobutils.cpp @@ -428,7 +428,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 @@ -461,20 +461,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->isPropertyToBeTransformed(qmlPropertyName)) + 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 &properties = updatedPropertiesOnly ? rShaderData->updatedProperties() : rShaderData->properties(); + const QHash &properties = rShaderData->properties(); QHash::const_iterator it = properties.begin(); const QHash::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 7f70690d7..fa133ef4c 100644 --- a/src/render/jobs/renderviewjobutils_p.h +++ b/src/render/jobs/renderviewjobutils_p.h @@ -55,6 +55,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -157,7 +158,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, @@ -168,6 +170,7 @@ struct Q_AUTOTEST_EXPORT UniformBlockValueBuilder QHash uniforms; UniformBlockValueBuilderHash activeUniformNamesToValue; ShaderDataManager *shaderDataManager; + QMatrix4x4 viewMatrix; }; } // namespace Render diff --git a/src/render/materialsystem/shaderdata.cpp b/src/render/materialsystem/shaderdata.cpp index 1f68bed13..d6873e7dc 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 so that we can @@ -108,14 +107,15 @@ void ShaderData::initializeFromPeer(const QNodeCreatedChangeBasePtr &change) } } - // We look for transformed properties - QHash::iterator it = m_properties.begin(); - const QHash::iterator end = m_properties.end(); + // We look for transformed properties once the complete hash of + // originalProperties is available + QHash::iterator it = m_originalProperties.begin(); + const QHash::iterator end = m_originalProperties.end(); while (it != end) { if (static_cast(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(value.toInt())); @@ -138,38 +138,39 @@ ShaderData *ShaderData::lookupResource(QNodeId id) // Call by cleanup job (single thread) void ShaderData::clearUpdatedProperties() { - m_updatedProperties.clear(); - const QHash::const_iterator end = m_nestedShaderDataProperties.end(); - QHash::const_iterator it = m_nestedShaderDataProperties.begin(); - - while (it != end) { - if (it.value().userType() == QMetaType::QVariantList) { - const auto values = it.value().value(); - for (const QVariant &v : values) { - ShaderData *nested = lookupResource(v.value()); - if (nested != nullptr) - nested->clearUpdatedProperties(); - } - } else { - ShaderData *nested = lookupResource(it.value().value()); - if (nested != nullptr) - nested->clearUpdatedProperties(); - } - ++it; - } + // DISABLED: Is only useful when building UBO from a ShaderData, which is disable since 5.7 + // const QHash::const_iterator end = m_nestedShaderDataProperties.end(); + // QHash::const_iterator it = m_nestedShaderDataProperties.begin(); + + // while (it != end) { + // if (it.value().userType() == QMetaType::QVariantList) { + // const auto values = it.value().value(); + // for (const QVariant &v : values) { + // ShaderData *nested = lookupResource(v.value()); + // if (nested != nullptr) + // nested->clearUpdatedProperties(); + // } + // } else { + // ShaderData *nested = lookupResource(it.value().value()); + // 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. @@ -179,94 +180,38 @@ void ShaderData::cleanup(NodeManagers *managers) \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) -{ - // 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::const_iterator transformedEnd = m_transformedProperties.end(); - QHash::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()); - m_properties.insert(transformedIt.key(), m_viewMatrix * m_worldMatrix * m_originalProperties.value(transformedIt.key()).value()); - } - ++transformedIt; - } - } - const QHash::const_iterator end = m_nestedShaderDataProperties.end(); - QHash::const_iterator it = m_nestedShaderDataProperties.begin(); +bool ShaderData::isPropertyToBeTransformed(const QString &name) const +{ + return m_transformedProperties.contains(name); +} - while (it != end) { - const int userType = it.value().userType(); - - if (userType == QMetaType::QVariantList) { - QVariantList updatedNodes; - bool nestedNeedsUpdate = false; - const QVariantList values = variant_value(it.value()); - for (const QVariant &v : values) { - if (v.userType() != qNodeIdTypeId) - continue; - - const Qt3DCore::QNodeId nestedId = variant_value(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(it.value()); - ShaderData *nested = lookupResource(nestedId); - if (nested != nullptr && nested->updateViewTransform(viewMatrix)) - m_updatedProperties.insert(it.key(), it.value()); +QVariant ShaderData::getTransformedProperty(const QString &name, const QMatrix4x4 &viewMatrix) +{ + // 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()); + case ModelToWorld: + return QVariant::fromValue(m_worldMatrix * m_originalProperties.value(it.key()).value()); + case ModelToWorldDirection: + return QVariant::fromValue((m_worldMatrix * QVector4D(m_originalProperties.value(it.key()).value(), 0.0f)).toVector3D()); } - ++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::const_iterator transformedEnd = m_transformedProperties.end(); - QHash::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()); - m_properties.insert(transformedIt.key(), m_viewMatrix * m_worldMatrix * m_originalProperties.value(transformedIt.key()).value()); - } else if (transformedIt.value() == ModelToWorldDirection) { - auto localDirection = QVector4D(m_originalProperties.value(transformedIt.key()).value(), 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()); - m_properties.insert(transformedIt.key(), m_worldMatrix * m_originalProperties.value(transformedIt.key()).value()); - } - ++transformedIt; - } } - return m_updatedProperties.size() > 0; } // This will add the ShaderData to be cleared from updates at the end of the frame @@ -297,19 +242,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(); - else - propertyValue = m_worldMatrix * propertyValue.value(); - } - 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..90568eaea 100644 --- a/src/render/materialsystem/shaderdata_p.h +++ b/src/render/materialsystem/shaderdata_p.h @@ -79,15 +79,16 @@ public: ShaderData(); ~ShaderData(); - QHash properties() const { return m_properties; } - QHash updatedProperties() const { return m_updatedProperties; } + QHash 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); + + bool isPropertyToBeTransformed(const QString &name) const; + QVariant getTransformedProperty(const QString &name, const QMatrix4x4 &viewMatrix); // Called by FrameCleanupJob static void cleanup(NodeManagers *managers); @@ -98,17 +99,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 m_originalProperties; - // 1 to 1 match with frontend properties apart from Transformed - // properties which contain the matrices product - QHash m_properties; - // only updated properties, Transformed properties have the same - // value as in m_properties - QHash m_updatedProperties; - PropertyReaderInterfacePtr m_propertyReader; + + // Contains properties thar are of type ShaderData QHash m_nestedShaderDataProperties; + + // Contains property that are defined like: postionTransformed: ModelToEye QHash m_transformedProperties; + + QMutex m_mutex; static QVector m_updatedShaderData; QMatrix4x4 m_worldMatrix; diff --git a/tests/auto/render/renderviewutils/tst_renderviewutils.cpp b/tests/auto/render/renderviewutils/tst_renderviewutils.cpp index df68a61d4..b3ef1ba74 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,49 @@ void tst_RenderViewUtils::topLevelDynamicProperties() shaderData->property("array")); } +void tst_RenderViewUtils::transformedProperties() +{ + // GIVEN + QScopedPointer shaderData(new Qt3DRender::QShaderData()); + QScopedPointer 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); + QVERIFY(!backendShaderData->isPropertyToBeTransformed(QStringLiteral("position0"))); + QVERIFY(backendShaderData->isPropertyToBeTransformed(QStringLiteral("position1"))); + QVERIFY(backendShaderData->isPropertyToBeTransformed(QStringLiteral("position2"))); + QVERIFY(backendShaderData->isPropertyToBeTransformed(QStringLiteral("position3"))); + + // WHEN + backendShaderData->updateWorldTransform(worldMatrix); + const QVector3D position1Value = backendShaderData->getTransformedProperty(QStringLiteral("position1"), viewMatrix).value(); + const QVector3D position2Value = backendShaderData->getTransformedProperty(QStringLiteral("position2"), viewMatrix).value(); + const QVector3D position3Value = backendShaderData->getTransformedProperty(QStringLiteral("position3"), viewMatrix).value(); + + // THEN + QCOMPARE(position1Value, viewMatrix * worldMatrix * position); + QCOMPARE(position2Value, worldMatrix * position); + QCOMPARE(position3Value, (worldMatrix * QVector4D(position, 0.0f)).toVector3D()); +} + void tst_RenderViewUtils::shouldNotifyDynamicPropertyChanges() { // GIVEN -- cgit v1.2.3 From 88ca1827cf6532b0e8d4fbacb4bc87a515c2cff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Mon, 5 Sep 2016 14:31:17 +0300 Subject: Update QRenderPass docs Change-Id: I62bcba620c3d222fc6d26151b21c0de1e196fc8d Reviewed-by: Paul Lemire --- src/render/materialsystem/qrenderpass.cpp | 112 +++++++++++++++++++----------- src/render/materialsystem/qrenderpass.h | 4 +- 2 files changed, 75 insertions(+), 41 deletions(-) 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 Qt3D.Render::RenderPass::filterKeys + Holds the filter keys enabling the use of this render pass. +*/ +/*! + \qmlproperty list Qt3D.Render::RenderPass::renderStates + Holds the render states used by the render pass. +*/ +/*! + \qmlproperty list 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 QRenderPass::filterKeys() const { @@ -200,12 +234,12 @@ QVector 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 QRenderPass::renderStates() const { @@ -256,7 +290,7 @@ QVector 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 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 filterKeys() const; void addRenderState(QRenderState *state); -- cgit v1.2.3 From 7141de3a5ae94d422385846a047b9fe8dcee00a2 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Sun, 21 Feb 2016 10:49:08 +0000 Subject: Add UniformValue class Provides a generic container for Uniform values that will allow to replace QVariant in the backend and make processing therefore much faster. Change-Id: I689d8505594732e786a66a76cea71b2528563df6 Reviewed-by: Sean Harmer --- src/render/backend/render-backend.pri | 6 +- src/render/backend/uniform.cpp | 164 +++++++++++++++++++++++++++ src/render/backend/uniform_p.h | 206 ++++++++++++++++++++++++++++++++++ 3 files changed, 374 insertions(+), 2 deletions(-) create mode 100644 src/render/backend/uniform.cpp create mode 100644 src/render/backend/uniform_p.h diff --git a/src/render/backend/render-backend.pri b/src/render/backend/render-backend.pri index 256cba78e..0d7d9e57e 100644 --- a/src/render/backend/render-backend.pri +++ b/src/render/backend/render-backend.pri @@ -36,7 +36,8 @@ HEADERS += \ $$PWD/stringtoint_p.h \ $$PWD/backendnode_p.h \ $$PWD/rendertargetoutput_p.h \ - $$PWD/commandexecuter_p.h + $$PWD/commandexecuter_p.h \ + $$PWD/uniform_p.h SOURCES += \ $$PWD/renderthread.cpp \ @@ -66,5 +67,6 @@ SOURCES += \ $$PWD/rendertargetoutput.cpp \ $$PWD/attachmentpack.cpp \ $$PWD/commandexecuter.cpp \ - $$PWD/openglvertexarrayobject.cpp + $$PWD/openglvertexarrayobject.cpp \ + $$PWD/uniform.cpp diff --git a/src/render/backend/uniform.cpp b/src/render/backend/uniform.cpp new file mode 100644 index 000000000..3bc1f78ce --- /dev/null +++ b/src/render/backend/uniform.cpp @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +** 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$ +** +****************************************************************************/ + +#include "uniform_p.h" + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { +namespace Render { + +namespace { + +const int qNodeIdTypeId = qMetaTypeId(); + +} + +UniformValue UniformValue::fromVariant(const QVariant &variant) +{ + // Texture/Buffer case + if (variant.userType() == qNodeIdTypeId) + return UniformValue(variant.value()); + + UniformValue v; + switch (variant.userType()) { + case QMetaType::Bool: + v.m_data.ivec[0] = variant.toBool(); + break; + case QMetaType::Int: + case QMetaType::UInt: + case QMetaType::Long: + case QMetaType::LongLong: + case QMetaType::Short: + case QMetaType::ULong: + case QMetaType::ULongLong: + case QMetaType::UShort: + case QMetaType::Char: + case QMetaType::UChar: + v.m_data.ivec[0] = variant.toInt(); + break; + case QMetaType::Float: + case QMetaType::Double: // Convert double to floats + v.m_data.fvec[0] = variant.toFloat(); + break; + case QMetaType::QPoint: { + const QPoint p = variant.toPoint(); + v.m_data.ivec[0] = p.x(); + v.m_data.ivec[1] = p.y(); + break; + } + case QMetaType::QSize: { + const QSize s = variant.toSize(); + v.m_data.ivec[0] = s.width(); + v.m_data.ivec[1] = s.height(); + break; + } + case QMetaType::QRect: { + const QRect r = variant.toRect(); + v.m_data.ivec[0] = r.x(); + v.m_data.ivec[1] = r.y(); + v.m_data.ivec[2] = r.width(); + v.m_data.ivec[3] = r.height(); + break; + } + case QMetaType::QSizeF: { + const QSizeF s = variant.toSize(); + v.m_data.fvec[0] = s.width(); + v.m_data.fvec[1] = s.height(); + break; + } + case QMetaType::QPointF: { + const QPointF p = variant.toPointF(); + v.m_data.fvec[0] = p.x(); + v.m_data.fvec[1] = p.y(); + break; + } + case QMetaType::QRectF: { + const QRectF r = variant.toRect(); + v.m_data.fvec[0] = r.x(); + v.m_data.fvec[1] = r.y(); + v.m_data.fvec[2] = r.width(); + v.m_data.fvec[3] = r.height(); + break; + } + case QMetaType::QVector2D: { + const QVector2D vec2 = variant.value(); + v.m_data.fvec[0] = vec2.x(); + v.m_data.fvec[1] = vec2.y(); + break; + } + case QMetaType::QVector3D: { + const QVector3D vec3 = variant.value(); + v.m_data.fvec[0] = vec3.x(); + v.m_data.fvec[1] = vec3.y(); + v.m_data.fvec[2] = vec3.z(); + break; + } + case QMetaType::QVector4D: { + const QVector4D vec4 = variant.value(); + v.m_data.fvec[0] = vec4.x(); + v.m_data.fvec[1] = vec4.y(); + v.m_data.fvec[2] = vec4.z(); + v.m_data.fvec[3] = vec4.w(); + break; + } + case QMetaType::QColor: { + const QColor col = variant.value(); + v.m_data.fvec[0] = col.redF(); + v.m_data.fvec[1] = col.greenF(); + v.m_data.fvec[2] = col.blueF(); + v.m_data.fvec[3] = col.alphaF(); + break; + } + case QMetaType::QMatrix4x4: { + const QMatrix4x4 mat44 = variant.value(); + // Use constData because we want column-major layout + memcpy(v.data(), mat44.constData(), sizeof(16 * sizeof(float))); + break; + } + default: + Q_UNREACHABLE(); + } + return v; +} + +} // namespace Render +} // namespace Qt3DRender + +QT_END_NAMESPACE diff --git a/src/render/backend/uniform_p.h b/src/render/backend/uniform_p.h new file mode 100644 index 000000000..175f863bd --- /dev/null +++ b/src/render/backend/uniform_p.h @@ -0,0 +1,206 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +** 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$ +** +****************************************************************************/ + +#ifndef QT3DRENDER_RENDER_UNIFORM_P_H +#define QT3DRENDER_RENDER_UNIFORM_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +#include +#include +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { +namespace Render { + +enum UniformType { + Float = 0, + Vec2, + Vec3, + Vec4, + Double, + DVec2, + DVec3, + DVec4, + Int, + IVec2, + IVec3, + IVec4, + UInt, + UIVec2, + UIVec3, + UIVec4, + Bool, + BVec2, + BVec3, + BVec4, + Mat2, + Mat3, + Mat4, + Mat2x3, + Mat3x2, + Mat2x4, + Mat4x2, + Mat3x4, + Mat4x3, + Sampler, + Unknown +}; + +class Q_AUTOTEST_EXPORT UniformValue +{ +public: + enum ValueType { + ScalarValue, + NodeId, + TextureValue, + BufferValue + }; + + struct Texture { + int textureId = 0; // Set first so that glUniform1iv will work + Qt3DCore::QNodeId nodeId; + }; + + // UniformValue implicitely converts doubles to floats to ensure + // correct rendering behavior for the cases where Qt3D parameters created from + // a double or QVariant(double) are used to fill uniform values that in reality + // should be floats. This occur especially with QML where qreal might be double + // and not float. Otherwise, at when filling the uniforms, calling constData + // on something that contains a double will result in wrong values + + UniformValue() {} + UniformValue(int i) { m_data.ivec[0] = i; } + UniformValue(uint i) { m_data.ivec[0] = i; } + UniformValue(float f) { m_data.fvec[0] = f; } + UniformValue(double d) { m_data.fvec[0] = d; } // Double to float conversion + UniformValue(bool b) { m_data.ivec[0] = b; } + UniformValue(const QVector2D &vec2) { memcpy(&m_data, &vec2, sizeof(QVector2D)); } + UniformValue(const QVector3D &vec3) { memcpy(&m_data, &vec3, sizeof(QVector3D)); } + UniformValue(const QVector4D &vec4) { memcpy(&m_data, &vec4, sizeof(QVector4D)); } + + UniformValue(const QMatrix3x3 &mat33) + { + // Use constData because we want column-major layout + memcpy(&m_data, mat33.constData(), 9 * sizeof(float)); + } + + UniformValue(const QMatrix4x4 &mat44) + { + // Use constData because we want column-major layout + memcpy(&m_data, mat44.constData(), 16 * sizeof(float)); + } + + // For nodes which will later be replaced by a Texture or Buffer + UniformValue(Qt3DCore::QNodeId id) + { + m_valueType = NodeId; + memcpy(&m_data, &id, sizeof(Qt3DCore::QNodeId)); + } + + // For textures + UniformValue(UniformValue::Texture t) + { + m_valueType = TextureValue; + memcpy(&m_data, &t, sizeof(Texture)); + } + + ValueType valueType() const { return m_valueType; } + + static UniformValue fromVariant(const QVariant &variant); + + template + const T *constData() const + { + return reinterpret_cast(&m_data); + } + + template + T *data() + { + return reinterpret_cast(&m_data); + } + + bool operator==(const UniformValue &other) const + { + return memcmp(&m_data, &other.m_data, sizeof(u_Uniform)) == 0; + } + + bool operator!=(const UniformValue &other) const + { + return !(*this == other); + } +private: + union u_Uniform { + int ivec[4]; // store uint/ints/bools + float fvec[16]; // for matrix4 (note: we could have a special case for matrices) + + u_Uniform() + { + memset(this, 0, sizeof(u_Uniform)); + } + } m_data; + + ValueType m_valueType = ScalarValue; +}; + +} // namespace Render +} // namespace Qt3DRender + +QT_END_NAMESPACE + +#endif // QT3DRENDER_RENDER_UNIFORM_P_H -- cgit v1.2.3 From 447bc4a541010bb6f37bdfc6a3c1bbf700b93d3b Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Fri, 26 Aug 2016 09:31:40 +0200 Subject: LoadSceneJob: set the status after the subtree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I826e599bf188162eaa4b2bed1ce34741192d05b9 Reviewed-by: Tomi Korpipää Reviewed-by: Sean Harmer Reviewed-by: Kevin Ottens --- src/render/jobs/loadscenejob.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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 -- cgit v1.2.3 From c8531f512eda3074aa66d8a5c7f9525b3be7f75d Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Fri, 26 Aug 2016 10:25:01 +0200 Subject: Add unit tests for LoadSceneJob Change-Id: I6a570f16a303277b8305b36bef805991680ae1ea Reviewed-by: Sean Harmer --- tests/auto/render/loadscenejob/loadscenejob.pro | 12 + .../auto/render/loadscenejob/tst_loadscenejob.cpp | 287 +++++++++++++++++++++ tests/auto/render/render.pro | 3 +- 3 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 tests/auto/render/loadscenejob/loadscenejob.pro create mode 100644 tests/auto/render/loadscenejob/tst_loadscenejob.cpp 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 +** 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 +#include +#include +#include +#include +#include +#include +#include +#include +#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() << &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() << &fakeHandler); + loadSceneJob.run(); + + // THEN + QCOMPARE(arbiter.events.count(), 4); + auto change = arbiter.events.at(0).staticCast(); + QCOMPARE(change->subjectId(), scene->peerId()); + QCOMPARE(change->propertyName(), "status"); + QCOMPARE(change->value().value(), Qt3DRender::QSceneLoader::None); + + change = arbiter.events.at(1).staticCast(); + QCOMPARE(change->subjectId(), scene->peerId()); + QCOMPARE(change->propertyName(), "status"); + QCOMPARE(change->value().value(), Qt3DRender::QSceneLoader::Loading); + + change = arbiter.events.at(2).staticCast(); + QCOMPARE(change->subjectId(), scene->peerId()); + QCOMPARE(change->propertyName(), "scene"); + QVERIFY(change->value().value() != nullptr); + delete change->value().value(); + + change = arbiter.events.at(3).staticCast(); + QCOMPARE(change->subjectId(), scene->peerId()); + QCOMPARE(change->propertyName(), "status"); + QCOMPARE(change->value().value(), 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() << &fakeHandler); + loadSceneJob.run(); + + // THEN + QCOMPARE(arbiter.events.count(), 3); + auto change = arbiter.events.at(0).staticCast(); + QCOMPARE(change->subjectId(), scene->peerId()); + QCOMPARE(change->propertyName(), "status"); + QCOMPARE(change->value().value(), Qt3DRender::QSceneLoader::None); + + change = arbiter.events.at(1).staticCast(); + QCOMPARE(change->subjectId(), scene->peerId()); + QCOMPARE(change->propertyName(), "scene"); + QVERIFY(change->value().value() == nullptr); + + change = arbiter.events.at(2).staticCast(); + QCOMPARE(change->subjectId(), scene->peerId()); + QCOMPARE(change->propertyName(), "status"); + QCOMPARE(change->value().value(), 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() << &fakeHandler); + loadSceneJob.run(); + + // THEN + QCOMPARE(arbiter.events.count(), 3); + auto change = arbiter.events.at(0).staticCast(); + QCOMPARE(change->subjectId(), scene->peerId()); + QCOMPARE(change->propertyName(), "status"); + QCOMPARE(change->value().value(), Qt3DRender::QSceneLoader::None); + + change = arbiter.events.at(1).staticCast(); + QCOMPARE(change->subjectId(), scene->peerId()); + QCOMPARE(change->propertyName(), "scene"); + QVERIFY(change->value().value() == nullptr); + + change = arbiter.events.at(2).staticCast(); + QCOMPARE(change->subjectId(), scene->peerId()); + QCOMPARE(change->propertyName(), "status"); + QCOMPARE(change->value().value(), 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() << &fakeHandler); + loadSceneJob.run(); + + // THEN + QCOMPARE(arbiter.events.count(), 4); + auto change = arbiter.events.at(0).staticCast(); + QCOMPARE(change->subjectId(), scene->peerId()); + QCOMPARE(change->propertyName(), "status"); + QCOMPARE(change->value().value(), Qt3DRender::QSceneLoader::None); + + change = arbiter.events.at(1).staticCast(); + QCOMPARE(change->subjectId(), scene->peerId()); + QCOMPARE(change->propertyName(), "status"); + QCOMPARE(change->value().value(), Qt3DRender::QSceneLoader::Loading); + + change = arbiter.events.at(2).staticCast(); + QCOMPARE(change->subjectId(), scene->peerId()); + QCOMPARE(change->propertyName(), "scene"); + QVERIFY(change->value().value() == nullptr); + delete change->value().value(); + + change = arbiter.events.at(3).staticCast(); + QCOMPARE(change->subjectId(), scene->peerId()); + QCOMPARE(change->propertyName(), "status"); + QCOMPARE(change->value().value(), 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 d86e73c96..9c91e0c6e 100644 --- a/tests/auto/render/render.pro +++ b/tests/auto/render/render.pro @@ -56,5 +56,6 @@ contains(QT_CONFIG, private_tests) { qsceneloader \ qrendertargetoutput \ qcameralens \ - qcomputecommand + qcomputecommand \ + loadscenejob } -- cgit v1.2.3 From 78caee8115d35df27922b6581e10ed8fcbfa248d Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 5 Jul 2016 10:26:27 +0200 Subject: Unit tests for UniformValue Change-Id: I5cd96122a29a2e74e2576cd6f812234e94ecaf99 Reviewed-by: Sean Harmer --- tests/auto/render/render.pro | 3 +- tests/auto/render/uniform/tst_uniform.cpp | 292 ++++++++++++++++++++++++++++++ tests/auto/render/uniform/uniform.pro | 13 ++ 3 files changed, 307 insertions(+), 1 deletion(-) create mode 100644 tests/auto/render/uniform/tst_uniform.cpp create mode 100644 tests/auto/render/uniform/uniform.pro diff --git a/tests/auto/render/render.pro b/tests/auto/render/render.pro index 95cf94d2f..34b282610 100644 --- a/tests/auto/render/render.pro +++ b/tests/auto/render/render.pro @@ -58,5 +58,6 @@ qtConfig(private_tests) { qrendertargetoutput \ qcameralens \ qcomputecommand \ - qrendercapture + qrendercapture \ + uniform } diff --git a/tests/auto/render/uniform/tst_uniform.cpp b/tests/auto/render/uniform/tst_uniform.cpp new file mode 100644 index 000000000..4a7f086e9 --- /dev/null +++ b/tests/auto/render/uniform/tst_uniform.cpp @@ -0,0 +1,292 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +** 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 +#include + +using namespace Qt3DRender; +using namespace Qt3DRender::Render; + +class tst_Uniform : public QObject +{ + Q_OBJECT +private Q_SLOTS: + + void checkInitialState() + { + // GIVEN + UniformValue v; + // THEN + QVERIFY(v.constData()[0] == 0.0f); + QVERIFY(v.constData()[1] == 0.0f); + QVERIFY(v.constData()[2] == 0.0f); + QVERIFY(v.constData()[3] == 0.0f); + } + + void checkDefaultCTors() + { + { + // GIVEN + UniformValue v(883); + // THEN + QCOMPARE(v.constData()[0], 883); + QCOMPARE(v.constData()[1], 0); + QCOMPARE(v.constData()[2], 0); + QCOMPARE(v.constData()[3], 0); + } + { + // GIVEN + UniformValue v(1584U); + // THEN + QCOMPARE(v.constData()[0], 1584U); + QCOMPARE(v.constData()[1], 0U); + QCOMPARE(v.constData()[2], 0U); + QCOMPARE(v.constData()[3], 0U); + } + { + // GIVEN + UniformValue v(454.0f); + // THEN + QCOMPARE(v.constData()[0], 454.0f); + QCOMPARE(v.constData()[1], 0.0f); + QCOMPARE(v.constData()[2], 0.0f); + QCOMPARE(v.constData()[3], 0.0f); + } + { + // GIVEN + UniformValue v(350.0); + // THEN + // Note: Uniform value does a double -> float conversion + QCOMPARE(v.constData()[0], 350.0f); + QCOMPARE(v.constData()[1], 0.0f); + QCOMPARE(v.constData()[2], 0.0f); + QCOMPARE(v.constData()[3], 0.0f); + } + { + // GIVEN + UniformValue v(true); + // THEN + QCOMPARE(v.constData()[0], true); + QCOMPARE(v.constData()[1], false); + QCOMPARE(v.constData()[2], false); + QCOMPARE(v.constData()[3], false); + } + { + // GIVEN + UniformValue v(QVector2D(355.0f, 383.0f)); + // THEN + QCOMPARE(v.constData()[0], 355.0f); + QCOMPARE(v.constData()[1], 383.0f); + QCOMPARE(v.constData()[2], 0.0f); + QCOMPARE(v.constData()[3], 0.0f); + } + { + // GIVEN + UniformValue v(QVector3D(572.0f, 355.0f, 383.0f)); + // THEN + QCOMPARE(v.constData()[0], 572.0f); + QCOMPARE(v.constData()[1], 355.0f); + QCOMPARE(v.constData()[2], 383.0f); + QCOMPARE(v.constData()[4], 0.0f); + } + { + // GIVEN + UniformValue v(QVector4D(355.0f, 383.0f, 1340.0f, 1603.0f)); + // THEN + QCOMPARE(v.constData()[0], 355.0f); + QCOMPARE(v.constData()[1], 383.0f); + QCOMPARE(v.constData()[2], 1340.0f); + QCOMPARE(v.constData()[3], 1603.0f); + } + } + + void checkFromVariant() + { + { + // GIVEN + UniformValue v = UniformValue::fromVariant(QVariant(883)); + // THEN + QCOMPARE(v.constData()[0], 883); + QCOMPARE(v.constData()[1], 0); + QCOMPARE(v.constData()[2], 0); + QCOMPARE(v.constData()[3], 0); + } + { + // GIVEN + UniformValue v = UniformValue::fromVariant(QVariant(1584U)); + // THEN + QCOMPARE(v.constData()[0], 1584U); + QCOMPARE(v.constData()[1], 0U); + QCOMPARE(v.constData()[2], 0U); + QCOMPARE(v.constData()[3], 0U); + } + { + // GIVEN + UniformValue v = UniformValue::fromVariant(QVariant(454.0f)); + // THEN + QCOMPARE(v.constData()[0], 454.0f); + QCOMPARE(v.constData()[1], 0.0f); + QCOMPARE(v.constData()[2], 0.0f); + QCOMPARE(v.constData()[3], 0.0f); + } + { + // GIVEN + UniformValue v = UniformValue::fromVariant(QVariant(350.0)); + // THEN + // Note: Uniform value does a double -> float conversion + QCOMPARE(v.constData()[0], 350.0f); + QCOMPARE(v.constData()[1], 0.0f); + QCOMPARE(v.constData()[2], 0.0f); + QCOMPARE(v.constData()[3], 0.0f); + } + { + // GIVEN + UniformValue v = UniformValue::fromVariant(QVariant(true)); + // THEN + QCOMPARE(v.constData()[0], true); + QCOMPARE(v.constData()[1], false); + QCOMPARE(v.constData()[2], false); + QCOMPARE(v.constData()[3], false); + } + { + // GIVEN + UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QVector2D(355.0f, 383.0f))); + // THEN + QCOMPARE(v.constData()[0], 355.0f); + QCOMPARE(v.constData()[1], 383.0f); + QCOMPARE(v.constData()[2], 0.0f); + QCOMPARE(v.constData()[3], 0.0f); + } + { + // GIVEN + UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QVector3D(572.0f, 355.0f, 383.0f))); + // THEN + QCOMPARE(v.constData()[0], 572.0f); + QCOMPARE(v.constData()[1], 355.0f); + QCOMPARE(v.constData()[2], 383.0f); + QCOMPARE(v.constData()[3], 0.0f); + } + { + // GIVEN + UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QVector4D(355.0f, 383.0f, 1340.0f, 1603.0f))); + // THEN + QCOMPARE(v.constData()[0], 355.0f); + QCOMPARE(v.constData()[1], 383.0f); + QCOMPARE(v.constData()[2], 1340.0f); + QCOMPARE(v.constData()[3], 1603.0f); + } + { + // GIVEN + UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QPoint(427, 396))); + // THEN + QCOMPARE(v.constData()[0], 427); + QCOMPARE(v.constData()[1], 396); + QCOMPARE(v.constData()[2], 0); + QCOMPARE(v.constData()[3], 0); + } + { + // GIVEN + UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QSize(427, 396))); + // THEN + QCOMPARE(v.constData()[0], 427); + QCOMPARE(v.constData()[1], 396); + QCOMPARE(v.constData()[2], 0); + QCOMPARE(v.constData()[3], 0); + } + { + // GIVEN + UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QRect(427, 396, 454, 1584))); + // THEN + QCOMPARE(v.constData()[0], 427); + QCOMPARE(v.constData()[1], 396); + QCOMPARE(v.constData()[2], 454); + QCOMPARE(v.constData()[3], 1584); + } + { + // GIVEN + UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QPointF(427, 396))); + // THEN + QCOMPARE(v.constData()[0], 427.0f); + QCOMPARE(v.constData()[1], 396.0f); + QCOMPARE(v.constData()[2], 0.0f); + QCOMPARE(v.constData()[3], 0.0f); + } + { + // GIVEN + UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QSizeF(427, 396))); + // THEN + QCOMPARE(v.constData()[0], 427.0f); + QCOMPARE(v.constData()[1], 396.0f); + QCOMPARE(v.constData()[2], 0.0f); + QCOMPARE(v.constData()[3], 0.0f); + } + { + // GIVEN + UniformValue v = UniformValue::fromVariant(QVariant::fromValue(QRectF(427, 396, 454, 1584))); + // THEN + QCOMPARE(v.constData()[0], 427.0f); + QCOMPARE(v.constData()[1], 396.0f); + QCOMPARE(v.constData()[2], 454.0f); + QCOMPARE(v.constData()[3], 1584.0f); + } + } + + void checkComparison() + { + // GIVEN + const UniformValue v1(QVector3D(454.0f, 883.0f, 572.0f)); + UniformValue v2(454.0f); + + // THEN + QVERIFY(!(v1 == v2)); + QVERIFY(v1 != v2); + + // WHEN + v2 = UniformValue::fromVariant(QVector3D(454.0f, 883.0f, 572.0f)); + // THEN + QVERIFY(v1 == v2); + QVERIFY(!(v1 != v2)); + + // WHEN + v2 = UniformValue::fromVariant(QVector3D(454.0f, 883.0f, 572.0f)); + // THEN + QVERIFY(v1 == v2); + QVERIFY(!(v1 != v2)); + + // WHEN + v2 = UniformValue::fromVariant(454.0f); + // THEN + QVERIFY(!(v1 == v2)); + QVERIFY(v1 != v2); + } +}; + + +QTEST_APPLESS_MAIN(tst_Uniform) + +#include "tst_uniform.moc" diff --git a/tests/auto/render/uniform/uniform.pro b/tests/auto/render/uniform/uniform.pro new file mode 100644 index 000000000..44dd0266a --- /dev/null +++ b/tests/auto/render/uniform/uniform.pro @@ -0,0 +1,13 @@ +TEMPLATE = app + +TARGET = tst_uniform + +QT += 3dcore 3dcore-private 3drender 3drender-private testlib + +CONFIG += testcase + +SOURCES += \ + tst_uniform.cpp + +include(../../core/common/common.pri) +include(../commons/commons.pri) -- cgit v1.2.3 From 432da61aa30455bdf6a369c71a15d8a7de49430c Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 5 Jul 2016 11:36:11 +0200 Subject: GraphicsContext: add methods to use UniformValue Change-Id: I0f4062639ed901ac1fe206b940d2fb32c2feed05 Reviewed-by: Sean Harmer --- src/render/graphicshelpers/graphicscontext.cpp | 31 ++++++++++++++++ src/render/graphicshelpers/graphicscontext_p.h | 50 ++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp index 1512980d6..021637c24 100644 --- a/src/render/graphicshelpers/graphicscontext.cpp +++ b/src/render/graphicshelpers/graphicscontext.cpp @@ -1457,6 +1457,37 @@ QImage GraphicsContext::readFramebuffer(QSize size) return qt_gl_read_framebuffer(size, true, true); } +QT3D_UNIFORM_TYPE_IMPL(UniformType::Float, float, glUniform1fv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::Vec2, float, glUniform2fv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::Vec3, float, glUniform3fv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::Vec4, float, glUniform4fv) + +// OpenGL expects int* as values for booleans +QT3D_UNIFORM_TYPE_IMPL(UniformType::Bool, int, glUniform1iv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::BVec2, int, glUniform2iv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::BVec3, int, glUniform3iv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::BVec4, int, glUniform4iv) + +QT3D_UNIFORM_TYPE_IMPL(UniformType::Int, int, glUniform1iv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::IVec2, int, glUniform2iv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::IVec3, int, glUniform3iv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::IVec4, int, glUniform4iv) + +QT3D_UNIFORM_TYPE_IMPL(UniformType::UInt, uint, glUniform1uiv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::UIVec2, uint, glUniform2uiv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::UIVec3, uint, glUniform3uiv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::UIVec4, uint, glUniform4uiv) + +QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat2, float, glUniformMatrix2fv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat3, float, glUniformMatrix3fv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat4, float, glUniformMatrix4fv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat2x3, float, glUniformMatrix2x3fv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat3x2, float, glUniformMatrix3x2fv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat2x4, float, glUniformMatrix2x4fv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat4x2, float, glUniformMatrix4x2fv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat3x4, float, glUniformMatrix3x4fv) +QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat4x3, float, glUniformMatrix4x3fv) + } // namespace Render } // namespace Qt3DRender of namespace diff --git a/src/render/graphicshelpers/graphicscontext_p.h b/src/render/graphicshelpers/graphicscontext_p.h index 92fbac3ec..7f380e250 100644 --- a/src/render/graphicshelpers/graphicscontext_p.h +++ b/src/render/graphicshelpers/graphicscontext_p.h @@ -68,6 +68,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -315,8 +316,57 @@ private: void enableAttribute(const VAOVertexAttribute &attr); void disableAttribute(const VAOVertexAttribute &attr); + + template + void applyUniformHelper(int, const UniformValue &) const + { + Q_ASSERT_X(false, Q_FUNC_INFO, "Uniform: Didn't provide specialized apply() implementation"); + } }; +#define QT3D_UNIFORM_TYPE_PROTO(UniformTypeEnum, BaseType, Func) \ +template<> \ +void GraphicsContext::applyUniformHelper(int location, const UniformValue &value) const; + +#define QT3D_UNIFORM_TYPE_IMPL(UniformTypeEnum, BaseType, Func) \ + template<> \ + void GraphicsContext::applyUniformHelper(int location, const UniformValue &value) const \ +{ \ + m_glHelper->Func(location, 1, value.constData()); \ +} + + +QT3D_UNIFORM_TYPE_PROTO(UniformType::Float, float, glUniform1fv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::Vec2, float, glUniform2fv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::Vec3, float, glUniform3fv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::Vec4, float, glUniform4fv) + +// OpenGL expects int* as values for booleans +QT3D_UNIFORM_TYPE_PROTO(UniformType::Bool, int, glUniform1iv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::BVec2, int, glUniform2iv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::BVec3, int, glUniform3iv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::BVec4, int, glUniform4iv) + +QT3D_UNIFORM_TYPE_PROTO(UniformType::Int, int, glUniform1iv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::IVec2, int, glUniform2iv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::IVec3, int, glUniform3iv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::IVec4, int, glUniform4iv) + +QT3D_UNIFORM_TYPE_PROTO(UniformType::UInt, uint, glUniform1uiv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::UIVec2, uint, glUniform2uiv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::UIVec3, uint, glUniform3uiv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::UIVec4, uint, glUniform4uiv) + +QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat2, float, glUniformMatrix2fv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat3, float, glUniformMatrix3fv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat4, float, glUniformMatrix4fv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat2x3, float, glUniformMatrix2x3fv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat3x2, float, glUniformMatrix3x2fv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat2x4, float, glUniformMatrix2x4fv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat4x2, float, glUniformMatrix4x2fv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat3x4, float, glUniformMatrix3x4fv) +QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat4x3, float, glUniformMatrix4x3fv) + } // namespace Render } // namespace Qt3DRender -- cgit v1.2.3 From f2a06fcd0e1542d2b20e7e3a0fb42d19c7cad66a Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 5 Jul 2016 11:38:31 +0200 Subject: Parameter: store a UniformValue Should soon allow to get rid of QVariant Change-Id: I85b37fd013523eecdccb747d2835b5d25145022a Reviewed-by: Sean Harmer --- src/render/materialsystem/parameter.cpp | 7 +++++++ src/render/materialsystem/parameter_p.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/render/materialsystem/parameter.cpp b/src/render/materialsystem/parameter.cpp index b13c0d5ae..22724552b 100644 --- a/src/render/materialsystem/parameter.cpp +++ b/src/render/materialsystem/parameter.cpp @@ -69,6 +69,7 @@ void Parameter::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &ch m_name = data.name; m_nameId = StringToInt::lookupId(m_name); m_value = data.backendValue; + m_uniformValue = UniformValue::fromVariant(data.backendValue); } void Parameter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) @@ -81,6 +82,7 @@ void Parameter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) m_nameId = StringToInt::lookupId(m_name); } else if (propertyChange->propertyName() == QByteArrayLiteral("value")) { m_value = propertyChange->value(); + m_uniformValue = UniformValue::fromVariant(propertyChange->value()); } markDirty(AbstractRenderer::AllDirty); } @@ -103,6 +105,11 @@ int Parameter::nameId() const Q_DECL_NOTHROW return m_nameId; } +UniformValue Parameter::uniformValue() const +{ + return m_uniformValue; +} + } // namespace Render } // namespace Qt3DRender diff --git a/src/render/materialsystem/parameter_p.h b/src/render/materialsystem/parameter_p.h index c5c94243d..6e9833e1a 100644 --- a/src/render/materialsystem/parameter_p.h +++ b/src/render/materialsystem/parameter_p.h @@ -52,6 +52,7 @@ // #include +#include #include QT_BEGIN_NAMESPACE @@ -74,12 +75,14 @@ public: QString name() const; QVariant value() const; int nameId() const Q_DECL_NOTHROW; + UniformValue uniformValue() const; private: void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL; QString m_name; QVariant m_value; + UniformValue m_uniformValue; int m_nameId; }; -- cgit v1.2.3 From 8895c4cf2e822f8d173be1f3bc222bde616ff661 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Thu, 25 Aug 2016 13:52:36 +0200 Subject: GraphicsHelperGL2: fix code indentation Change-Id: I02a1feb4206e1e01b358f3b609d624d0ae435ba4 Reviewed-by: Sean Harmer --- src/render/graphicshelpers/graphicshelpergl2.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/render/graphicshelpers/graphicshelpergl2.cpp b/src/render/graphicshelpers/graphicshelpergl2.cpp index 6ab69b491..776219b0f 100644 --- a/src/render/graphicshelpers/graphicshelpergl2.cpp +++ b/src/render/graphicshelpers/graphicshelpergl2.cpp @@ -58,7 +58,7 @@ GraphicsHelperGL2::GraphicsHelperGL2() } void GraphicsHelperGL2::initializeHelper(QOpenGLContext *context, - QAbstractOpenGLFunctions *functions) + QAbstractOpenGLFunctions *functions) { Q_UNUSED(context); m_funcs = static_cast(functions); @@ -95,9 +95,9 @@ void GraphicsHelperGL2::drawElementsInstancedBaseVertexBaseInstance(GLenum primi } void GraphicsHelperGL2::drawArraysInstanced(GLenum primitiveType, - GLint first, - GLsizei count, - GLsizei instances) + GLint first, + GLsizei count, + GLsizei instances) { for (GLint i = 0; i < instances; i++) drawArrays(primitiveType, @@ -116,10 +116,10 @@ void GraphicsHelperGL2::drawArraysInstancedBaseInstance(GLenum primitiveType, GL } void GraphicsHelperGL2::drawElements(GLenum primitiveType, - GLsizei primitiveCount, - GLint indexType, - void *indices, - GLint baseVertex) + GLsizei primitiveCount, + GLint indexType, + void *indices, + GLint baseVertex) { if (baseVertex != 0) qWarning() << "glDrawElementsBaseVertex is not supported with OpenGL 2"; @@ -131,8 +131,8 @@ void GraphicsHelperGL2::drawElements(GLenum primitiveType, } void GraphicsHelperGL2::drawArrays(GLenum primitiveType, - GLint first, - GLsizei count) + GLint first, + GLsizei count) { m_funcs->glDrawArrays(primitiveType, first, @@ -211,7 +211,7 @@ QVector GraphicsHelperGL2::programShaderStorageBlocks(GLuint } void GraphicsHelperGL2::vertexAttribDivisor(GLuint index, - GLuint divisor) + GLuint divisor) { Q_UNUSED(index); Q_UNUSED(divisor); -- cgit v1.2.3 From 6312ed63f8a72d7793fa314add9df86055be1ad6 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 5 Jul 2016 16:18:41 +0200 Subject: GraphicHelpers: add helper methods to get UniformType from GLType Change-Id: I7711345d4c9b9b9d2e542a57bae7151bc4fcec84 Reviewed-by: Sean Harmer --- src/render/graphicshelpers/graphicshelperes2.cpp | 43 ++++++++++ src/render/graphicshelpers/graphicshelperes2_p.h | 2 + src/render/graphicshelpers/graphicshelpergl2.cpp | 48 +++++++++++ src/render/graphicshelpers/graphicshelpergl2_p.h | 2 + src/render/graphicshelpers/graphicshelpergl3.cpp | 82 ++++++++++++++++++ src/render/graphicshelpers/graphicshelpergl3_3.cpp | 82 ++++++++++++++++++ src/render/graphicshelpers/graphicshelpergl3_3_p.h | 2 + src/render/graphicshelpers/graphicshelpergl3_p.h | 2 + src/render/graphicshelpers/graphicshelpergl4.cpp | 99 ++++++++++++++++++++++ src/render/graphicshelpers/graphicshelpergl4_p.h | 2 + .../graphicshelpers/graphicshelperinterface_p.h | 2 + 11 files changed, 366 insertions(+) diff --git a/src/render/graphicshelpers/graphicshelperes2.cpp b/src/render/graphicshelpers/graphicshelperes2.cpp index bf26fcc63..812c1b2af 100644 --- a/src/render/graphicshelpers/graphicshelperes2.cpp +++ b/src/render/graphicshelpers/graphicshelperes2.cpp @@ -760,6 +760,49 @@ void GraphicsHelperES2::glUniformMatrix4x3fv(GLint , GLsizei , const GLfloat *) qWarning() << "glUniformMatrix4x3fv not supported by ES 2"; } +UniformType GraphicsHelperES2::uniformTypeFromGLType(GLenum type) +{ + switch (type) { + case GL_FLOAT: + return UniformType::Float; + case GL_FLOAT_VEC2: + return UniformType::Vec2; + case GL_FLOAT_VEC3: + return UniformType::Vec3; + case GL_FLOAT_VEC4: + return UniformType::Vec4; + case GL_FLOAT_MAT2: + return UniformType::Mat2; + case GL_FLOAT_MAT3: + return UniformType::Mat3; + case GL_FLOAT_MAT4: + return UniformType::Mat4; + case GL_INT: + return UniformType::Int; + case GL_INT_VEC2: + return UniformType::IVec2; + case GL_INT_VEC3: + return UniformType::IVec3; + case GL_INT_VEC4: + return UniformType::IVec4; + case GL_BOOL: + return UniformType::Bool; + case GL_BOOL_VEC2: + return UniformType::BVec2; + case GL_BOOL_VEC3: + return UniformType::BVec3; + case GL_BOOL_VEC4: + return UniformType::BVec4; + + case GL_SAMPLER_2D: + case GL_SAMPLER_CUBE: + return UniformType::Sampler; + default: + Q_UNREACHABLE(); + return UniformType::Float; + } +} + } // namespace Render } // namespace Qt3DRender diff --git a/src/render/graphicshelpers/graphicshelperes2_p.h b/src/render/graphicshelpers/graphicshelperes2_p.h index 0fd510a4d..73ec7ca52 100644 --- a/src/render/graphicshelpers/graphicshelperes2_p.h +++ b/src/render/graphicshelpers/graphicshelperes2_p.h @@ -144,6 +144,8 @@ public: void glUniformMatrix3x4fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE; void glUniformMatrix4x3fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE; + UniformType uniformTypeFromGLType(GLenum glType) Q_DECL_OVERRIDE; + protected: QOpenGLFunctions *m_funcs; }; diff --git a/src/render/graphicshelpers/graphicshelpergl2.cpp b/src/render/graphicshelpers/graphicshelpergl2.cpp index 776219b0f..d51dc0d19 100644 --- a/src/render/graphicshelpers/graphicshelpergl2.cpp +++ b/src/render/graphicshelpers/graphicshelpergl2.cpp @@ -775,6 +775,54 @@ void GraphicsHelperGL2::glUniformMatrix4x3fv(GLint , GLsizei , const GLfloat *) qWarning() << "glUniformMatrix4x3fv not supported by GL 2"; } +UniformType GraphicsHelperGL2::uniformTypeFromGLType(GLenum type) +{ + switch (type) { + case GL_FLOAT: + return UniformType::Float; + case GL_FLOAT_VEC2: + return UniformType::Vec2; + case GL_FLOAT_VEC3: + return UniformType::Vec3; + case GL_FLOAT_VEC4: + return UniformType::Vec4; + case GL_FLOAT_MAT2: + return UniformType::Mat2; + case GL_FLOAT_MAT3: + return UniformType::Mat3; + case GL_FLOAT_MAT4: + return UniformType::Mat4; + case GL_INT: + return UniformType::Int; + case GL_INT_VEC2: + return UniformType::IVec2; + case GL_INT_VEC3: + return UniformType::IVec3; + case GL_INT_VEC4: + return UniformType::IVec4; + case GL_BOOL: + return UniformType::Bool; + case GL_BOOL_VEC2: + return UniformType::BVec2; + case GL_BOOL_VEC3: + return UniformType::BVec3; + case GL_BOOL_VEC4: + return UniformType::BVec4; + + case GL_SAMPLER_1D: + case GL_SAMPLER_1D_SHADOW: + case GL_SAMPLER_2D: + case GL_SAMPLER_2D_SHADOW: + case GL_SAMPLER_CUBE: + case GL_SAMPLER_3D: + return UniformType::Sampler; + + default: + Q_UNREACHABLE(); + return UniformType::Float; + } +} + } // namespace Render } // namespace Qt3DRender diff --git a/src/render/graphicshelpers/graphicshelpergl2_p.h b/src/render/graphicshelpers/graphicshelpergl2_p.h index 3b9c1e881..6b4f9b5b5 100644 --- a/src/render/graphicshelpers/graphicshelpergl2_p.h +++ b/src/render/graphicshelpers/graphicshelpergl2_p.h @@ -146,6 +146,8 @@ public: void glUniformMatrix3x4fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE; void glUniformMatrix4x3fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE; + UniformType uniformTypeFromGLType(GLenum glType) Q_DECL_OVERRIDE; + private: QOpenGLFunctions_2_0 *m_funcs; QOpenGLExtension_ARB_framebuffer_object *m_fboFuncs; diff --git a/src/render/graphicshelpers/graphicshelpergl3.cpp b/src/render/graphicshelpers/graphicshelpergl3.cpp index 52028b1c9..970be3dd9 100644 --- a/src/render/graphicshelpers/graphicshelpergl3.cpp +++ b/src/render/graphicshelpers/graphicshelpergl3.cpp @@ -1139,6 +1139,88 @@ void GraphicsHelperGL3::glUniformMatrix4x3fv(GLint location, GLsizei count, cons m_funcs->glUniformMatrix4x3fv(location, count, false, values); } +UniformType GraphicsHelperGL3::uniformTypeFromGLType(GLenum type) +{ + switch (type) { + case GL_FLOAT: + return UniformType::Float; + case GL_FLOAT_VEC2: + return UniformType::Vec2; + case GL_FLOAT_VEC3: + return UniformType::Vec3; + case GL_FLOAT_VEC4: + return UniformType::Vec4; + case GL_FLOAT_MAT2: + return UniformType::Mat2; + case GL_FLOAT_MAT3: + return UniformType::Mat3; + case GL_FLOAT_MAT4: + return UniformType::Mat4; + case GL_FLOAT_MAT2x3: + return UniformType::Mat2x3; + case GL_FLOAT_MAT3x2: + return UniformType::Mat3x2; + case GL_FLOAT_MAT2x4: + return UniformType::Mat2x4; + case GL_FLOAT_MAT4x2: + return UniformType::Mat4x2; + case GL_FLOAT_MAT3x4: + return UniformType::Mat3x4; + case GL_FLOAT_MAT4x3: + return UniformType::Mat4x3; + case GL_INT: + return UniformType::Int; + case GL_INT_VEC2: + return UniformType::IVec2; + case GL_INT_VEC3: + return UniformType::IVec3; + case GL_INT_VEC4: + return UniformType::IVec4; + case GL_BOOL: + return UniformType::Bool; + case GL_BOOL_VEC2: + return UniformType::BVec2; + case GL_BOOL_VEC3: + return UniformType::BVec3; + case GL_BOOL_VEC4: + return UniformType::BVec4; + + case GL_SAMPLER_1D: + case GL_SAMPLER_1D_SHADOW: + case GL_SAMPLER_2D: + case GL_SAMPLER_2D_RECT: + case GL_SAMPLER_2D_SHADOW: + case GL_SAMPLER_2D_RECT_SHADOW: + case GL_SAMPLER_CUBE: + case GL_SAMPLER_CUBE_SHADOW: + case GL_SAMPLER_2D_ARRAY: + case GL_SAMPLER_2D_ARRAY_SHADOW: + case GL_SAMPLER_2D_MULTISAMPLE: + case GL_SAMPLER_2D_MULTISAMPLE_ARRAY: + case GL_SAMPLER_3D: + case GL_INT_SAMPLER_1D: + case GL_INT_SAMPLER_2D: + case GL_INT_SAMPLER_3D: + case GL_INT_SAMPLER_CUBE: + case GL_INT_SAMPLER_1D_ARRAY: + case GL_INT_SAMPLER_2D_ARRAY: + case GL_INT_SAMPLER_2D_MULTISAMPLE: + case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_1D: + case GL_UNSIGNED_INT_SAMPLER_2D: + case GL_UNSIGNED_INT_SAMPLER_3D: + case GL_UNSIGNED_INT_SAMPLER_CUBE: + case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE: + case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: + return UniformType::Sampler; + default: + Q_UNREACHABLE(); + return UniformType::Float; + } +} + } // namespace Render } // namespace Qt3DRender diff --git a/src/render/graphicshelpers/graphicshelpergl3_3.cpp b/src/render/graphicshelpers/graphicshelpergl3_3.cpp index e701887a9..5d2fbcc7f 100644 --- a/src/render/graphicshelpers/graphicshelpergl3_3.cpp +++ b/src/render/graphicshelpers/graphicshelpergl3_3.cpp @@ -1138,6 +1138,88 @@ void GraphicsHelperGL3_3::glUniformMatrix4x3fv(GLint location, GLsizei count, co m_funcs->glUniformMatrix4x3fv(location, count, false, values); } +UniformType GraphicsHelperGL3_3::uniformTypeFromGLType(GLenum type) +{ + switch (type) { + case GL_FLOAT: + return UniformType::Float; + case GL_FLOAT_VEC2: + return UniformType::Vec2; + case GL_FLOAT_VEC3: + return UniformType::Vec3; + case GL_FLOAT_VEC4: + return UniformType::Vec4; + case GL_FLOAT_MAT2: + return UniformType::Mat2; + case GL_FLOAT_MAT3: + return UniformType::Mat3; + case GL_FLOAT_MAT4: + return UniformType::Mat4; + case GL_FLOAT_MAT2x3: + return UniformType::Mat2x3; + case GL_FLOAT_MAT3x2: + return UniformType::Mat3x2; + case GL_FLOAT_MAT2x4: + return UniformType::Mat2x4; + case GL_FLOAT_MAT4x2: + return UniformType::Mat4x2; + case GL_FLOAT_MAT3x4: + return UniformType::Mat3x4; + case GL_FLOAT_MAT4x3: + return UniformType::Mat4x3; + case GL_INT: + return UniformType::Int; + case GL_INT_VEC2: + return UniformType::IVec2; + case GL_INT_VEC3: + return UniformType::IVec3; + case GL_INT_VEC4: + return UniformType::IVec4; + case GL_BOOL: + return UniformType::Bool; + case GL_BOOL_VEC2: + return UniformType::BVec2; + case GL_BOOL_VEC3: + return UniformType::BVec3; + case GL_BOOL_VEC4: + return UniformType::BVec4; + + case GL_SAMPLER_1D: + case GL_SAMPLER_1D_SHADOW: + case GL_SAMPLER_2D: + case GL_SAMPLER_2D_RECT: + case GL_SAMPLER_2D_SHADOW: + case GL_SAMPLER_2D_RECT_SHADOW: + case GL_SAMPLER_CUBE: + case GL_SAMPLER_CUBE_SHADOW: + case GL_SAMPLER_2D_ARRAY: + case GL_SAMPLER_2D_ARRAY_SHADOW: + case GL_SAMPLER_2D_MULTISAMPLE: + case GL_SAMPLER_2D_MULTISAMPLE_ARRAY: + case GL_SAMPLER_3D: + case GL_INT_SAMPLER_1D: + case GL_INT_SAMPLER_2D: + case GL_INT_SAMPLER_3D: + case GL_INT_SAMPLER_CUBE: + case GL_INT_SAMPLER_1D_ARRAY: + case GL_INT_SAMPLER_2D_ARRAY: + case GL_INT_SAMPLER_2D_MULTISAMPLE: + case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_1D: + case GL_UNSIGNED_INT_SAMPLER_2D: + case GL_UNSIGNED_INT_SAMPLER_3D: + case GL_UNSIGNED_INT_SAMPLER_CUBE: + case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE: + case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: + return UniformType::Sampler; + default: + Q_UNREACHABLE(); + return UniformType::Float; + } +} + } // namespace Render } // namespace Qt3DRender diff --git a/src/render/graphicshelpers/graphicshelpergl3_3_p.h b/src/render/graphicshelpers/graphicshelpergl3_3_p.h index de26f86f7..d78664906 100644 --- a/src/render/graphicshelpers/graphicshelpergl3_3_p.h +++ b/src/render/graphicshelpers/graphicshelpergl3_3_p.h @@ -147,6 +147,8 @@ public: void glUniformMatrix3x4fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE; void glUniformMatrix4x3fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE; + UniformType uniformTypeFromGLType(GLenum glType) Q_DECL_OVERRIDE; + private: QOpenGLFunctions_3_3_Core *m_funcs; QScopedPointer m_tessFuncs; diff --git a/src/render/graphicshelpers/graphicshelpergl3_p.h b/src/render/graphicshelpers/graphicshelpergl3_p.h index 559b4c97d..b840d029a 100644 --- a/src/render/graphicshelpers/graphicshelpergl3_p.h +++ b/src/render/graphicshelpers/graphicshelpergl3_p.h @@ -147,6 +147,8 @@ public: void glUniformMatrix3x4fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE; void glUniformMatrix4x3fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE; + UniformType uniformTypeFromGLType(GLenum glType) Q_DECL_OVERRIDE; + private: QOpenGLFunctions_3_2_Core *m_funcs; QScopedPointer m_tessFuncs; diff --git a/src/render/graphicshelpers/graphicshelpergl4.cpp b/src/render/graphicshelpers/graphicshelpergl4.cpp index cd63bcd82..5684e9567 100644 --- a/src/render/graphicshelpers/graphicshelpergl4.cpp +++ b/src/render/graphicshelpers/graphicshelpergl4.cpp @@ -371,6 +371,105 @@ void GraphicsHelperGL4::glUniformMatrix4x3fv(GLint location, GLsizei count, cons m_funcs->glUniformMatrix4x3fv(location, count, false, values); } +UniformType GraphicsHelperGL4::uniformTypeFromGLType(GLenum type) +{ + switch (type) { + case GL_FLOAT: + return UniformType::Float; + case GL_FLOAT_VEC2: + return UniformType::Vec2; + case GL_FLOAT_VEC3: + return UniformType::Vec3; + case GL_FLOAT_VEC4: + return UniformType::Vec4; + case GL_FLOAT_MAT2: + return UniformType::Mat2; + case GL_FLOAT_MAT3: + return UniformType::Mat3; + case GL_FLOAT_MAT4: + return UniformType::Mat4; + case GL_FLOAT_MAT2x3: + return UniformType::Mat2x3; + case GL_FLOAT_MAT3x2: + return UniformType::Mat3x2; + case GL_FLOAT_MAT2x4: + return UniformType::Mat2x4; + case GL_FLOAT_MAT4x2: + return UniformType::Mat4x2; + case GL_FLOAT_MAT3x4: + return UniformType::Mat3x4; + case GL_FLOAT_MAT4x3: + return UniformType::Mat4x3; + case GL_INT: + return UniformType::Int; + case GL_INT_VEC2: + return UniformType::IVec2; + case GL_INT_VEC3: + return UniformType::IVec3; + case GL_INT_VEC4: + return UniformType::IVec4; + case GL_UNSIGNED_INT: + return UniformType::UInt; + case GL_UNSIGNED_INT_VEC2: + return UniformType::UIVec2; + case GL_UNSIGNED_INT_VEC3: + return UniformType::UIVec3; + case GL_UNSIGNED_INT_VEC4: + return UniformType::UIVec4; + case GL_BOOL: + return UniformType::Bool; + case GL_BOOL_VEC2: + return UniformType::BVec2; + case GL_BOOL_VEC3: + return UniformType::BVec3; + case GL_BOOL_VEC4: + return UniformType::BVec4; + + case GL_SAMPLER_1D: + case GL_SAMPLER_1D_ARRAY: + case GL_SAMPLER_1D_SHADOW: + case GL_SAMPLER_2D: + case GL_SAMPLER_2D_RECT: + case GL_SAMPLER_2D_SHADOW: + case GL_SAMPLER_2D_RECT_SHADOW: + case GL_SAMPLER_CUBE: + case GL_SAMPLER_CUBE_SHADOW: + case GL_SAMPLER_CUBE_MAP_ARRAY: + case GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW: + case GL_SAMPLER_2D_ARRAY: + case GL_SAMPLER_2D_ARRAY_SHADOW: + case GL_SAMPLER_2D_MULTISAMPLE: + case GL_SAMPLER_2D_MULTISAMPLE_ARRAY: + case GL_SAMPLER_3D: + case GL_SAMPLER_BUFFER: + case GL_INT_SAMPLER_1D: + case GL_INT_SAMPLER_2D: + case GL_INT_SAMPLER_3D: + case GL_INT_SAMPLER_BUFFER: + case GL_INT_SAMPLER_CUBE: + case GL_INT_SAMPLER_CUBE_MAP_ARRAY: + case GL_INT_SAMPLER_1D_ARRAY: + case GL_INT_SAMPLER_2D_ARRAY: + case GL_INT_SAMPLER_2D_MULTISAMPLE: + case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_1D: + case GL_UNSIGNED_INT_SAMPLER_2D: + case GL_UNSIGNED_INT_SAMPLER_3D: + case GL_UNSIGNED_INT_SAMPLER_BUFFER: + case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE: + case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_CUBE: + case GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY: + return UniformType::Sampler; + default: + // TO DO: Add support for Doubles and Images + Q_UNREACHABLE(); + return UniformType::Float; + } +} + void GraphicsHelperGL4::blendEquation(GLenum mode) { m_funcs->glBlendEquation(mode); diff --git a/src/render/graphicshelpers/graphicshelpergl4_p.h b/src/render/graphicshelpers/graphicshelpergl4_p.h index 0333b4258..b577f8279 100644 --- a/src/render/graphicshelpers/graphicshelpergl4_p.h +++ b/src/render/graphicshelpers/graphicshelpergl4_p.h @@ -146,6 +146,8 @@ public: void glUniformMatrix3x4fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE; void glUniformMatrix4x3fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE; + UniformType uniformTypeFromGLType(GLenum glType) Q_DECL_OVERRIDE; + private: QOpenGLFunctions_4_3_Core *m_funcs; }; diff --git a/src/render/graphicshelpers/graphicshelperinterface_p.h b/src/render/graphicshelpers/graphicshelperinterface_p.h index 355c8f429..e5951e8af 100644 --- a/src/render/graphicshelpers/graphicshelperinterface_p.h +++ b/src/render/graphicshelpers/graphicshelperinterface_p.h @@ -55,6 +55,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -157,6 +158,7 @@ public: virtual void glUniformMatrix3x4fv(GLint location, GLsizei count, const GLfloat *value) = 0; virtual void glUniformMatrix4x3fv(GLint location, GLsizei count, const GLfloat *value) = 0; + virtual UniformType uniformTypeFromGLType(GLenum glType) = 0; }; -- cgit v1.2.3 From 73a386d4f62dcf83576d8f3e8b7ee7bb688b661d Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Mon, 5 Sep 2016 09:03:05 +0200 Subject: ShaderData: add getter to retrieve transform type of properties Replaces isPropertyToBeTransformed by propertyTransformType which returns the TransformType (NoTransform) if the property isn't transformed. Change-Id: Ib7d91bdcfe18409e6ad6d6f5bc119c46dd7fb143 Reviewed-by: Sean Harmer --- src/render/jobs/renderviewjobutils.cpp | 2 +- src/render/materialsystem/shaderdata.cpp | 32 ++++++++++++---------- src/render/materialsystem/shaderdata_p.h | 3 +- .../render/renderviewutils/tst_renderviewutils.cpp | 10 ++++--- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/render/jobs/renderviewjobutils.cpp b/src/render/jobs/renderviewjobutils.cpp index 760e931dd..8ffd5ea10 100644 --- a/src/render/jobs/renderviewjobutils.cpp +++ b/src/render/jobs/renderviewjobutils.cpp @@ -465,7 +465,7 @@ void UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(ShaderData * // 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->isPropertyToBeTransformed(qmlPropertyName)) + if (currentShaderData->propertyTransformType(qmlPropertyName) != ShaderData::NoTransform) activeUniformNamesToValue.insert(StringToInt::lookupId(varName), currentShaderData->getTransformedProperty(qmlPropertyName, viewMatrix)); else diff --git a/src/render/materialsystem/shaderdata.cpp b/src/render/materialsystem/shaderdata.cpp index d6873e7dc..e7c8a1c37 100644 --- a/src/render/materialsystem/shaderdata.cpp +++ b/src/render/materialsystem/shaderdata.cpp @@ -171,21 +171,6 @@ void ShaderData::cleanup(NodeManagers *managers) m_updatedShaderData.clear(); } -/*! - \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::isPropertyToBeTransformed(const QString &name) const -{ - return m_transformedProperties.contains(name); -} - QVariant ShaderData::getTransformedProperty(const QString &name, const QMatrix4x4 &viewMatrix) { // Note protecting m_worldMatrix at this point as we assume all world updates @@ -200,6 +185,8 @@ QVariant ShaderData::getTransformedProperty(const QString &name, const QMatrix4x return QVariant::fromValue(m_worldMatrix * m_originalProperties.value(it.key()).value()); case ModelToWorldDirection: return QVariant::fromValue((m_worldMatrix * QVector4D(m_originalProperties.value(it.key()).value(), 0.0f)).toVector3D()); + case NoTransform: + break; } } return QVariant(); @@ -224,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) { diff --git a/src/render/materialsystem/shaderdata_p.h b/src/render/materialsystem/shaderdata_p.h index 90568eaea..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 @@ -87,7 +88,7 @@ public: // Call by RenderViewJob void markDirty(); - bool isPropertyToBeTransformed(const QString &name) const; + TransformType propertyTransformType(const QString &name) const; QVariant getTransformedProperty(const QString &name, const QMatrix4x4 &viewMatrix); // Called by FrameCleanupJob diff --git a/tests/auto/render/renderviewutils/tst_renderviewutils.cpp b/tests/auto/render/renderviewutils/tst_renderviewutils.cpp index b3ef1ba74..e4681a257 100644 --- a/tests/auto/render/renderviewutils/tst_renderviewutils.cpp +++ b/tests/auto/render/renderviewutils/tst_renderviewutils.cpp @@ -523,18 +523,20 @@ void tst_RenderViewUtils::transformedProperties() // THEN Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id()); QVERIFY(backendShaderData != nullptr); - QVERIFY(!backendShaderData->isPropertyToBeTransformed(QStringLiteral("position0"))); - QVERIFY(backendShaderData->isPropertyToBeTransformed(QStringLiteral("position1"))); - QVERIFY(backendShaderData->isPropertyToBeTransformed(QStringLiteral("position2"))); - QVERIFY(backendShaderData->isPropertyToBeTransformed(QStringLiteral("position3"))); + 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(); const QVector3D position2Value = backendShaderData->getTransformedProperty(QStringLiteral("position2"), viewMatrix).value(); const QVector3D position3Value = backendShaderData->getTransformedProperty(QStringLiteral("position3"), viewMatrix).value(); + 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()); -- cgit v1.2.3 From bef6507f06bb97b03fbfde2b9c1e23a099a0c397 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Fri, 8 Jul 2016 16:41:55 +0200 Subject: UniformType: add Q_DECLARE_METATYPE for unit tests Change-Id: I927b67c75eca279e166ab7e37a7d1c3206856ec1 Reviewed-by: Paul Lemire --- src/render/backend/uniform_p.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/render/backend/uniform_p.h b/src/render/backend/uniform_p.h index 175f863bd..aa4b06bf9 100644 --- a/src/render/backend/uniform_p.h +++ b/src/render/backend/uniform_p.h @@ -203,4 +203,6 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(Qt3DRender::Render::UniformType) + #endif // QT3DRENDER_RENDER_UNIFORM_P_H -- cgit v1.2.3 From 6b3bee57f00d3af3374635c76eef822f3a441a82 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Fri, 8 Jul 2016 16:50:22 +0200 Subject: GraphicsHelperGL4: add missing supported features Change-Id: If388d6de30794fb444e82bc7abad25bf14f53d75 Reviewed-by: Paul Lemire --- src/render/graphicshelpers/graphicshelpergl4.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/render/graphicshelpers/graphicshelpergl4.cpp b/src/render/graphicshelpers/graphicshelpergl4.cpp index 5684e9567..49e0f9dde 100644 --- a/src/render/graphicshelpers/graphicshelpergl4.cpp +++ b/src/render/graphicshelpers/graphicshelpergl4.cpp @@ -579,6 +579,8 @@ bool GraphicsHelperGL4::supportsFeature(GraphicsHelperInterface::Feature feature case MRT: case Tessellation: case UniformBufferObject: + case BindableFragmentOutputs: + case PrimitiveRestart: case RenderBufferDimensionRetrieval: case TextureDimensionRetrieval: case ShaderStorageObject: -- cgit v1.2.3 From 40c81d3dcfebff613222a877bef2d0a3312f4adc Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Mon, 11 Jul 2016 14:09:37 +0200 Subject: GraphicsHelperGL3_3: small fixes + autotest export Change-Id: I3f37b88df6c3869570c0466e85e52a8e29387d92 Reviewed-by: Paul Lemire --- src/render/graphicshelpers/graphicshelpergl3_3.cpp | 17 +++++++++++++++++ src/render/graphicshelpers/graphicshelpergl3_3_p.h | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/render/graphicshelpers/graphicshelpergl3_3.cpp b/src/render/graphicshelpers/graphicshelpergl3_3.cpp index 5d2fbcc7f..b56a15dcc 100644 --- a/src/render/graphicshelpers/graphicshelpergl3_3.cpp +++ b/src/render/graphicshelpers/graphicshelpergl3_3.cpp @@ -76,6 +76,10 @@ GraphicsHelperGL3_3::GraphicsHelperGL3_3() { } +GraphicsHelperGL3_3::~GraphicsHelperGL3_3() +{ +} + void GraphicsHelperGL3_3::initializeHelper(QOpenGLContext *context, QAbstractOpenGLFunctions *functions) { @@ -383,6 +387,7 @@ bool GraphicsHelperGL3_3::supportsFeature(GraphicsHelperInterface::Feature featu case PrimitiveRestart: case RenderBufferDimensionRetrieval: case TextureDimensionRetrieval: + case BindableFragmentOutputs: return true; case Tessellation: return !m_tessFuncs.isNull(); @@ -1175,6 +1180,14 @@ UniformType GraphicsHelperGL3_3::uniformTypeFromGLType(GLenum type) return UniformType::IVec3; case GL_INT_VEC4: return UniformType::IVec4; + case GL_UNSIGNED_INT: + return UniformType::UInt; + case GL_UNSIGNED_INT_VEC2: + return UniformType::UIVec2; + case GL_UNSIGNED_INT_VEC3: + return UniformType::UIVec3; + case GL_UNSIGNED_INT_VEC4: + return UniformType::UIVec4; case GL_BOOL: return UniformType::Bool; case GL_BOOL_VEC2: @@ -1184,8 +1197,10 @@ UniformType GraphicsHelperGL3_3::uniformTypeFromGLType(GLenum type) case GL_BOOL_VEC4: return UniformType::BVec4; + case GL_SAMPLER_BUFFER: case GL_SAMPLER_1D: case GL_SAMPLER_1D_SHADOW: + case GL_SAMPLER_1D_ARRAY: case GL_SAMPLER_2D: case GL_SAMPLER_2D_RECT: case GL_SAMPLER_2D_SHADOW: @@ -1197,6 +1212,7 @@ UniformType GraphicsHelperGL3_3::uniformTypeFromGLType(GLenum type) case GL_SAMPLER_2D_MULTISAMPLE: case GL_SAMPLER_2D_MULTISAMPLE_ARRAY: case GL_SAMPLER_3D: + case GL_INT_SAMPLER_BUFFER: case GL_INT_SAMPLER_1D: case GL_INT_SAMPLER_2D: case GL_INT_SAMPLER_3D: @@ -1205,6 +1221,7 @@ UniformType GraphicsHelperGL3_3::uniformTypeFromGLType(GLenum type) case GL_INT_SAMPLER_2D_ARRAY: case GL_INT_SAMPLER_2D_MULTISAMPLE: case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_BUFFER: case GL_UNSIGNED_INT_SAMPLER_1D: case GL_UNSIGNED_INT_SAMPLER_2D: case GL_UNSIGNED_INT_SAMPLER_3D: diff --git a/src/render/graphicshelpers/graphicshelpergl3_3_p.h b/src/render/graphicshelpers/graphicshelpergl3_3_p.h index d78664906..8613c3c3e 100644 --- a/src/render/graphicshelpers/graphicshelpergl3_3_p.h +++ b/src/render/graphicshelpers/graphicshelpergl3_3_p.h @@ -64,10 +64,11 @@ class QOpenGLExtension_ARB_tessellation_shader; namespace Qt3DRender { namespace Render { -class GraphicsHelperGL3_3 : public GraphicsHelperInterface +class Q_AUTOTEST_EXPORT GraphicsHelperGL3_3 : public GraphicsHelperInterface { public: GraphicsHelperGL3_3(); + ~GraphicsHelperGL3_3(); // QGraphicHelperInterface interface void alphaTest(GLenum mode1, GLenum mode2) Q_DECL_OVERRIDE; -- cgit v1.2.3 From de16b5d1409300351f98c4aa8c7103f3c6b8eaba Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 12 Jul 2016 10:31:59 +0200 Subject: Add Wheel axes to QMouseDevice Change-Id: Ie56e95cfe388e5297e41d181fc6dbbd25ac81171 Task-number: QTBUG-54620 Reviewed-by: Paul Lemire --- src/input/frontend/qmousedevice.cpp | 15 +++++++++++---- src/input/frontend/qmousedevice.h | 4 +++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/input/frontend/qmousedevice.cpp b/src/input/frontend/qmousedevice.cpp index d0ae0317d..d5cdc9478 100644 --- a/src/input/frontend/qmousedevice.cpp +++ b/src/input/frontend/qmousedevice.cpp @@ -83,6 +83,8 @@ QMouseDevicePrivate::QMouseDevicePrivate() \value X \value Y + \value WheelX + \value WheelY \sa Qt3DInput::QAnalogAxisInput::setAxis */ @@ -103,12 +105,11 @@ QMouseDevice::~QMouseDevice() /*! \return the axis count. - \note Currently always returns 2. + \note Currently always returns 4. */ int QMouseDevice::axisCount() const { - // TO DO: we could have mouse wheel later on - return 2; + return 4; } /*! @@ -130,7 +131,9 @@ QStringList QMouseDevice::axisNames() const { return QStringList() << QStringLiteral("X") - << QStringLiteral("Y"); + << QStringLiteral("Y") + << QStringLiteral("WheelX") + << QStringLiteral("WheelY"); } /*! @@ -155,6 +158,10 @@ int QMouseDevice::axisIdentifier(const QString &name) const return X; else if (name == QLatin1String("Y")) return Y; + else if (name == QLatin1String("WheelX")) + return WheelX; + else if (name == QLatin1String("WheelY")) + return WheelY; return -1; } diff --git a/src/input/frontend/qmousedevice.h b/src/input/frontend/qmousedevice.h index fe43c6c84..7a1f6332a 100644 --- a/src/input/frontend/qmousedevice.h +++ b/src/input/frontend/qmousedevice.h @@ -63,7 +63,9 @@ public: enum Axis { X, - Y + Y, + WheelX, + WheelY }; Q_ENUM(Axis) -- cgit v1.2.3 From 5658ef78130eab0d83f38e4e946febfe5bc48922 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 12 Jul 2016 10:34:50 +0200 Subject: MouseDevice: add wheel axes handling Change-Id: Ie2a7c3e6e4c5ec10358bac70055c28fa81bbc117 Task-number: QTBUG-54620 Reviewed-by: Paul Lemire --- src/input/backend/inputhandler.cpp | 1 + src/input/backend/mousedevice.cpp | 18 +++++++++++++++++- src/input/backend/mousedevice_p.h | 5 +++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/input/backend/inputhandler.cpp b/src/input/backend/inputhandler.cpp index 82b017b1c..fe2a04bd7 100644 --- a/src/input/backend/inputhandler.cpp +++ b/src/input/backend/inputhandler.cpp @@ -249,6 +249,7 @@ QVector InputHandler::mouseJobs() MouseDevice *controller = m_mouseDeviceManager->data(cHandle); controller->updateMouseEvents(mouseEvents); + controller->updateWheelEvents(wheelEvents); // Event dispacthing job if (!mouseEvents.isEmpty() || !wheelEvents.empty()) { // Send the events to the mouse handlers that have for sourceDevice controller diff --git a/src/input/backend/mousedevice.cpp b/src/input/backend/mousedevice.cpp index a2f106d94..e649824a4 100644 --- a/src/input/backend/mousedevice.cpp +++ b/src/input/backend/mousedevice.cpp @@ -84,7 +84,10 @@ float MouseDevice::axisValue(int axisIdentifier) const return m_mouseState.xAxis; case QMouseDevice::Y: return m_mouseState.yAxis; - break; + case QMouseDevice::WheelX: + return m_mouseState.wXAxis; + case QMouseDevice::WheelY: + return m_mouseState.wYAxis; default: break; } @@ -106,6 +109,19 @@ bool MouseDevice::isButtonPressed(int buttonIdentifier) const return false; } +void MouseDevice::updateWheelEvents(const QList &events) +{ + // Reset axis values before we accumulate new values for this frame + m_mouseState.wXAxis = 0.0f; + m_mouseState.wYAxis = 0.0f; + if (!events.isEmpty()) { + for (const QT_PREPEND_NAMESPACE(QWheelEvent) &e : events) { + m_mouseState.wXAxis += m_sensitivity * e.angleDelta().x(); + m_mouseState.wYAxis += m_sensitivity * e.angleDelta().y(); + } + } +} + void MouseDevice::updateMouseEvents(const QList &events) { // Reset axis values before we accumulate new values for this frame diff --git a/src/input/backend/mousedevice_p.h b/src/input/backend/mousedevice_p.h index 723945554..02a6d916e 100644 --- a/src/input/backend/mousedevice_p.h +++ b/src/input/backend/mousedevice_p.h @@ -76,6 +76,7 @@ public: bool isButtonPressed(int buttonIdentifier) const Q_DECL_OVERRIDE; void updateMouseEvents(const QList &events); + void updateWheelEvents(const QList &events); protected: void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE; @@ -90,6 +91,8 @@ private: MouseState() : xAxis(0.0f) , yAxis(0.0f) + , wXAxis(0.0f) + , wYAxis(0.0f) , leftPressed(false) , rightPressed(false) , centerPressed(false) @@ -97,6 +100,8 @@ private: float xAxis; float yAxis; + float wXAxis; + float wYAxis; bool leftPressed; bool rightPressed; bool centerPressed; -- cgit v1.2.3 From 377cab78bbbbbf37a3ed87e9eec7602c6cb6837e Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 7 Sep 2016 15:29:01 +0300 Subject: Fix non-symmetric extents and resolutions for QCuboidMesh Task-number: QTBUG-55836 Change-Id: Ic5ee72f5ffb236fe15e46fa667159a139ad05b03 Reviewed-by: Sean Harmer --- src/extras/geometries/qcuboidgeometry.cpp | 34 ++-- .../extras/qcuboidgeometry/tst_qcuboidgeometry.cpp | 180 +++++++++++++++++++-- 2 files changed, 185 insertions(+), 29 deletions(-) diff --git a/src/extras/geometries/qcuboidgeometry.cpp b/src/extras/geometries/qcuboidgeometry.cpp index f720f1367..4e644b24a 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(j) * da; - const float u = static_cast(j) * du; + for (int j = resolution.height() - 1; j >= 0; --j) { + const float b = b0 + static_cast(j) * db; + const float v = static_cast(j) * dv; // Iterate over y - for (int i = 0; i < resolution.height(); ++i) { - const float b = b0 + static_cast(i) * db; - const float v = static_cast(i) * dv; + for (int i = 0; i < resolution.width(); ++i) { + const float a = a0 + static_cast(i) * da; + const float u = static_cast(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(j) * da; - const float u = static_cast(j) * du; + const float b = b0 + static_cast(j) * db; + const float v = static_cast(j) * dv; // Iterate over y for (int i = 0; i < resolution.width(); ++i) { - const float b = b0 + static_cast(i) * db; - const float v = static_cast(i) * dv; + const float a = a0 + static_cast(i) * da; + const float u = static_cast(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/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(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(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(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(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() << 0 << 1 << 2); + const auto positions = (QVector() + << 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(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(1.0f, 0.0f) + << QVector2D(1.0f, 1.0f) + << QVector2D(0.75f, 0.0f)); + const auto tangents = (QVector() + << 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() << 18 << 17 << 19); + const auto positions = (QVector() + << 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(-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(0.0f, 0.0f) + << QVector2D(0.25f, 1.0f) + << QVector2D(0.0f, 1.0f)); + const auto tangents = (QVector() + << 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() << 20 << 21 << 22); + const auto positions = (QVector() + << 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(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(0.0f, 0.0f) + << QVector2D(1.0f, 0.0f) + << QVector2D(0.0f, 0.125f)); + const auto tangents = (QVector() + << 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() << 54 << 53 << 55); + const auto positions = (QVector() + << 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(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(0.0f, 1.0f) + << QVector2D(1.0f, 0.875f) + << QVector2D(1.0f, 1.0f)); + const auto tangents = (QVector() + << 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() << 56 << 57 << 58); + const auto positions = (QVector() + << 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(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(0.0f, 0.0f) + << QVector2D(1.0f, 0.0f) + << QVector2D(0.0f, 0.5f)); + const auto tangents = (QVector() + << 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() << 66 << 65 << 67); + const auto positions = (QVector() + << 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(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(0.0f, 1.0f) + << QVector2D(1.0f, 0.5f) + << QVector2D(1.0f, 1.0f)); + const auto tangents = (QVector() + << 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() -- cgit v1.2.3 From ddac1eed1d39f5f924d88820472cca414b2b9f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Tue, 6 Sep 2016 15:44:19 +0300 Subject: Fix QCameraLens module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's in render module not in core. Change-Id: Ic42b65c365308915e38a42561f167f81d30c3b72 Reviewed-by: Miikka Heikkinen Reviewed-by: Tomi Korpipää Reviewed-by: Paul Lemire Reviewed-by: Sean Harmer --- src/render/frontend/qcameralens.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/render/frontend/qcameralens.cpp b/src/render/frontend/qcameralens.cpp index 3073fbc3f..4725251b5 100644 --- a/src/render/frontend/qcameralens.cpp +++ b/src/render/frontend/qcameralens.cpp @@ -46,7 +46,7 @@ namespace Qt3DRender { /*! * \class Qt3DRender::QCameraLens - * \inmodule Qt3DCore + * \inmodule Qt3DRender * * \brief Qt3DRender::QCameraLens specifies the projection matrix that will be used to * define a Camera for a 3D scene. @@ -57,7 +57,7 @@ namespace Qt3DRender { /*! * \qmltype CameraLens * \instantiates Qt3DRender::QCameraLens - * \inqmlmodule Qt3D.Core + * \inqmlmodule Qt3D.Render * \inherits Component3D * \since 5.5 * \brief Provides the projection matrix that is used to define a Camera for 3D scene. -- cgit v1.2.3 From 73e1f94e557709a3c4d59eb94314701319c3c1d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Thu, 8 Sep 2016 16:19:29 +0300 Subject: Update QClearbuffers docs Change-Id: I1209a4ec7c0775e16debbce864e965eb3df13771 Reviewed-by: Sean Harmer --- src/render/framegraph/qclearbuffers.cpp | 56 ++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 25 deletions(-) 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) { -- cgit v1.2.3 From 99bc5335a06cf0a567b76bf9ac36bf747f4ce8e8 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 5 Jul 2016 16:21:20 +0200 Subject: Renderer: get rid of QVariant for backend uniforms Change-Id: Ib4d6f178ec2f6bb19f26e09ad74ba77d2c752627 Reviewed-by: Sean Harmer --- src/render/backend/commandexecuter.cpp | 8 +- src/render/backend/quniformvalue.cpp | 32 +------ src/render/backend/quniformvalue_p.h | 119 +------------------------ src/render/backend/renderview.cpp | 118 ++++++++++++------------ src/render/backend/renderview_p.h | 46 +++++----- src/render/graphicshelpers/graphicscontext.cpp | 112 +++++++++++++++++++++-- src/render/graphicshelpers/graphicscontext_p.h | 2 + src/render/jobs/renderviewjobutils.cpp | 4 +- src/render/jobs/renderviewjobutils_p.h | 5 +- 9 files changed, 203 insertions(+), 243 deletions(-) diff --git a/src/render/backend/commandexecuter.cpp b/src/render/backend/commandexecuter.cpp index 92f44c511..2f13b27ea 100644 --- a/src/render/backend/commandexecuter.cpp +++ b/src/render/backend/commandexecuter.cpp @@ -251,13 +251,9 @@ QJsonObject parameterPackToJson(const Render::ShaderParameterPack &pack) for (auto it = uniforms.cbegin(), end = uniforms.cend(); it != end; ++it) { QJsonObject uniformObj; uniformObj.insert(QLatin1String("name"), Render::StringToInt::lookupString(it.key())); - const Render::QUniformValue::UniformType type = it.value().type(); - uniformObj.insert(QLatin1String("value"), - type == Render::QUniformValue::Value - ? typeToJsonValue(it.value().value()) - : typeToJsonValue(it.value().textureId())); + const Render::UniformValue::ValueType type = it.value().valueType(); uniformObj.insert(QLatin1String("type"), - type == Render::QUniformValue::Value + type == Render::UniformValue::ScalarValue ? QLatin1String("value") : QLatin1String("texture")); uniformsArray.push_back(uniformObj); diff --git a/src/render/backend/quniformvalue.cpp b/src/render/backend/quniformvalue.cpp index 09327c213..b7eaf2023 100644 --- a/src/render/backend/quniformvalue.cpp +++ b/src/render/backend/quniformvalue.cpp @@ -55,42 +55,12 @@ QT_BEGIN_NAMESPACE namespace Qt3DRender { namespace Render { -void QUniformValue::apply(GraphicsContext *ctx, const ShaderUniform &description) const -{ - switch (m_type) { - case Value: - ctx->bindUniform(m_var, description); - break; - - case TextureSampler: - // We assume that the texture has been successfully bound and attache to a texture unit - if (m_textureIdUnit.m_textureUnit != -1) { - ctx->bindUniform(m_textureIdUnit.m_textureUnit, description); -#if defined(QT3D_RENDER_ASPECT_OPENGL_DEBUG) - int err = ctx->openGLContext()->functions()->glGetError(); - if (err) { - qCWarning(Render::Backend, "Error %d after setting uniform \"%s\" at location %d", - err, qUtf8Printable(description.m_name), description.m_location); - } -#endif - } else { - qCWarning(Render::Backend, "Invalid texture unit supplied for \"%s\"", - qUtf8Printable(description.m_nameId)); - } - break; - - default: - break; - } -} - - ShaderParameterPack::~ShaderParameterPack() { m_uniforms.clear(); } -void ShaderParameterPack::setUniform(const int glslNameId, const QUniformValue &val) +void ShaderParameterPack::setUniform(const int glslNameId, const UniformValue &val) { m_uniforms.insert(glslNameId, val); } diff --git a/src/render/backend/quniformvalue_p.h b/src/render/backend/quniformvalue_p.h index fb8158d84..50a97c6b7 100644 --- a/src/render/backend/quniformvalue_p.h +++ b/src/render/backend/quniformvalue_p.h @@ -58,6 +58,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -72,118 +73,6 @@ namespace Render { class GraphicsContext; -class QUniformValue -{ -public: - enum UniformType { - Value, - TextureSampler, - Unknown - }; - - QUniformValue() - : m_type(Unknown) - , m_var() - { - } - - explicit QUniformValue(const QVariant &var, UniformType type = Value) - : m_type(type) - , m_var(var) - { - } - - void setType(UniformType type) Q_DECL_NOTHROW { m_type = type; } - UniformType type() const Q_DECL_NOTHROW { return m_type; } - bool isTexture() const Q_DECL_NOTHROW { return m_type == TextureSampler; } - - void setValue(const QVariant &value) - { - Q_ASSERT(m_type == Value); - m_var = value; - } - - QVariant value() const - { - Q_ASSERT(m_type == Value); - return m_var; - } - - void setTextureUnit(int textureUnit) - { - Q_ASSERT(m_type == TextureSampler); - m_textureIdUnit.m_textureUnit = textureUnit; - } - - int textureUnit() const - { - Q_ASSERT(m_type == TextureSampler); - return m_textureIdUnit.m_textureUnit; - } - - void setTextureId(Qt3DCore::QNodeId textureId) - { - Q_ASSERT(m_type == TextureSampler); - m_textureIdUnit.m_textureId = textureId; - } - - Qt3DCore::QNodeId textureId() const - { - Q_ASSERT(m_type == TextureSampler); - return m_textureIdUnit.m_textureId; - } - - bool operator ==(const QUniformValue &other) - { - if (other.m_type != m_type) - return false; - - switch (m_type) { - case Value: - return other.m_var == m_var; - case TextureSampler: - return other.m_textureIdUnit == m_textureIdUnit; - default: - break; - } - return false; - } - - bool operator !=(const QUniformValue &other) - { - return !operator ==(other); - } - - void apply(GraphicsContext *ctx, const ShaderUniform &description) const; - -protected: - struct TextureIdUnit { - Qt3DCore::QNodeId m_textureId; - int m_textureUnit; - - TextureIdUnit() - : m_textureId() - , m_textureUnit(-1) - {} - - bool operator == (const TextureIdUnit &other) const Q_DECL_NOTHROW - { - return (other.m_textureId == m_textureId) && (other.m_textureUnit == m_textureUnit); - } - - bool operator !=(const TextureIdUnit &other) const Q_DECL_NOTHROW - { - return !operator ==(other); - } - }; - - // TODO: Replace QVariant with our own union of GLSL types as we don't - // need the full flexibility of QVariant on the backend - UniformType m_type; - QVariant m_var; - TextureIdUnit m_textureIdUnit; -}; - struct BlockToUBO { int m_blockIndex; Qt3DCore::QNodeId m_bufferID; @@ -199,14 +88,14 @@ struct BlockToSSBO { QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, BlockToSSBO, Q_PRIMITIVE_TYPE) -typedef QHash PackUniformHash; +typedef QHash PackUniformHash; class ShaderParameterPack { public: ~ShaderParameterPack(); - void setUniform(const int glslNameId, const QUniformValue &val); + void setUniform(const int glslNameId, const UniformValue &val); void setTexture(const int glslNameId, Qt3DCore::QNodeId id); void setUniformBuffer(BlockToUBO blockToUBO); void setShaderStorageBuffer(BlockToSSBO blockToSSBO); @@ -214,7 +103,7 @@ public: inline PackUniformHash &uniforms() { return m_uniforms; } inline const PackUniformHash &uniforms() const { return m_uniforms; } - QUniformValue uniform(const int glslNameId) const { return m_uniforms.value(glslNameId); } + UniformValue uniform(const int glslNameId) const { return m_uniforms.value(glslNameId); } struct NamedTexture { diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp index 552e66f6d..8594f2d20 100644 --- a/src/render/backend/renderview.cpp +++ b/src/render/backend/renderview.cpp @@ -133,80 +133,80 @@ RenderView::StandardUniformsPFuncsHash RenderView::initializeStandardUniformSett return setters; } -QUniformValue RenderView::modelMatrix(const QMatrix4x4 &model) const +UniformValue RenderView::modelMatrix(const QMatrix4x4 &model) const { - return QUniformValue(QVariant::fromValue(model)); + return UniformValue(model); } -QUniformValue RenderView::viewMatrix(const QMatrix4x4 &) const +UniformValue RenderView::viewMatrix(const QMatrix4x4 &) const { - return QUniformValue(QVariant::fromValue(m_data.m_viewMatrix)); + return UniformValue(m_data.m_viewMatrix); } -QUniformValue RenderView::projectionMatrix(const QMatrix4x4 &) const +UniformValue RenderView::projectionMatrix(const QMatrix4x4 &) const { - return QUniformValue(QVariant::fromValue(m_data.m_renderCameraLens->projection())); + return UniformValue(m_data.m_renderCameraLens->projection()); } -QUniformValue RenderView::modelViewMatrix(const QMatrix4x4 &model) const +UniformValue RenderView::modelViewMatrix(const QMatrix4x4 &model) const { - return QUniformValue(QVariant::fromValue(m_data.m_viewMatrix * model)); + return UniformValue(m_data.m_viewMatrix * model); } -QUniformValue RenderView::viewProjectionMatrix(const QMatrix4x4 &model) const +UniformValue RenderView::viewProjectionMatrix(const QMatrix4x4 &model) const { Q_UNUSED(model); - return QUniformValue(QVariant::fromValue(m_data.m_renderCameraLens->projection() * m_data.m_viewMatrix)); + return UniformValue(m_data.m_renderCameraLens->projection() * m_data.m_viewMatrix); } -QUniformValue RenderView::modelViewProjectionMatrix(const QMatrix4x4 &model) const +UniformValue RenderView::modelViewProjectionMatrix(const QMatrix4x4 &model) const { - return QUniformValue(QVariant::fromValue(m_data.m_viewProjectionMatrix * model)); + return UniformValue(m_data.m_viewProjectionMatrix * model); } -QUniformValue RenderView::inverseModelMatrix(const QMatrix4x4 &model) const +UniformValue RenderView::inverseModelMatrix(const QMatrix4x4 &model) const { - return QUniformValue(QVariant::fromValue(model.inverted())); + return UniformValue(model.inverted()); } -QUniformValue RenderView::inverseViewMatrix(const QMatrix4x4 &) const +UniformValue RenderView::inverseViewMatrix(const QMatrix4x4 &) const { - return QUniformValue(QVariant::fromValue(m_data.m_viewMatrix.inverted())); + return UniformValue(m_data.m_viewMatrix.inverted()); } -QUniformValue RenderView::inverseProjectionMatrix(const QMatrix4x4 &) const +UniformValue RenderView::inverseProjectionMatrix(const QMatrix4x4 &) const { QMatrix4x4 projection; if (m_data.m_renderCameraLens) projection = m_data.m_renderCameraLens->projection(); - return QUniformValue(QVariant::fromValue(projection.inverted())); + return UniformValue(projection.inverted()); } -QUniformValue RenderView::inverseModelViewMatrix(const QMatrix4x4 &model) const +UniformValue RenderView::inverseModelViewMatrix(const QMatrix4x4 &model) const { - return QUniformValue(QVariant::fromValue((m_data.m_viewMatrix * model).inverted())); + return UniformValue((m_data.m_viewMatrix * model).inverted()); } -QUniformValue RenderView::inverseViewProjectionMatrix(const QMatrix4x4 &model) const +UniformValue RenderView::inverseViewProjectionMatrix(const QMatrix4x4 &model) const { Q_UNUSED(model); const auto viewProjectionMatrix = m_data.m_renderCameraLens->projection() * m_data.m_viewMatrix; - return QUniformValue(QVariant::fromValue(viewProjectionMatrix.inverted())); + return UniformValue(viewProjectionMatrix.inverted()); } -QUniformValue RenderView::inverseModelViewProjectionMatrix(const QMatrix4x4 &model) const +UniformValue RenderView::inverseModelViewProjectionMatrix(const QMatrix4x4 &model) const { - return QUniformValue(QVariant::fromValue((m_data.m_viewProjectionMatrix * model).inverted(0))); + return UniformValue((m_data.m_viewProjectionMatrix * model).inverted(0)); } -QUniformValue RenderView::modelNormalMatrix(const QMatrix4x4 &model) const +UniformValue RenderView::modelNormalMatrix(const QMatrix4x4 &model) const { - return QUniformValue(QVariant::fromValue(model.normalMatrix())); + return UniformValue(model.normalMatrix()); } -QUniformValue RenderView::modelViewNormalMatrix(const QMatrix4x4 &model) const +UniformValue RenderView::modelViewNormalMatrix(const QMatrix4x4 &model) const { - return QUniformValue(QVariant::fromValue((m_data.m_viewMatrix * model).normalMatrix())); + return UniformValue((m_data.m_viewMatrix * model).normalMatrix()); } // TODO: Move this somewhere global where GraphicsContext::setViewport() can use it too @@ -218,38 +218,38 @@ static QRectF resolveViewport(const QRectF &fractionalViewport, const QSize &sur fractionalViewport.height() * surfaceSize.height()); } -QUniformValue RenderView::viewportMatrix(const QMatrix4x4 &model) const +UniformValue RenderView::viewportMatrix(const QMatrix4x4 &model) const { // TODO: Can we avoid having to pass the model matrix in to these functions? Q_UNUSED(model); QMatrix4x4 viewportMatrix; viewportMatrix.viewport(resolveViewport(m_viewport, m_surfaceSize)); - return QUniformValue(QVariant::fromValue(viewportMatrix)); + return UniformValue(viewportMatrix); } -QUniformValue RenderView::inverseViewportMatrix(const QMatrix4x4 &model) const +UniformValue RenderView::inverseViewportMatrix(const QMatrix4x4 &model) const { Q_UNUSED(model); QMatrix4x4 viewportMatrix; viewportMatrix.viewport(resolveViewport(m_viewport, m_surfaceSize)); QMatrix4x4 inverseViewportMatrix = viewportMatrix.inverted(); - return QUniformValue(QVariant::fromValue(inverseViewportMatrix)); + return UniformValue(inverseViewportMatrix); } -QUniformValue RenderView::time(const QMatrix4x4 &model) const +UniformValue RenderView::time(const QMatrix4x4 &model) const { Q_UNUSED(model); qint64 time = m_renderer->time(); float t = time / 1000000000.0f; - return QUniformValue(QVariant(t)); + return UniformValue(t); } -QUniformValue RenderView::eyePosition(const QMatrix4x4 &model) const +UniformValue RenderView::eyePosition(const QMatrix4x4 &model) const { Q_UNUSED(model); - return QUniformValue(QVariant::fromValue(m_data.m_eyePos)); + return UniformValue(m_data.m_eyePos); } RenderView::RenderView() @@ -326,7 +326,7 @@ void RenderView::sort() // sharing the same material (shader) are rendered, we can't have the case // where two uniforms, referencing the same texture eventually have 2 different // texture unit values - const QUniformValue refValue = cachedUniforms.value(it.key()); + const UniformValue refValue = cachedUniforms.value(it.key()); if (it.value() == refValue) { it = uniforms.erase(it); } else { @@ -532,27 +532,24 @@ void RenderView::updateMatrices() } } -void RenderView::setUniformValue(ShaderParameterPack &uniformPack, int nameId, const QVariant &value) const +void RenderView::setUniformValue(ShaderParameterPack &uniformPack, int nameId, const UniformValue &value) const { - Texture *tex = nullptr; // At this point a uniform value can only be a scalar type // or a Qt3DCore::QNodeId corresponding to a Texture // ShaderData/Buffers would be handled as UBO/SSBO and would therefore // not be in the default uniform block - if (static_cast(value.userType()) == qNodeIdTypeId) { - // Speed up conversion to avoid using QVariant::value() - const Qt3DCore::QNodeId texId = variant_value(value); + if (value.valueType() == UniformValue::NodeId) { + Texture *tex = nullptr; + const Qt3DCore::QNodeId texId = *value.constData(); if ((tex = m_manager->textureManager()->lookupResource(texId)) != nullptr) { uniformPack.setTexture(nameId, tex->peerId()); - //TextureUniform *texUniform = m_allocator->allocate(); - QUniformValue texUniform; - texUniform.setType(QUniformValue::TextureSampler); - texUniform.setTextureId(tex->peerId()); - uniformPack.setUniform(nameId, texUniform); + UniformValue::Texture textureValue; + textureValue.nodeId = texId; + uniformPack.setUniform(nameId, UniformValue(textureValue)); } } else { - uniformPack.setUniform(nameId, QUniformValue(value)); + uniformPack.setUniform(nameId, value); } } @@ -564,14 +561,14 @@ void RenderView::setStandardUniformValue(ShaderParameterPack &uniformPack, int g void RenderView::setUniformBlockValue(ShaderParameterPack &uniformPack, Shader *shader, const ShaderUniformBlock &block, - const QVariant &value) const + const UniformValue &value) const { Q_UNUSED(shader) - if (static_cast(value.userType()) == qNodeIdTypeId) { + if (value.valueType() == UniformValue::NodeId) { Buffer *buffer = nullptr; - if ((buffer = m_manager->bufferManager()->lookupResource(variant_value(value))) != nullptr) { + if ((buffer = m_manager->bufferManager()->lookupResource(*value.constData())) != nullptr) { BlockToUBO uniformBlockUBO; uniformBlockUBO.m_blockIndex = block.m_index; uniformBlockUBO.m_bufferID = buffer->peerId(); @@ -634,12 +631,12 @@ void RenderView::setUniformBlockValue(ShaderParameterPack &uniformPack, void RenderView::setShaderStorageValue(ShaderParameterPack &uniformPack, Shader *shader, const ShaderStorageBlock &block, - const QVariant &value) const + const UniformValue &value) const { Q_UNUSED(shader) - if (static_cast(value.userType()) == qNodeIdTypeId) { + if (value.valueType() == UniformValue::NodeId) { Buffer *buffer = nullptr; - if ((buffer = m_manager->bufferManager()->lookupResource(variant_value(value))) != nullptr) { + if ((buffer = m_manager->bufferManager()->lookupResource(*value.constData())) != nullptr) { BlockToSSBO shaderStorageBlock; shaderStorageBlock.m_blockIndex = block.m_index; shaderStorageBlock.m_bufferID = buffer->peerId(); @@ -668,8 +665,9 @@ void RenderView::setDefaultUniformBlockShaderDataValue(ShaderParameterPack &unif QHash::const_iterator activeValuesIt = builder->activeUniformNamesToValue.constBegin(); const QHash::const_iterator activeValuesEnd = builder->activeUniformNamesToValue.constEnd(); + // TO DO: Make the ShaderData store UniformValue while (activeValuesIt != activeValuesEnd) { - setUniformValue(uniformPack, activeValuesIt.key(), activeValuesIt.value()); + setUniformValue(uniformPack, activeValuesIt.key(), UniformValue::fromVariant(activeValuesIt.value())); ++activeValuesIt; } } @@ -769,10 +767,10 @@ void RenderView::setShaderAndUniforms(RenderCommand *command, RenderPass *rPass, } else if (shaderStorageBlockNamesIds.indexOf(it->nameId) != -1) { // Parameters is a SSBO setShaderStorageValue(command->m_parameterPack, shader, shader->storageBlockForBlockNameId(it->nameId), it->value); } else { // Parameter is a struct - const QVariant &v = it->value; + const UniformValue &v = it->value; ShaderData *shaderData = nullptr; - if (static_cast(v.userType()) == qNodeIdTypeId && - (shaderData = m_manager->shaderDataManager()->lookupResource(variant_value(v))) != nullptr) { + if (v.valueType() == UniformValue::NodeId && + (shaderData = m_manager->shaderDataManager()->lookupResource(*v.constData())) != nullptr) { // Try to check if we have a struct or array matching a QShaderData parameter setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader, shaderData, StringToInt::lookupString(it->nameId)); } @@ -797,6 +795,7 @@ void RenderView::setShaderAndUniforms(RenderCommand *command, RenderPass *rPass, if (lightIdx == MAX_LIGHTS) break; + // Note: implicit conversion of values to UniformValue setUniformValue(command->m_parameterPack, LIGHT_POSITION_NAMES[lightIdx], worldPos); setUniformValue(command->m_parameterPack, LIGHT_TYPE_NAMES[lightIdx], int(QAbstractLight::PointLight)); setUniformValue(command->m_parameterPack, LIGHT_COLOR_NAMES[lightIdx], QVector3D(1.0f, 1.0f, 1.0f)); @@ -812,9 +811,10 @@ void RenderView::setShaderAndUniforms(RenderCommand *command, RenderPass *rPass, } if (uniformNamesIds.contains(LIGHT_COUNT_NAME_ID)) - setUniformValue(command->m_parameterPack, LIGHT_COUNT_NAME_ID, qMax(1, lightIdx)); + setUniformValue(command->m_parameterPack, LIGHT_COUNT_NAME_ID, UniformValue(qMax(1, lightIdx))); if (activeLightSources.isEmpty()) { + // Note: implicit conversion of values to UniformValue setUniformValue(command->m_parameterPack, LIGHT_POSITION_NAMES[0], QVector3D(10.0f, 10.0f, 0.0f)); setUniformValue(command->m_parameterPack, LIGHT_TYPE_NAMES[0], int(QAbstractLight::PointLight)); setUniformValue(command->m_parameterPack, LIGHT_COLOR_NAMES[0], QVector3D(1.0f, 1.0f, 1.0f)); diff --git a/src/render/backend/renderview_p.h b/src/render/backend/renderview_p.h index f974741aa..41b0192c0 100644 --- a/src/render/backend/renderview_p.h +++ b/src/render/backend/renderview_p.h @@ -279,39 +279,39 @@ private: QHash> m_parameters; - typedef QHash StandardUniformsPFuncsHash; + typedef QHash StandardUniformsPFuncsHash; static StandardUniformsPFuncsHash ms_standardUniformSetters; static StandardUniformsPFuncsHash initializeStandardUniformSetters(); - QUniformValue modelMatrix(const QMatrix4x4& model) const; - QUniformValue viewMatrix(const QMatrix4x4&) const; - QUniformValue projectionMatrix(const QMatrix4x4 &) const; - QUniformValue modelViewMatrix(const QMatrix4x4 &model) const; - QUniformValue viewProjectionMatrix(const QMatrix4x4 &model) const; - QUniformValue modelViewProjectionMatrix(const QMatrix4x4 &model) const; - QUniformValue inverseModelMatrix(const QMatrix4x4 &model) const; - QUniformValue inverseViewMatrix(const QMatrix4x4 &) const; - QUniformValue inverseProjectionMatrix(const QMatrix4x4 &) const; - QUniformValue inverseModelViewMatrix(const QMatrix4x4 &model) const; - QUniformValue inverseViewProjectionMatrix(const QMatrix4x4 &model) const; - QUniformValue inverseModelViewProjectionMatrix(const QMatrix4x4 &model) const; - QUniformValue modelNormalMatrix(const QMatrix4x4 &model) const; - QUniformValue modelViewNormalMatrix(const QMatrix4x4 &model) const; - QUniformValue viewportMatrix(const QMatrix4x4 &model) const; - QUniformValue inverseViewportMatrix(const QMatrix4x4 &model) const; - QUniformValue time(const QMatrix4x4 &model) const; - QUniformValue eyePosition(const QMatrix4x4 &model) const; - - void setUniformValue(ShaderParameterPack &uniformPack, int nameId, const QVariant &value) const; + UniformValue modelMatrix(const QMatrix4x4& model) const; + UniformValue viewMatrix(const QMatrix4x4&) const; + UniformValue projectionMatrix(const QMatrix4x4 &) const; + UniformValue modelViewMatrix(const QMatrix4x4 &model) const; + UniformValue viewProjectionMatrix(const QMatrix4x4 &model) const; + UniformValue modelViewProjectionMatrix(const QMatrix4x4 &model) const; + UniformValue inverseModelMatrix(const QMatrix4x4 &model) const; + UniformValue inverseViewMatrix(const QMatrix4x4 &) const; + UniformValue inverseProjectionMatrix(const QMatrix4x4 &) const; + UniformValue inverseModelViewMatrix(const QMatrix4x4 &model) const; + UniformValue inverseViewProjectionMatrix(const QMatrix4x4 &model) const; + UniformValue inverseModelViewProjectionMatrix(const QMatrix4x4 &model) const; + UniformValue modelNormalMatrix(const QMatrix4x4 &model) const; + UniformValue modelViewNormalMatrix(const QMatrix4x4 &model) const; + UniformValue viewportMatrix(const QMatrix4x4 &model) const; + UniformValue inverseViewportMatrix(const QMatrix4x4 &model) const; + UniformValue time(const QMatrix4x4 &model) const; + UniformValue eyePosition(const QMatrix4x4 &model) const; + + void setUniformValue(ShaderParameterPack &uniformPack, int nameId, const UniformValue &value) const; void setStandardUniformValue(ShaderParameterPack &uniformPack, int glslNameId, int nameId, const QMatrix4x4 &worldTransform) const; void setUniformBlockValue(ShaderParameterPack &uniformPack, Shader *shader, const ShaderUniformBlock &block, - const QVariant &value) const; + const UniformValue &value) const; void setShaderStorageValue(ShaderParameterPack &uniformPack, Shader *shader, const ShaderStorageBlock &block, - const QVariant &value) const; + const UniformValue &value) const; void setDefaultUniformBlockShaderDataValue(ShaderParameterPack &uniformPack, Shader *shader, ShaderData *shaderData, diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp index 021637c24..9731e7c5e 100644 --- a/src/render/graphicshelpers/graphicscontext.cpp +++ b/src/render/graphicshelpers/graphicscontext.cpp @@ -1084,12 +1084,12 @@ void GraphicsContext::setParameters(ShaderParameterPack ¶meterPack) for (int i = 0; i < parameterPack.textures().size(); ++i) { const ShaderParameterPack::NamedTexture &namedTex = parameterPack.textures().at(i); Texture *t = manager->lookupResource(namedTex.texId); - // TO DO : Rework the way textures are loaded if (t != nullptr) { int texUnit = activateTexture(TextureScopeMaterial, t); if (uniformValues.contains(namedTex.glslNameId)) { - QUniformValue &texUniform = uniformValues[namedTex.glslNameId]; - texUniform.setTextureUnit(texUnit); + UniformValue &texUniform = uniformValues[namedTex.glslNameId]; + Q_ASSERT(texUniform.valueType() == UniformValue::TextureValue); + texUniform.data()->textureId = texUnit; } } } @@ -1145,8 +1145,7 @@ void GraphicsContext::setParameters(ShaderParameterPack ¶meterPack) for (const ShaderUniform &uniform : activeUniforms) { // We can use [] as we are sure the the uniform wouldn't // be un activeUniforms if there wasn't a matching value - const QUniformValue &value = values[uniform.m_nameId]; - value.apply(this, uniform); + applyUniform(uniform, values[uniform.m_nameId]); } } @@ -1176,6 +1175,109 @@ void GraphicsContext::disableAttribute(const GraphicsContext::VAOVertexAttribute prog->disableAttributeArray(attr.location); } +void GraphicsContext::applyUniform(const ShaderUniform &description, const UniformValue &v) +{ + const UniformType type = m_glHelper->uniformTypeFromGLType(description.m_type); + + switch (type) { + case UniformType::Float: + applyUniformHelper(description.m_location, v); + break; + case UniformType::Vec2: + applyUniformHelper(description.m_location, v); + break; + case UniformType::Vec3: + applyUniformHelper(description.m_location, v); + break; + case UniformType::Vec4: + applyUniformHelper(description.m_location, v); + break; + + case UniformType::Double: + applyUniformHelper(description.m_location, v); + break; + case UniformType::DVec2: + applyUniformHelper(description.m_location, v); + break; + case UniformType::DVec3: + applyUniformHelper(description.m_location, v); + break; + case UniformType::DVec4: + applyUniformHelper(description.m_location, v); + break; + + case UniformType::Sampler: + case UniformType::Int: + applyUniformHelper(description.m_location, v); + break; + case UniformType::IVec2: + applyUniformHelper(description.m_location, v); + break; + case UniformType::IVec3: + applyUniformHelper(description.m_location, v); + break; + case UniformType::IVec4: + applyUniformHelper(description.m_location, v); + break; + + case UniformType::UInt: + applyUniformHelper(description.m_location, v); + break; + case UniformType::UIVec2: + applyUniformHelper(description.m_location, v); + break; + case UniformType::UIVec3: + applyUniformHelper(description.m_location, v); + break; + case UniformType::UIVec4: + applyUniformHelper(description.m_location, v); + break; + + case UniformType::Bool: + applyUniformHelper(description.m_location, v); + break; + case UniformType::BVec2: + applyUniformHelper(description.m_location, v); + break; + case UniformType::BVec3: + applyUniformHelper(description.m_location, v); + break; + case UniformType::BVec4: + applyUniformHelper(description.m_location, v); + break; + + case UniformType::Mat2: + applyUniformHelper(description.m_location, v); + break; + case UniformType::Mat3: + applyUniformHelper(description.m_location, v); + break; + case UniformType::Mat4: + applyUniformHelper(description.m_location, v); + break; + case UniformType::Mat2x3: + applyUniformHelper(description.m_location, v); + break; + case UniformType::Mat3x2: + applyUniformHelper(description.m_location, v); + break; + case UniformType::Mat2x4: + applyUniformHelper(description.m_location, v); + break; + case UniformType::Mat4x2: + applyUniformHelper(description.m_location, v); + case UniformType::Mat3x4: + applyUniformHelper(description.m_location, v); + break; + case UniformType::Mat4x3: + applyUniformHelper(description.m_location, v); + break; + + default: + break; + } +} + // Note: needs to be called while VAO is bound void GraphicsContext::specifyAttribute(const Attribute *attribute, Buffer *buffer, int location) { diff --git a/src/render/graphicshelpers/graphicscontext_p.h b/src/render/graphicshelpers/graphicscontext_p.h index 7f380e250..b8b777434 100644 --- a/src/render/graphicshelpers/graphicscontext_p.h +++ b/src/render/graphicshelpers/graphicscontext_p.h @@ -317,6 +317,8 @@ private: void enableAttribute(const VAOVertexAttribute &attr); void disableAttribute(const VAOVertexAttribute &attr); + void applyUniform(const ShaderUniform &description, const UniformValue &v); + template void applyUniformHelper(int, const UniformValue &) const { diff --git a/src/render/jobs/renderviewjobutils.cpp b/src/render/jobs/renderviewjobutils.cpp index e5b763fcf..798828bd3 100644 --- a/src/render/jobs/renderviewjobutils.cpp +++ b/src/render/jobs/renderviewjobutils.cpp @@ -391,7 +391,7 @@ void addParametersForIds(ParameterInfoList *params, ParameterManager *manager, Parameter *param = manager->lookupResource(paramId); ParameterInfoList::iterator it = std::lower_bound(params->begin(), params->end(), param->nameId()); if (it == params->end() || it->nameId != param->nameId()) - params->insert(it, ParameterInfo(param->nameId(), param->value())); + params->insert(it, ParameterInfo(param->nameId(), param->uniformValue())); } } @@ -491,7 +491,7 @@ void UniformBlockValueBuilder::buildActiveUniformNameValueMapStructHelper(Shader } } -ParameterInfo::ParameterInfo(const int nameId, const QVariant &value) +ParameterInfo::ParameterInfo(const int nameId, const UniformValue &value) : nameId(nameId) , value(value) {} diff --git a/src/render/jobs/renderviewjobutils_p.h b/src/render/jobs/renderviewjobutils_p.h index 7f70690d7..df4753980 100644 --- a/src/render/jobs/renderviewjobutils_p.h +++ b/src/render/jobs/renderviewjobutils_p.h @@ -55,6 +55,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -106,10 +107,10 @@ Q_AUTOTEST_EXPORT inline T variant_value(const QVariant &v) struct ParameterInfo { - explicit ParameterInfo(const int nameId = -1, const QVariant &value = QVariant()); + explicit ParameterInfo(const int nameId = -1, const UniformValue &value = UniformValue()); int nameId; - QVariant value; + UniformValue value; bool operator<(const int otherNameId) const Q_DECL_NOEXCEPT; bool operator<(const ParameterInfo &other) const Q_DECL_NOEXCEPT; -- cgit v1.2.3 From 0cd9e1961d655443d36c563a701bc18c45e9b374 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 5 Jul 2016 16:21:41 +0200 Subject: Parameter: only store a UniformValue Change-Id: I6614c05fabb4fde72973a0e4738eb86efad7cc14 Reviewed-by: Paul Lemire Reviewed-by: Sean Harmer --- src/render/materialsystem/parameter.cpp | 7 ------- src/render/materialsystem/parameter_p.h | 2 -- 2 files changed, 9 deletions(-) diff --git a/src/render/materialsystem/parameter.cpp b/src/render/materialsystem/parameter.cpp index 22724552b..2cd026422 100644 --- a/src/render/materialsystem/parameter.cpp +++ b/src/render/materialsystem/parameter.cpp @@ -68,7 +68,6 @@ void Parameter::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &ch const auto &data = typedChange->data; m_name = data.name; m_nameId = StringToInt::lookupId(m_name); - m_value = data.backendValue; m_uniformValue = UniformValue::fromVariant(data.backendValue); } @@ -81,7 +80,6 @@ void Parameter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) m_name = propertyChange->value().toString(); m_nameId = StringToInt::lookupId(m_name); } else if (propertyChange->propertyName() == QByteArrayLiteral("value")) { - m_value = propertyChange->value(); m_uniformValue = UniformValue::fromVariant(propertyChange->value()); } markDirty(AbstractRenderer::AllDirty); @@ -95,11 +93,6 @@ QString Parameter::name() const return m_name; } -QVariant Parameter::value() const -{ - return m_value; -} - int Parameter::nameId() const Q_DECL_NOTHROW { return m_nameId; diff --git a/src/render/materialsystem/parameter_p.h b/src/render/materialsystem/parameter_p.h index 6e9833e1a..c6861ca36 100644 --- a/src/render/materialsystem/parameter_p.h +++ b/src/render/materialsystem/parameter_p.h @@ -73,7 +73,6 @@ public: void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE; QString name() const; - QVariant value() const; int nameId() const Q_DECL_NOTHROW; UniformValue uniformValue() const; @@ -81,7 +80,6 @@ private: void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL; QString m_name; - QVariant m_value; UniformValue m_uniformValue; int m_nameId; }; -- cgit v1.2.3 From 364f53038e4a24837bdc53255468832a8def1431 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 5 Jul 2016 16:39:20 +0200 Subject: GraphicsContext/Helpers: remove bindUniform Replaced by applyUniform and the various glUniform*v helpers Change-Id: Ibfb2daa1268ac2eee299e774d9b5d4e2f5b6bc74 Reviewed-by: Paul Lemire Reviewed-by: Sean Harmer --- src/render/graphicshelpers/graphicscontext.cpp | 5 - src/render/graphicshelpers/graphicscontext_p.h | 1 - src/render/graphicshelpers/graphicshelperes2.cpp | 102 ------------ src/render/graphicshelpers/graphicshelperes2_p.h | 1 - src/render/graphicshelpers/graphicshelperes3.cpp | 11 +- src/render/graphicshelpers/graphicshelperes3_p.h | 4 +- src/render/graphicshelpers/graphicshelpergl2.cpp | 92 ----------- src/render/graphicshelpers/graphicshelpergl2_p.h | 1 - src/render/graphicshelpers/graphicshelpergl3.cpp | 176 --------------------- src/render/graphicshelpers/graphicshelpergl3_3.cpp | 176 --------------------- src/render/graphicshelpers/graphicshelpergl3_3_p.h | 1 - src/render/graphicshelpers/graphicshelpergl3_p.h | 1 - src/render/graphicshelpers/graphicshelpergl4.cpp | 176 --------------------- src/render/graphicshelpers/graphicshelpergl4_p.h | 1 - .../graphicshelpers/graphicshelperinterface_p.h | 1 - 15 files changed, 7 insertions(+), 742 deletions(-) diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp index 9731e7c5e..4c2d902f1 100644 --- a/src/render/graphicshelpers/graphicscontext.cpp +++ b/src/render/graphicshelpers/graphicscontext.cpp @@ -879,11 +879,6 @@ void GraphicsContext::bindFragOutputs(GLuint shader, const QHash & m_glHelper->bindFragDataLocation(shader, outputs); } -void GraphicsContext::bindUniform(const QVariant &v, const ShaderUniform &description) -{ - m_glHelper->bindUniform(v, description); -} - void GraphicsContext::bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) { m_glHelper->bindUniformBlock(programId, uniformBlockIndex, uniformBlockBinding); diff --git a/src/render/graphicshelpers/graphicscontext_p.h b/src/render/graphicshelpers/graphicscontext_p.h index b8b777434..bfe5a4be9 100644 --- a/src/render/graphicshelpers/graphicscontext_p.h +++ b/src/render/graphicshelpers/graphicscontext_p.h @@ -188,7 +188,6 @@ public: void bindBufferBase(GLenum target, GLuint bindingIndex, GLuint buffer); void bindFragOutputs(GLuint shader, const QHash &outputs); void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding); - void bindUniform(const QVariant &v, const ShaderUniform &description); void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding); void blendEquation(GLenum mode); void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor); diff --git a/src/render/graphicshelpers/graphicshelperes2.cpp b/src/render/graphicshelpers/graphicshelperes2.cpp index 812c1b2af..3a268cb5f 100644 --- a/src/render/graphicshelpers/graphicshelperes2.cpp +++ b/src/render/graphicshelpers/graphicshelperes2.cpp @@ -359,108 +359,6 @@ void GraphicsHelperES2::drawBuffers(GLsizei, const int *) qWarning() << "drawBuffers is not supported by ES 2.0"; } -void GraphicsHelperES2::bindUniform(const QVariant &v, const ShaderUniform &description) -{ - switch (description.m_type) { - - case GL_FLOAT: - m_funcs->glUniform1fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_FLOAT_VEC2: - m_funcs->glUniform2fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_FLOAT_VEC3: - m_funcs->glUniform3fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_FLOAT_VEC4: - m_funcs->glUniform4fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_FLOAT_MAT2: - m_funcs->glUniformMatrix2fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_FLOAT_MAT3: - m_funcs->glUniformMatrix3fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 9)); - break; - - case GL_FLOAT_MAT4: - m_funcs->glUniformMatrix4fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 16)); - break; - - case GL_INT: - m_funcs->glUniform1iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_INT_VEC2: - m_funcs->glUniform2iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_INT_VEC3: - m_funcs->glUniform3iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_INT_VEC4: - m_funcs->glUniform4iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_BOOL: - m_funcs->glUniform1iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_BOOL_VEC2: - m_funcs->glUniform2iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_BOOL_VEC3: - m_funcs->glUniform3iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_BOOL_VEC4: - m_funcs->glUniform4iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_SAMPLER_2D: - case GL_SAMPLER_CUBE: { - Q_ASSERT(description.m_size == 1); - m_funcs->glUniform1i(description.m_location, v.toInt()); - break; - } - - // ES 3.0+ - case GL_SAMPLER_3D: - case GL_SAMPLER_2D_SHADOW: - case GL_SAMPLER_CUBE_SHADOW: - case GL_SAMPLER_2D_ARRAY: - case GL_SAMPLER_2D_ARRAY_SHADOW: - qWarning() << Q_FUNC_INFO << "ES 3.0 uniform type" << description.m_type << "for" - << description.m_name << "is not supported in ES 2.0"; - break; - - default: - qWarning() << Q_FUNC_INFO << "unsupported uniform type:" << description.m_type << "for " << description.m_name; - break; - } -} - void GraphicsHelperES2::bindFragDataLocation(GLuint , const QHash &) { qCritical() << "bindFragDataLocation is not supported by ES 2.0"; diff --git a/src/render/graphicshelpers/graphicshelperes2_p.h b/src/render/graphicshelpers/graphicshelperes2_p.h index 73ec7ca52..52d68f691 100644 --- a/src/render/graphicshelpers/graphicshelperes2_p.h +++ b/src/render/graphicshelpers/graphicshelperes2_p.h @@ -74,7 +74,6 @@ public: void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE; void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE; void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE; - void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE; void blendEquation(GLenum mode) Q_DECL_OVERRIDE; void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE; void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE; diff --git a/src/render/graphicshelpers/graphicshelperes3.cpp b/src/render/graphicshelpers/graphicshelperes3.cpp index fe39d9d3f..eb492e98d 100644 --- a/src/render/graphicshelpers/graphicshelperes3.cpp +++ b/src/render/graphicshelpers/graphicshelperes3.cpp @@ -150,20 +150,17 @@ void GraphicsHelperES3::drawBuffers(GLsizei n, const int *bufs) m_extraFuncs->glDrawBuffers(n, drawBufs.constData()); } -void GraphicsHelperES3::bindUniform(const QVariant &v, const ShaderUniform &description) +UniformType GraphicsHelperES3::uniformTypeFromGLType(GLenum glType) { - switch (description.m_type) { + switch (glType) { case GL_SAMPLER_3D: case GL_SAMPLER_2D_SHADOW: case GL_SAMPLER_CUBE_SHADOW: case GL_SAMPLER_2D_ARRAY: case GL_SAMPLER_2D_ARRAY_SHADOW: - Q_ASSERT(description.m_size == 1); - m_funcs->glUniform1i(description.m_location, v.toInt()); - break; + return UniformType::Sampler; default: - GraphicsHelperES2::bindUniform(v, description); - break; + return GraphicsHelperES2::uniformTypeFromGLType(glType); } } diff --git a/src/render/graphicshelpers/graphicshelperes3_p.h b/src/render/graphicshelpers/graphicshelperes3_p.h index e5bb51c53..2844c140d 100644 --- a/src/render/graphicshelpers/graphicshelperes3_p.h +++ b/src/render/graphicshelpers/graphicshelperes3_p.h @@ -67,12 +67,14 @@ public: // QGraphicHelperInterface interface virtual void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) Q_DECL_OVERRIDE; - virtual void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE; virtual void drawBuffers(GLsizei n, const int *bufs) Q_DECL_OVERRIDE; virtual void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) Q_DECL_OVERRIDE; virtual void initializeHelper(QOpenGLContext *context, QAbstractOpenGLFunctions *functions) Q_DECL_OVERRIDE; virtual bool supportsFeature(Feature feature) const Q_DECL_OVERRIDE; virtual void vertexAttribDivisor(GLuint index, GLuint divisor) Q_DECL_OVERRIDE; + + UniformType uniformTypeFromGLType(GLenum glType) Q_DECL_OVERRIDE; + protected: QOpenGLExtraFunctions *m_extraFuncs = Q_NULLPTR; }; diff --git a/src/render/graphicshelpers/graphicshelpergl2.cpp b/src/render/graphicshelpers/graphicshelpergl2.cpp index d51dc0d19..1315b4ab8 100644 --- a/src/render/graphicshelpers/graphicshelpergl2.cpp +++ b/src/render/graphicshelpers/graphicshelpergl2.cpp @@ -358,98 +358,6 @@ void GraphicsHelperGL2::bindFragDataLocation(GLuint, const QHash & qCritical() << "bindFragDataLocation is not supported by GL 2.0"; } -void GraphicsHelperGL2::bindUniform(const QVariant &v, const ShaderUniform &description) -{ - switch (description.m_type) { - - case GL_FLOAT: - m_funcs->glUniform1fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_FLOAT_VEC2: - m_funcs->glUniform2fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_FLOAT_VEC3: - m_funcs->glUniform3fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_FLOAT_VEC4: - m_funcs->glUniform4fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_FLOAT_MAT2: - m_funcs->glUniformMatrix2fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_FLOAT_MAT3: - m_funcs->glUniformMatrix3fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 9)); - break; - - case GL_FLOAT_MAT4: - m_funcs->glUniformMatrix4fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 16)); - break; - - case GL_INT: - m_funcs->glUniform1iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_INT_VEC2: - m_funcs->glUniform2iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_INT_VEC3: - m_funcs->glUniform3iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_INT_VEC4: - m_funcs->glUniform4iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_BOOL: - m_funcs->glUniform1iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_BOOL_VEC2: - m_funcs->glUniform2iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_BOOL_VEC3: - m_funcs->glUniform3iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_BOOL_VEC4: - m_funcs->glUniform4iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_SAMPLER_2D: - case GL_SAMPLER_CUBE: { - Q_ASSERT(description.m_size == 1); - m_funcs->glUniform1i(description.m_location, v.toInt()); - break; - } - - default: - qWarning() << Q_FUNC_INFO << "unsupported uniform type:" << description.m_type << "for " << description.m_name; - break; - } -} - void GraphicsHelperGL2::bindFrameBufferObject(GLuint frameBufferId) { if (m_fboFuncs != nullptr) diff --git a/src/render/graphicshelpers/graphicshelpergl2_p.h b/src/render/graphicshelpers/graphicshelpergl2_p.h index 6b4f9b5b5..0352c77d3 100644 --- a/src/render/graphicshelpers/graphicshelpergl2_p.h +++ b/src/render/graphicshelpers/graphicshelpergl2_p.h @@ -76,7 +76,6 @@ public: void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE; void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE; void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE; - void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE; void blendEquation(GLenum mode) Q_DECL_OVERRIDE; void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE; void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE; diff --git a/src/render/graphicshelpers/graphicshelpergl3.cpp b/src/render/graphicshelpers/graphicshelpergl3.cpp index 970be3dd9..da1b95db8 100644 --- a/src/render/graphicshelpers/graphicshelpergl3.cpp +++ b/src/render/graphicshelpers/graphicshelpergl3.cpp @@ -410,182 +410,6 @@ void GraphicsHelperGL3::bindFragDataLocation(GLuint shader, const QHashglBindFragDataLocation(shader, it.value(), it.key().toStdString().c_str()); } -void GraphicsHelperGL3::bindUniform(const QVariant &v, const ShaderUniform &description) -{ - switch (description.m_type) { - - case GL_FLOAT: - m_funcs->glUniform1fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_FLOAT_VEC2: - m_funcs->glUniform2fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_FLOAT_VEC3: - m_funcs->glUniform3fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_FLOAT_VEC4: - m_funcs->glUniform4fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_FLOAT_MAT2: - m_funcs->glUniformMatrix2fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_FLOAT_MAT2x3: - m_funcs->glUniformMatrix2x3fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 6)); - break; - - case GL_FLOAT_MAT2x4: - m_funcs->glUniformMatrix2x4fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 8)); - break; - - case GL_FLOAT_MAT3: - m_funcs->glUniformMatrix3fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 9)); - break; - - case GL_FLOAT_MAT3x2: - m_funcs->glUniformMatrix3x2fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 6)); - break; - - case GL_FLOAT_MAT3x4: - m_funcs->glUniformMatrix3x4fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 12)); - break; - - case GL_FLOAT_MAT4: - m_funcs->glUniformMatrix4fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 16)); - break; - - case GL_FLOAT_MAT4x2: - m_funcs->glUniformMatrix4x2fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 8)); - break; - - case GL_FLOAT_MAT4x3: - m_funcs->glUniformMatrix4x3fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 12)); - break; - - case GL_INT: - m_funcs->glUniform1iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_INT_VEC2: - m_funcs->glUniform2iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_INT_VEC3: - m_funcs->glUniform3iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_INT_VEC4: - m_funcs->glUniform4iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_UNSIGNED_INT: - m_funcs->glUniform1uiv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_UNSIGNED_INT_VEC2: - m_funcs->glUniform2uiv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_UNSIGNED_INT_VEC3: - m_funcs->glUniform3uiv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_UNSIGNED_INT_VEC4: - m_funcs->glUniform4uiv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_BOOL: - m_funcs->glUniform1iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_BOOL_VEC2: - m_funcs->glUniform2iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_BOOL_VEC3: - m_funcs->glUniform3iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_BOOL_VEC4: - m_funcs->glUniform4iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_SAMPLER_1D: - case GL_SAMPLER_2D: - case GL_SAMPLER_3D: - case GL_SAMPLER_CUBE: - case GL_SAMPLER_BUFFER: - case GL_SAMPLER_2D_RECT: - case GL_INT_SAMPLER_1D: - case GL_INT_SAMPLER_2D: - case GL_INT_SAMPLER_3D: - case GL_INT_SAMPLER_CUBE: - case GL_INT_SAMPLER_BUFFER: - case GL_INT_SAMPLER_2D_RECT: - case GL_UNSIGNED_INT_SAMPLER_1D: - case GL_UNSIGNED_INT_SAMPLER_2D: - case GL_UNSIGNED_INT_SAMPLER_3D: - case GL_UNSIGNED_INT_SAMPLER_CUBE: - case GL_UNSIGNED_INT_SAMPLER_BUFFER: - case GL_UNSIGNED_INT_SAMPLER_2D_RECT: - case GL_SAMPLER_1D_SHADOW: - case GL_SAMPLER_2D_SHADOW: - case GL_SAMPLER_CUBE_SHADOW: - case GL_SAMPLER_1D_ARRAY: - case GL_SAMPLER_2D_ARRAY: - case GL_INT_SAMPLER_1D_ARRAY: - case GL_INT_SAMPLER_2D_ARRAY: - case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY: - case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: - case GL_SAMPLER_1D_ARRAY_SHADOW: - case GL_SAMPLER_2D_ARRAY_SHADOW: - case GL_SAMPLER_2D_RECT_SHADOW: - case GL_SAMPLER_2D_MULTISAMPLE: - case GL_INT_SAMPLER_2D_MULTISAMPLE: - case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE: - case GL_SAMPLER_2D_MULTISAMPLE_ARRAY: - case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: - case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: { - Q_ASSERT(description.m_size == 1); - m_funcs->glUniform1i(description.m_location, v.toInt()); - break; - } - - default: - qWarning() << Q_FUNC_INFO << "unsupported uniform type:" << description.m_type << "for " << description.m_name; - break; - } -} - void GraphicsHelperGL3::bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) { m_funcs->glUniformBlockBinding(programId, uniformBlockIndex, uniformBlockBinding); diff --git a/src/render/graphicshelpers/graphicshelpergl3_3.cpp b/src/render/graphicshelpers/graphicshelpergl3_3.cpp index b56a15dcc..53b89bdef 100644 --- a/src/render/graphicshelpers/graphicshelpergl3_3.cpp +++ b/src/render/graphicshelpers/graphicshelpergl3_3.cpp @@ -412,182 +412,6 @@ void GraphicsHelperGL3_3::bindFragDataLocation(GLuint shader, const QHashglBindFragDataLocation(shader, it.value(), it.key().toStdString().c_str()); } -void GraphicsHelperGL3_3::bindUniform(const QVariant &v, const ShaderUniform &description) -{ - switch (description.m_type) { - - case GL_FLOAT: - m_funcs->glUniform1fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_FLOAT_VEC2: - m_funcs->glUniform2fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_FLOAT_VEC3: - m_funcs->glUniform3fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_FLOAT_VEC4: - m_funcs->glUniform4fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_FLOAT_MAT2: - m_funcs->glUniformMatrix2fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_FLOAT_MAT2x3: - m_funcs->glUniformMatrix2x3fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 6)); - break; - - case GL_FLOAT_MAT2x4: - m_funcs->glUniformMatrix2x4fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 8)); - break; - - case GL_FLOAT_MAT3: - m_funcs->glUniformMatrix3fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 9)); - break; - - case GL_FLOAT_MAT3x2: - m_funcs->glUniformMatrix3x2fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 6)); - break; - - case GL_FLOAT_MAT3x4: - m_funcs->glUniformMatrix3x4fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 12)); - break; - - case GL_FLOAT_MAT4: - m_funcs->glUniformMatrix4fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 16)); - break; - - case GL_FLOAT_MAT4x2: - m_funcs->glUniformMatrix4x2fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 8)); - break; - - case GL_FLOAT_MAT4x3: - m_funcs->glUniformMatrix4x3fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 12)); - break; - - case GL_INT: - m_funcs->glUniform1iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_INT_VEC2: - m_funcs->glUniform2iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_INT_VEC3: - m_funcs->glUniform3iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_INT_VEC4: - m_funcs->glUniform4iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_UNSIGNED_INT: - m_funcs->glUniform1uiv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_UNSIGNED_INT_VEC2: - m_funcs->glUniform2uiv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_UNSIGNED_INT_VEC3: - m_funcs->glUniform3uiv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_UNSIGNED_INT_VEC4: - m_funcs->glUniform4uiv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_BOOL: - m_funcs->glUniform1iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_BOOL_VEC2: - m_funcs->glUniform2iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_BOOL_VEC3: - m_funcs->glUniform3iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_BOOL_VEC4: - m_funcs->glUniform4iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_SAMPLER_1D: - case GL_SAMPLER_2D: - case GL_SAMPLER_3D: - case GL_SAMPLER_CUBE: - case GL_SAMPLER_BUFFER: - case GL_SAMPLER_2D_RECT: - case GL_INT_SAMPLER_1D: - case GL_INT_SAMPLER_2D: - case GL_INT_SAMPLER_3D: - case GL_INT_SAMPLER_CUBE: - case GL_INT_SAMPLER_BUFFER: - case GL_INT_SAMPLER_2D_RECT: - case GL_UNSIGNED_INT_SAMPLER_1D: - case GL_UNSIGNED_INT_SAMPLER_2D: - case GL_UNSIGNED_INT_SAMPLER_3D: - case GL_UNSIGNED_INT_SAMPLER_CUBE: - case GL_UNSIGNED_INT_SAMPLER_BUFFER: - case GL_UNSIGNED_INT_SAMPLER_2D_RECT: - case GL_SAMPLER_1D_SHADOW: - case GL_SAMPLER_2D_SHADOW: - case GL_SAMPLER_CUBE_SHADOW: - case GL_SAMPLER_1D_ARRAY: - case GL_SAMPLER_2D_ARRAY: - case GL_INT_SAMPLER_1D_ARRAY: - case GL_INT_SAMPLER_2D_ARRAY: - case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY: - case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: - case GL_SAMPLER_1D_ARRAY_SHADOW: - case GL_SAMPLER_2D_ARRAY_SHADOW: - case GL_SAMPLER_2D_RECT_SHADOW: - case GL_SAMPLER_2D_MULTISAMPLE: - case GL_INT_SAMPLER_2D_MULTISAMPLE: - case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE: - case GL_SAMPLER_2D_MULTISAMPLE_ARRAY: - case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: - case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: { - Q_ASSERT(description.m_size == 1); - m_funcs->glUniform1i(description.m_location, v.toInt()); - break; - } - - default: - qWarning() << Q_FUNC_INFO << "unsupported uniform type:" << description.m_type << "for " << description.m_name; - break; - } -} - void GraphicsHelperGL3_3::bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) { m_funcs->glUniformBlockBinding(programId, uniformBlockIndex, uniformBlockBinding); diff --git a/src/render/graphicshelpers/graphicshelpergl3_3_p.h b/src/render/graphicshelpers/graphicshelpergl3_3_p.h index 8613c3c3e..bbea8806a 100644 --- a/src/render/graphicshelpers/graphicshelpergl3_3_p.h +++ b/src/render/graphicshelpers/graphicshelpergl3_3_p.h @@ -78,7 +78,6 @@ public: void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE; void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE; void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE; - void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE; void blendEquation(GLenum mode) Q_DECL_OVERRIDE; void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE; void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE; diff --git a/src/render/graphicshelpers/graphicshelpergl3_p.h b/src/render/graphicshelpers/graphicshelpergl3_p.h index b840d029a..3cc58bd26 100644 --- a/src/render/graphicshelpers/graphicshelpergl3_p.h +++ b/src/render/graphicshelpers/graphicshelpergl3_p.h @@ -77,7 +77,6 @@ public: void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE; void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE; void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE; - void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE; void blendEquation(GLenum mode) Q_DECL_OVERRIDE; void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE; void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE; diff --git a/src/render/graphicshelpers/graphicshelpergl4.cpp b/src/render/graphicshelpers/graphicshelpergl4.cpp index 49e0f9dde..230b02a63 100644 --- a/src/render/graphicshelpers/graphicshelpergl4.cpp +++ b/src/render/graphicshelpers/graphicshelpergl4.cpp @@ -608,182 +608,6 @@ void GraphicsHelperGL4::bindFragDataLocation(GLuint shader, const QHashglBindFragDataLocation(shader, it.value(), it.key().toStdString().c_str()); } -void GraphicsHelperGL4::bindUniform(const QVariant &v, const ShaderUniform &description) -{ - switch (description.m_type) { - - case GL_FLOAT: - m_funcs->glUniform1fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_FLOAT_VEC2: - m_funcs->glUniform2fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_FLOAT_VEC3: - m_funcs->glUniform3fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_FLOAT_VEC4: - m_funcs->glUniform4fv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_FLOAT_MAT2: - m_funcs->glUniformMatrix2fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_FLOAT_MAT2x3: - m_funcs->glUniformMatrix2x3fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 6)); - break; - - case GL_FLOAT_MAT2x4: - m_funcs->glUniformMatrix2x4fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 8)); - break; - - case GL_FLOAT_MAT3: - m_funcs->glUniformMatrix3fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 9)); - break; - - case GL_FLOAT_MAT3x2: - m_funcs->glUniformMatrix3x2fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 6)); - break; - - case GL_FLOAT_MAT3x4: - m_funcs->glUniformMatrix3x4fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 12)); - break; - - case GL_FLOAT_MAT4: - m_funcs->glUniformMatrix4fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 16)); - break; - - case GL_FLOAT_MAT4x2: - m_funcs->glUniformMatrix4x2fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 8)); - break; - - case GL_FLOAT_MAT4x3: - m_funcs->glUniformMatrix4x3fv(description.m_location, description.m_size, GL_FALSE, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 12)); - break; - - case GL_INT: - m_funcs->glUniform1iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_INT_VEC2: - m_funcs->glUniform2iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_INT_VEC3: - m_funcs->glUniform3iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_INT_VEC4: - m_funcs->glUniform4iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_UNSIGNED_INT: - m_funcs->glUniform1uiv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_UNSIGNED_INT_VEC2: - m_funcs->glUniform2uiv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_UNSIGNED_INT_VEC3: - m_funcs->glUniform3uiv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_UNSIGNED_INT_VEC4: - m_funcs->glUniform4uiv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_BOOL: - m_funcs->glUniform1iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 1)); - break; - - case GL_BOOL_VEC2: - m_funcs->glUniform2iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 2)); - break; - - case GL_BOOL_VEC3: - m_funcs->glUniform3iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 3)); - break; - - case GL_BOOL_VEC4: - m_funcs->glUniform4iv(description.m_location, description.m_size, - QGraphicsUtils::valueArrayFromVariant(v, description.m_size, 4)); - break; - - case GL_SAMPLER_1D: - case GL_SAMPLER_2D: - case GL_SAMPLER_3D: - case GL_SAMPLER_CUBE: - case GL_SAMPLER_BUFFER: - case GL_SAMPLER_2D_RECT: - case GL_INT_SAMPLER_1D: - case GL_INT_SAMPLER_2D: - case GL_INT_SAMPLER_3D: - case GL_INT_SAMPLER_CUBE: - case GL_INT_SAMPLER_BUFFER: - case GL_INT_SAMPLER_2D_RECT: - case GL_UNSIGNED_INT_SAMPLER_1D: - case GL_UNSIGNED_INT_SAMPLER_2D: - case GL_UNSIGNED_INT_SAMPLER_3D: - case GL_UNSIGNED_INT_SAMPLER_CUBE: - case GL_UNSIGNED_INT_SAMPLER_BUFFER: - case GL_UNSIGNED_INT_SAMPLER_2D_RECT: - case GL_SAMPLER_1D_SHADOW: - case GL_SAMPLER_2D_SHADOW: - case GL_SAMPLER_CUBE_SHADOW: - case GL_SAMPLER_1D_ARRAY: - case GL_SAMPLER_2D_ARRAY: - case GL_INT_SAMPLER_1D_ARRAY: - case GL_INT_SAMPLER_2D_ARRAY: - case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY: - case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: - case GL_SAMPLER_1D_ARRAY_SHADOW: - case GL_SAMPLER_2D_ARRAY_SHADOW: - case GL_SAMPLER_2D_RECT_SHADOW: - case GL_SAMPLER_2D_MULTISAMPLE: - case GL_INT_SAMPLER_2D_MULTISAMPLE: - case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE: - case GL_SAMPLER_2D_MULTISAMPLE_ARRAY: - case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: - case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: { - Q_ASSERT(description.m_size == 1); - m_funcs->glUniform1i(description.m_location, v.toInt()); - break; - } - - default: - qWarning() << Q_FUNC_INFO << "unsupported uniform type:" << description.m_type << "for " << description.m_name; - break; - } -} - void GraphicsHelperGL4::bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) { m_funcs->glUniformBlockBinding(programId, uniformBlockIndex, uniformBlockBinding); diff --git a/src/render/graphicshelpers/graphicshelpergl4_p.h b/src/render/graphicshelpers/graphicshelpergl4_p.h index b577f8279..ad4875f2e 100644 --- a/src/render/graphicshelpers/graphicshelpergl4_p.h +++ b/src/render/graphicshelpers/graphicshelpergl4_p.h @@ -76,7 +76,6 @@ public: void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE; void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE; void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE; - void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE; void blendEquation(GLenum mode) Q_DECL_OVERRIDE; void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE; void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE; diff --git a/src/render/graphicshelpers/graphicshelperinterface_p.h b/src/render/graphicshelpers/graphicshelperinterface_p.h index e5951e8af..1a7199a2c 100644 --- a/src/render/graphicshelpers/graphicshelperinterface_p.h +++ b/src/render/graphicshelpers/graphicshelperinterface_p.h @@ -88,7 +88,6 @@ public: virtual void bindFrameBufferObject(GLuint frameBufferId) = 0; virtual void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) = 0; virtual void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) = 0; - virtual void bindUniform(const QVariant &v, const ShaderUniform &description) = 0; virtual void blendEquation(GLenum mode) = 0; virtual void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) = 0; virtual void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) = 0; -- cgit v1.2.3 From 52121396c55e6100316f006c87b4fdaa8b5a0719 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 5 Jul 2016 16:58:13 +0200 Subject: Renamed files quniformvalue* to shaderparameterpack These files contains a class named ShaderParameterPack so filenames needed to be adjusted. Change-Id: I8735c753e2a741a6238780b40fb42143d4439e09 Reviewed-by: Paul Lemire Reviewed-by: Sean Harmer --- src/render/backend/quniformvalue.cpp | 100 ------------------ src/render/backend/quniformvalue_p.h | 141 ------------------------- src/render/backend/render-backend.pri | 8 +- src/render/backend/rendercommand_p.h | 2 +- src/render/backend/renderer_p.h | 2 +- src/render/backend/shaderparameterpack.cpp | 100 ++++++++++++++++++ src/render/backend/shaderparameterpack_p.h | 141 +++++++++++++++++++++++++ src/render/graphicshelpers/graphicscontext_p.h | 2 +- src/render/materialsystem/material_p.h | 2 +- src/render/materialsystem/shader_p.h | 2 +- 10 files changed, 250 insertions(+), 250 deletions(-) delete mode 100644 src/render/backend/quniformvalue.cpp delete mode 100644 src/render/backend/quniformvalue_p.h create mode 100644 src/render/backend/shaderparameterpack.cpp create mode 100644 src/render/backend/shaderparameterpack_p.h diff --git a/src/render/backend/quniformvalue.cpp b/src/render/backend/quniformvalue.cpp deleted file mode 100644 index b7eaf2023..000000000 --- a/src/render/backend/quniformvalue.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** 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$ -** -****************************************************************************/ - -#include "quniformvalue_p.h" - -#include -#include - -#include - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { -namespace Render { - -ShaderParameterPack::~ShaderParameterPack() -{ - m_uniforms.clear(); -} - -void ShaderParameterPack::setUniform(const int glslNameId, const UniformValue &val) -{ - m_uniforms.insert(glslNameId, val); -} - -void ShaderParameterPack::setTexture(const int glslNameId, Qt3DCore::QNodeId texId) -{ - for (int t=0; t -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QOpenGLShaderProgram; - -namespace Qt3DCore { -class QFrameAllocator; -} - -namespace Qt3DRender { -namespace Render { - -class GraphicsContext; - -struct BlockToUBO { - int m_blockIndex; - Qt3DCore::QNodeId m_bufferID; - bool m_needsUpdate; - QHash m_updatedProperties; -}; -QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, BlockToUBO, Q_MOVABLE_TYPE) - -struct BlockToSSBO { - int m_blockIndex; - Qt3DCore::QNodeId m_bufferID; -}; -QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, BlockToSSBO, Q_PRIMITIVE_TYPE) - - -typedef QHash PackUniformHash; - -class ShaderParameterPack -{ -public: - ~ShaderParameterPack(); - - void setUniform(const int glslNameId, const UniformValue &val); - void setTexture(const int glslNameId, Qt3DCore::QNodeId id); - void setUniformBuffer(BlockToUBO blockToUBO); - void setShaderStorageBuffer(BlockToSSBO blockToSSBO); - void setSubmissionUniform(const ShaderUniform &uniform); - - inline PackUniformHash &uniforms() { return m_uniforms; } - inline const PackUniformHash &uniforms() const { return m_uniforms; } - UniformValue uniform(const int glslNameId) const { return m_uniforms.value(glslNameId); } - - struct NamedTexture - { - NamedTexture() {} - NamedTexture(const int nm, Qt3DCore::QNodeId t) - : glslNameId(nm) - , texId(t) - { } - - int glslNameId; - Qt3DCore::QNodeId texId; - }; - - inline QVector textures() const { return m_textures; } - inline QVector uniformBuffers() const { return m_uniformBuffers; } - inline QVector shaderStorageBuffers() const { return m_shaderStorageBuffers; } - inline QVector submissionUniforms() const { return m_submissionUniforms; } -private: - PackUniformHash m_uniforms; - - QVector m_textures; - QVector m_uniformBuffers; - QVector m_shaderStorageBuffers; - QVector m_submissionUniforms; - - friend class RenderView; -}; -QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, ShaderParameterPack::NamedTexture, Q_PRIMITIVE_TYPE) - -} // namespace Render -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_RENDER_QUNIFORMVALUE_H diff --git a/src/render/backend/render-backend.pri b/src/render/backend/render-backend.pri index 0d7d9e57e..a55a72d8b 100644 --- a/src/render/backend/render-backend.pri +++ b/src/render/backend/render-backend.pri @@ -7,7 +7,6 @@ HEADERS += \ $$PWD/renderthread_p.h \ $$PWD/renderconfiguration_p.h \ $$PWD/renderer_p.h \ - $$PWD/quniformvalue_p.h \ $$PWD/renderview_p.h \ $$PWD/rendercommand_p.h \ $$PWD/renderqueue_p.h \ @@ -37,13 +36,13 @@ HEADERS += \ $$PWD/backendnode_p.h \ $$PWD/rendertargetoutput_p.h \ $$PWD/commandexecuter_p.h \ - $$PWD/uniform_p.h + $$PWD/uniform_p.h \ + $$PWD/shaderparameterpack_p.h SOURCES += \ $$PWD/renderthread.cpp \ $$PWD/renderconfiguration.cpp \ $$PWD/renderer.cpp \ - $$PWD/quniformvalue.cpp \ $$PWD/renderview.cpp \ $$PWD/rendercommand.cpp \ $$PWD/renderqueue.cpp \ @@ -68,5 +67,6 @@ SOURCES += \ $$PWD/attachmentpack.cpp \ $$PWD/commandexecuter.cpp \ $$PWD/openglvertexarrayobject.cpp \ - $$PWD/uniform.cpp + $$PWD/uniform.cpp \ + $$PWD/shaderparameterpack.cpp diff --git a/src/render/backend/rendercommand_p.h b/src/render/backend/rendercommand_p.h index dc65ac7ed..012cdbe9a 100644 --- a/src/render/backend/rendercommand_p.h +++ b/src/render/backend/rendercommand_p.h @@ -53,7 +53,7 @@ // #include -#include +#include #include #include #include diff --git a/src/render/backend/renderer_p.h b/src/render/backend/renderer_p.h index da3d4e1e9..ffc60273a 100644 --- a/src/render/backend/renderer_p.h +++ b/src/render/backend/renderer_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/render/backend/shaderparameterpack.cpp b/src/render/backend/shaderparameterpack.cpp new file mode 100644 index 000000000..01a977aee --- /dev/null +++ b/src/render/backend/shaderparameterpack.cpp @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** 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$ +** +****************************************************************************/ + +#include "shaderparameterpack_p.h" + +#include +#include + +#include + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { +namespace Render { + +ShaderParameterPack::~ShaderParameterPack() +{ + m_uniforms.clear(); +} + +void ShaderParameterPack::setUniform(const int glslNameId, const UniformValue &val) +{ + m_uniforms.insert(glslNameId, val); +} + +void ShaderParameterPack::setTexture(const int glslNameId, Qt3DCore::QNodeId texId) +{ + for (int t=0; t +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QOpenGLShaderProgram; + +namespace Qt3DCore { +class QFrameAllocator; +} + +namespace Qt3DRender { +namespace Render { + +class GraphicsContext; + +struct BlockToUBO { + int m_blockIndex; + Qt3DCore::QNodeId m_bufferID; + bool m_needsUpdate; + QHash m_updatedProperties; +}; +QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, BlockToUBO, Q_MOVABLE_TYPE) + +struct BlockToSSBO { + int m_blockIndex; + Qt3DCore::QNodeId m_bufferID; +}; +QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, BlockToSSBO, Q_PRIMITIVE_TYPE) + + +typedef QHash PackUniformHash; + +class ShaderParameterPack +{ +public: + ~ShaderParameterPack(); + + void setUniform(const int glslNameId, const UniformValue &val); + void setTexture(const int glslNameId, Qt3DCore::QNodeId id); + void setUniformBuffer(BlockToUBO blockToUBO); + void setShaderStorageBuffer(BlockToSSBO blockToSSBO); + void setSubmissionUniform(const ShaderUniform &uniform); + + inline PackUniformHash &uniforms() { return m_uniforms; } + inline const PackUniformHash &uniforms() const { return m_uniforms; } + UniformValue uniform(const int glslNameId) const { return m_uniforms.value(glslNameId); } + + struct NamedTexture + { + NamedTexture() {} + NamedTexture(const int nm, Qt3DCore::QNodeId t) + : glslNameId(nm) + , texId(t) + { } + + int glslNameId; + Qt3DCore::QNodeId texId; + }; + + inline QVector textures() const { return m_textures; } + inline QVector uniformBuffers() const { return m_uniformBuffers; } + inline QVector shaderStorageBuffers() const { return m_shaderStorageBuffers; } + inline QVector submissionUniforms() const { return m_submissionUniforms; } +private: + PackUniformHash m_uniforms; + + QVector m_textures; + QVector m_uniformBuffers; + QVector m_shaderStorageBuffers; + QVector m_submissionUniforms; + + friend class RenderView; +}; +QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, ShaderParameterPack::NamedTexture, Q_PRIMITIVE_TYPE) + +} // namespace Render +} // namespace Qt3DRender + +QT_END_NAMESPACE + +#endif // QT3DRENDER_RENDER_SHADERPARAMETERPACK_P_H diff --git a/src/render/graphicshelpers/graphicscontext_p.h b/src/render/graphicshelpers/graphicscontext_p.h index bfe5a4be9..647db9e47 100644 --- a/src/render/graphicshelpers/graphicscontext_p.h +++ b/src/render/graphicshelpers/graphicscontext_p.h @@ -60,7 +60,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/render/materialsystem/material_p.h b/src/render/materialsystem/material_p.h index b415e2975..fe2707549 100644 --- a/src/render/materialsystem/material_p.h +++ b/src/render/materialsystem/material_p.h @@ -54,7 +54,7 @@ #include #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/render/materialsystem/shader_p.h b/src/render/materialsystem/shader_p.h index 1382e287e..283e5a94c 100644 --- a/src/render/materialsystem/shader_p.h +++ b/src/render/materialsystem/shader_p.h @@ -52,7 +52,7 @@ // #include -#include +#include #include #include #include -- cgit v1.2.3 From 7e638edbd15640302516f9a69d20f62d26d4af06 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Mon, 5 Sep 2016 11:15:14 +0200 Subject: QTechnique fix: was sending wrong change type Change-Id: Ide125bd292f10d2363cd0928af2513efe9f25eaf Reviewed-by: Kevin Ottens Reviewed-by: Sean Harmer --- src/render/materialsystem/qtechnique.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/materialsystem/qtechnique.cpp b/src/render/materialsystem/qtechnique.cpp index 768397e76..74505bfbd 100644 --- a/src/render/materialsystem/qtechnique.cpp +++ b/src/render/materialsystem/qtechnique.cpp @@ -284,7 +284,7 @@ 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); } -- cgit v1.2.3