diff options
Diffstat (limited to 'src/quick3d/imports')
46 files changed, 365 insertions, 1483 deletions
diff --git a/src/quick3d/imports/animation/CMakeLists.txt b/src/quick3d/imports/animation/CMakeLists.txt index 06308275e..51d5bd4f5 100644 --- a/src/quick3d/imports/animation/CMakeLists.txt +++ b/src/quick3d/imports/animation/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from importsanimation.pro. ##################################################################### diff --git a/src/quick3d/imports/animation/importsanimation.pro b/src/quick3d/imports/animation/importsanimation.pro deleted file mode 100644 index 734c5186b..000000000 --- a/src/quick3d/imports/animation/importsanimation.pro +++ /dev/null @@ -1,16 +0,0 @@ -CXX_MODULE = qml -TARGET = quick3danimationplugin -TARGETPATH = Qt3D/Animation -IMPORT_VERSION = 2.$$QT_MINOR_VERSION - -QT += core-private qml qml-private 3dcore 3drender 3danimation 3dquick 3dquickrender 3dquickanimation 3dquick-private 3dquickanimation-private - -HEADERS += \ - qt3dquick3danimationplugin.h - -SOURCES += \ - qt3dquick3danimationplugin.cpp - -OTHER_FILES += qmldir - -load(qml_plugin) diff --git a/src/quick3d/imports/animation/qt3dquick3danimationplugin.cpp b/src/quick3d/imports/animation/qt3dquick3danimationplugin.cpp index 0ece3c88a..bbe98f66b 100644 --- a/src/quick3d/imports/animation/qt3dquick3danimationplugin.cpp +++ b/src/quick3d/imports/animation/qt3dquick3danimationplugin.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ +// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qt3dquick3danimationplugin.h" #include <Qt3DAnimation/qabstractclipanimator.h> @@ -106,3 +70,5 @@ void Qt3DQuick3DAnimationPlugin::registerTypes(const char *uri) } QT_END_NAMESPACE + +#include "moc_qt3dquick3danimationplugin.cpp" diff --git a/src/quick3d/imports/animation/qt3dquick3danimationplugin.h b/src/quick3d/imports/animation/qt3dquick3danimationplugin.h index 42e0efbef..445996f00 100644 --- a/src/quick3d/imports/animation/qt3dquick3danimationplugin.h +++ b/src/quick3d/imports/animation/qt3dquick3danimationplugin.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ +// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QT3DQUICK3DANIMATIONPLUGIN_H #define QT3DQUICK3DANIMATIONPLUGIN_H diff --git a/src/quick3d/imports/core/importscore.pro b/src/quick3d/imports/core/importscore.pro deleted file mode 100644 index 9ba6ac66d..000000000 --- a/src/quick3d/imports/core/importscore.pro +++ /dev/null @@ -1,16 +0,0 @@ -CXX_MODULE = qml -TARGET = quick3dcoreplugin -TARGETPATH = Qt3D/Core -IMPORT_VERSION = 2.$$QT_MINOR_VERSION - -QT += core-private qml qml-private quick quick-private 3dcore 3dcore-private 3dquick 3dquick-private - -HEADERS += \ - qt3dquick3dcoreplugin.h - -SOURCES += \ - qt3dquick3dcoreplugin.cpp - -OTHER_FILES += qmldir - -load(qml_plugin) diff --git a/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp b/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp index 14987e764..175306169 100644 --- a/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp +++ b/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qt3dquick3dcoreplugin.h" @@ -64,6 +28,16 @@ QT_BEGIN_NAMESPACE +extern void qml_register_types_Qt3D_Core(); +Q_GHS_KEEP_REFERENCE(qml_register_types_Qt3D_Core); + +Qt3DQuick3DCorePlugin::Qt3DQuick3DCorePlugin(QObject *parent) + : QQmlExtensionPlugin(parent) +{ + volatile auto registration = &qml_register_types_Qt3D_Core; + Q_UNUSED(registration); +} + void Qt3DQuick3DCorePlugin::registerTypes(const char *uri) { Q_UNUSED(uri); @@ -79,3 +53,5 @@ Qt3DQuick3DCorePlugin::~Qt3DQuick3DCorePlugin() } QT_END_NAMESPACE + +#include "moc_qt3dquick3dcoreplugin.cpp" diff --git a/src/quick3d/imports/core/qt3dquick3dcoreplugin.h b/src/quick3d/imports/core/qt3dquick3dcoreplugin.h index afc092bbb..7a5bd1bb2 100644 --- a/src/quick3d/imports/core/qt3dquick3dcoreplugin.h +++ b/src/quick3d/imports/core/qt3dquick3dcoreplugin.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QT3DQUICK3DCOREPLUGIN_H #define QT3DQUICK3DCOREPLUGIN_H @@ -49,7 +13,7 @@ class Qt3DQuick3DCorePlugin : public QQmlExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - Qt3DQuick3DCorePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { } + Qt3DQuick3DCorePlugin(QObject *parent = nullptr); ~Qt3DQuick3DCorePlugin(); void registerTypes(const char *uri) override; }; diff --git a/src/quick3d/imports/extras/CMakeLists.txt b/src/quick3d/imports/extras/CMakeLists.txt index 98be63038..404af9a06 100644 --- a/src/quick3d/imports/extras/CMakeLists.txt +++ b/src/quick3d/imports/extras/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from importsextras.pro. ##################################################################### diff --git a/src/quick3d/imports/extras/importsextras.pro b/src/quick3d/imports/extras/importsextras.pro deleted file mode 100644 index 1ac629422..000000000 --- a/src/quick3d/imports/extras/importsextras.pro +++ /dev/null @@ -1,16 +0,0 @@ -CXX_MODULE = qml -TARGET = quick3dextrasplugin -TARGETPATH = Qt3D/Extras -IMPORT_VERSION = 2.$$QT_MINOR_VERSION - -QT += core-private qml qml-private quick quick-private 3dcore 3dcore-private 3dquick 3dquick-private 3dextras 3dlogic 3dquickextras 3dquickextras-private - -HEADERS += \ - qt3dquick3dextrasplugin.h - -SOURCES += \ - qt3dquick3dextrasplugin.cpp - -OTHER_FILES += qmldir - -load(qml_plugin) diff --git a/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp b/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp index a7bdd62db..3de6354e4 100644 --- a/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp +++ b/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qt3dquick3dextrasplugin.h" @@ -159,3 +123,5 @@ void Qt3DQuick3DExtrasPlugin::registerTypes(const char *uri) QT_END_NAMESPACE + +#include "moc_qt3dquick3dextrasplugin.cpp" diff --git a/src/quick3d/imports/extras/qt3dquick3dextrasplugin.h b/src/quick3d/imports/extras/qt3dquick3dextrasplugin.h index 95b5a8717..25a189883 100644 --- a/src/quick3d/imports/extras/qt3dquick3dextrasplugin.h +++ b/src/quick3d/imports/extras/qt3dquick3dextrasplugin.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QT3DQUICK3DEXTRASPLUGIN_H #define QT3DQUICK3DEXTRASPLUGIN_H diff --git a/src/quick3d/imports/input/CMakeLists.txt b/src/quick3d/imports/input/CMakeLists.txt index 6df18be17..52ce25c8f 100644 --- a/src/quick3d/imports/input/CMakeLists.txt +++ b/src/quick3d/imports/input/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from importsinput.pro. ##################################################################### @@ -8,15 +11,12 @@ qt_internal_add_qml_module(quick3dinputplugin URI "Qt3D.Input" VERSION "2.${PROJECT_VERSION_MINOR}" CLASS_NAME Qt3DQuick3DInputPlugin + NO_PLUGIN_OPTIONAL DEPENDENCIES QtQml/auto PLUGIN_TARGET quick3dinputplugin - NO_PLUGIN_OPTIONAL - NO_GENERATE_PLUGIN_SOURCE - NO_GENERATE_QMLTYPES - INSTALL_SOURCE_QMLTYPES "plugins.qmltypes" SOURCES - qt3dquick3dinputplugin.cpp qt3dquick3dinputplugin.h + qt3dquick3dinputforeign_p.h LIBRARIES Qt::3DCore Qt::3DInput @@ -27,6 +27,7 @@ qt_internal_add_qml_module(quick3dinputplugin Qt::Gui Qt::Qml ) +target_include_directories(quick3dinputplugin PRIVATE ../../quick3dinput/items) #### Keys ignored in scope 1:.:.:importsinput.pro:<TRUE>: # CXX_MODULE = "qml" diff --git a/src/quick3d/imports/input/importsinput.pro b/src/quick3d/imports/input/importsinput.pro deleted file mode 100644 index ec333f992..000000000 --- a/src/quick3d/imports/input/importsinput.pro +++ /dev/null @@ -1,18 +0,0 @@ -CXX_MODULE = qml -TARGET = quick3dinputplugin -TARGETPATH = Qt3D/Input -IMPORT_VERSION = 2.$$QT_MINOR_VERSION - -QT += core-private qml 3dcore 3dinput 3dinput-private 3dquickinput-private - -OTHER_FILES += qmldir - -HEADERS += \ - qt3dquick3dinputplugin.h - -SOURCES += \ - qt3dquick3dinputplugin.cpp - -qtHaveModule(gamepad): DEFINES += HAVE_QGAMEPAD - -load(qml_plugin) diff --git a/src/quick3d/imports/input/qt3dquick3dinputforeign_p.h b/src/quick3d/imports/input/qt3dquick3dinputforeign_p.h new file mode 100644 index 000000000..2079a258e --- /dev/null +++ b/src/quick3d/imports/input/qt3dquick3dinputforeign_p.h @@ -0,0 +1,238 @@ +// Copyright (C) 2023 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QT3D_QUICK_INPUT_FOREIGN_P_H +#define QT3D_QUICK_INPUT_FOREIGN_P_H + +#include <QQmlEngine> + +#include <Qt3DInput/qabstractphysicaldevice.h> +#include <Qt3DInput/qaction.h> +#include <Qt3DInput/qactioninput.h> +#include <Qt3DInput/qanalogaxisinput.h> +#include <Qt3DInput/qaxis.h> +#include <Qt3DInput/qaxisaccumulator.h> +#include <Qt3DInput/qaxissetting.h> +#include <Qt3DInput/qbuttonaxisinput.h> +#include <Qt3DInput/qinputchord.h> +#include <Qt3DInput/qinputsequence.h> +#include <Qt3DInput/qinputsettings.h> +#include <Qt3DInput/qkeyboarddevice.h> +#include <Qt3DInput/qkeyboardhandler.h> +#include <Qt3DInput/qkeyevent.h> +#include <Qt3DInput/qlogicaldevice.h> +#include <Qt3DInput/qmousedevice.h> +#include <Qt3DInput/qmouseevent.h> +#include <Qt3DInput/qmousehandler.h> + +#include <Qt3DInput/private/qgenericinputdevice_p.h> +#include <Qt3DQuickInput/private/quick3daction_p.h> +#include <Qt3DQuickInput/private/quick3daxis_p.h> +#include <Qt3DQuickInput/private/quick3dinputchord_p.h> +#include <Qt3DQuickInput/private/quick3dinputsequence_p.h> +#include <Qt3DQuickInput/private/quick3dlogicaldevice_p.h> +#include <Qt3DQuickInput/private/quick3dphysicaldevice_p.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { +namespace Input { + +struct QKeyEventForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(KeyEvent) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QKeyEvent) + QML_UNCREATABLE("Events cannot be created") +}; + +struct QKeyboardDeviceForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(KeyboardDevice) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QKeyboardDevice) +}; + +struct QKeyboardHandlerForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(KeyboardHandler) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QKeyboardHandler) +}; + +struct QInputSettingsForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(InputSettings) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QInputSettings) +}; + +struct QQMouseEventForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(MouseEvent) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QMouseEvent) + QML_UNCREATABLE("Events cannot be created") +}; + +#if QT_CONFIG(wheelevent) +struct QWheelEventForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(WheelEvent) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QWheelEvent) + QML_UNCREATABLE("Events cannot be created") +}; +#endif + +struct QMouseHandlerForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(MouseHandler) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QMouseHandler) +}; + +struct QMouseDeviceForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(MouseDevice) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QMouseDevice) +}; + +struct QLogicalDeviceDeviceForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(LogicalDevice) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QLogicalDevice) + QML_EXTENDED(Qt3DInput::Input::Quick::Quick3DLogicalDevice) +}; + +struct QAbstractActionInputForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(AbstractActionInput) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QAbstractActionInput) + QML_UNCREATABLE("AbstractActionInput is abstract") +}; + +struct QActionInputForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(ActionInput) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QActionInput) +}; + +struct QAbstractAxisInputForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(AbstractAxisInput) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QAbstractAxisInput) + QML_UNCREATABLE("AbstractAxisInput is abstract") +}; + +struct QAxisSettingForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(AxisSetting) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QAxisSetting) +}; + +struct QAnalogAxisInputForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(AnalogAxisInput) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QAnalogAxisInput) +}; + +struct QButtonAxisInputForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(ButtonAxisInput) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QButtonAxisInput) +}; + +struct QAxisForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(Axis) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QAxis) + QML_EXTENDED(Qt3DInput::Input::Quick::Quick3DAxis) +}; + +struct QActionForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(Action) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QAction) + QML_EXTENDED(Qt3DInput::Input::Quick::Quick3DAction) +}; + +struct QInputSequenceForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(InputSequence) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QInputSequence) + QML_EXTENDED(Qt3DInput::Input::Quick::Quick3DInputSequence) +}; + +struct QInputChordForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(InputChord) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QInputChord) + QML_EXTENDED(Qt3DInput::Input::Quick::Quick3DInputChord) +}; + +struct QAbstractPhysicalDeviceForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(AbstractPhysicalDevice) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QAbstractPhysicalDevice) + QML_EXTENDED(Qt3DInput::Input::Quick::Quick3DPhysicalDevice) + QML_UNCREATABLE("QAbstractPhysicalDevice is abstract") +}; + +struct QAxisAccumulatorForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(AxisAccumulator) + QML_ADDED_IN_VERSION(2, 1) + QML_FOREIGN(Qt3DInput::QAxisAccumulator) +}; + +#ifdef HAVE_QGAMEPAD +struct QGamepadInputForeign +{ + Q_GADGET + QML_NAMED_ELEMENT(GamepadInput) + QML_ADDED_IN_VERSION(2, 0) + QML_FOREIGN(Qt3DInput::QGamepadInput) +}; +#endif + +} // namespace Input +} // namespace Qt3D + +QT_END_NAMESPACE + +#endif diff --git a/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp b/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp deleted file mode 100644 index 3ea731885..000000000 --- a/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp +++ /dev/null @@ -1,114 +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 "qt3dquick3dinputplugin.h" - -#include <Qt3DInput/qabstractphysicaldevice.h> -#include <Qt3DInput/qaction.h> -#include <Qt3DInput/qactioninput.h> -#include <Qt3DInput/qanalogaxisinput.h> -#include <Qt3DInput/qaxis.h> -#include <Qt3DInput/qaxisaccumulator.h> -#include <Qt3DInput/qaxissetting.h> -#include <Qt3DInput/qbuttonaxisinput.h> -#include <Qt3DInput/qinputchord.h> -#include <Qt3DInput/qinputsequence.h> -#include <Qt3DInput/qinputsettings.h> -#include <Qt3DInput/qkeyboarddevice.h> -#include <Qt3DInput/qkeyboardhandler.h> -#include <Qt3DInput/qkeyevent.h> -#include <Qt3DInput/qlogicaldevice.h> -#include <Qt3DInput/qmousedevice.h> -#include <Qt3DInput/qmouseevent.h> -#include <Qt3DInput/qmousehandler.h> -#include <QtQml> - -#include <Qt3DInput/private/qgenericinputdevice_p.h> -#include <Qt3DQuickInput/private/quick3daction_p.h> -#include <Qt3DQuickInput/private/quick3daxis_p.h> -#include <Qt3DQuickInput/private/quick3dinputchord_p.h> -#include <Qt3DQuickInput/private/quick3dinputsequence_p.h> -#include <Qt3DQuickInput/private/quick3dlogicaldevice_p.h> -#include <Qt3DQuickInput/private/quick3dphysicaldevice_p.h> - -#ifdef HAVE_QGAMEPAD -# include <Qt3DInput/private/qgamepadinput_p.h> -#endif - -QT_BEGIN_NAMESPACE - -void Qt3DQuick3DInputPlugin::registerTypes(const char *uri) -{ - qmlRegisterUncreatableType<Qt3DInput::QKeyEvent>(uri, 2, 0, "KeyEvent", QStringLiteral("Events cannot be created")); - qmlRegisterType<Qt3DInput::QKeyboardDevice>(uri, 2, 0, "KeyboardDevice"); - qmlRegisterType<Qt3DInput::QKeyboardHandler>(uri, 2, 0, "KeyboardHandler"); - qmlRegisterType<Qt3DInput::QInputSettings>(uri, 2, 0, "InputSettings"); - - qmlRegisterUncreatableType<Qt3DInput::QMouseEvent>(uri, 2, 0, "MouseEvent", QStringLiteral("Events cannot be created")); -#if QT_CONFIG(wheelevent) - qmlRegisterUncreatableType<Qt3DInput::QWheelEvent>(uri, 2, 0, "WheelEvent", QStringLiteral("Events cannot be created")); -#endif - qmlRegisterType<Qt3DInput::QMouseHandler>(uri, 2, 0, "MouseHandler"); - qmlRegisterType<Qt3DInput::QMouseDevice>(uri, 2, 0, "MouseDevice"); - qmlRegisterType<Qt3DInput::QMouseDevice, 15>(uri, 2, 15, "MouseDevice"); - - qmlRegisterExtendedType<Qt3DInput::QLogicalDevice, Qt3DInput::Input::Quick::Quick3DLogicalDevice>(uri, 2, 0, "LogicalDevice"); - qmlRegisterUncreatableType<Qt3DInput::QAbstractActionInput>(uri, 2, 0, "AbstractActionInput", QStringLiteral("AbstractActionInput is abstract")); - qmlRegisterType<Qt3DInput::QActionInput>(uri, 2, 0, "ActionInput"); - qmlRegisterUncreatableType<Qt3DInput::QAbstractAxisInput>(uri, 2, 0, "AbstractAxisInput", QStringLiteral("AbstractAxisInput is abstract")); - qmlRegisterType<Qt3DInput::QAxisSetting>(uri, 2, 0, "AxisSetting"); - qmlRegisterType<Qt3DInput::QAnalogAxisInput>(uri, 2, 0, "AnalogAxisInput"); - qmlRegisterType<Qt3DInput::QButtonAxisInput>(uri, 2, 0, "ButtonAxisInput"); - qmlRegisterExtendedType<Qt3DInput::QAxis, Qt3DInput::Input::Quick::Quick3DAxis>(uri, 2, 0, "Axis"); - qmlRegisterExtendedType<Qt3DInput::QAction, Qt3DInput::Input::Quick::Quick3DAction>(uri, 2, 0, "Action"); - qmlRegisterExtendedType<Qt3DInput::QInputSequence, Qt3DInput::Input::Quick::Quick3DInputSequence>(uri, 2, 0, "InputSequence"); - qmlRegisterExtendedType<Qt3DInput::QInputChord, Qt3DInput::Input::Quick::Quick3DInputChord>(uri, 2, 0, "InputChord"); - qmlRegisterExtendedUncreatableType<Qt3DInput::QAbstractPhysicalDevice, Qt3DInput::Input::Quick::Quick3DPhysicalDevice>(uri, 2, 0, "QAbstractPhysicalDevice", QStringLiteral("QAbstractPhysicalDevice is abstract")); - qmlRegisterType<Qt3DInput::QAxisAccumulator>(uri, 2, 1, "AxisAccumulator"); - -#ifdef HAVE_QGAMEPAD - qmlRegisterType<Qt3DInput::QGamepadInput>(uri, 2, 0, "GamepadInput"); -#endif - - // The minor version used to be the current Qt 5 minor. For compatibility it is the last - // Qt 5 release. - qmlRegisterModule(uri, 2, 15); -} - -QT_END_NAMESPACE diff --git a/src/quick3d/imports/input/qt3dquick3dinputplugin.h b/src/quick3d/imports/input/qt3dquick3dinputplugin.h deleted file mode 100644 index b2399af30..000000000 --- a/src/quick3d/imports/input/qt3dquick3dinputplugin.h +++ /dev/null @@ -1,58 +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$ -** -****************************************************************************/ - -#ifndef QT3DQUICK3DINPUTPLUGIN_H -#define QT3DQUICK3DINPUTPLUGIN_H - -#include <QtQml/QQmlExtensionPlugin> - -QT_BEGIN_NAMESPACE - -class Qt3DQuick3DInputPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) -public: - Qt3DQuick3DInputPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { } - void registerTypes(const char *uri) override; -}; - -QT_END_NAMESPACE - -#endif // QT3DQUICK3DINPUTPLUGIN_H diff --git a/src/quick3d/imports/logic/CMakeLists.txt b/src/quick3d/imports/logic/CMakeLists.txt index 00e3276ed..234e24830 100644 --- a/src/quick3d/imports/logic/CMakeLists.txt +++ b/src/quick3d/imports/logic/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from importslogic.pro. ##################################################################### diff --git a/src/quick3d/imports/logic/importslogic.pro b/src/quick3d/imports/logic/importslogic.pro deleted file mode 100644 index 2fc2accc5..000000000 --- a/src/quick3d/imports/logic/importslogic.pro +++ /dev/null @@ -1,16 +0,0 @@ -CXX_MODULE = qml -TARGET = quick3dlogicplugin -TARGETPATH = Qt3D/Logic -IMPORT_VERSION = 2.$$QT_MINOR_VERSION - -QT += core-private qml 3dcore 3dlogic - -OTHER_FILES += qmldir - -HEADERS += \ - qt3dquick3dlogicplugin.h - -SOURCES += \ - qt3dquick3dlogicplugin.cpp - -load(qml_plugin) diff --git a/src/quick3d/imports/logic/qt3dquick3dlogicplugin.cpp b/src/quick3d/imports/logic/qt3dquick3dlogicplugin.cpp index 969b28a0d..4cb0ae19e 100644 --- a/src/quick3d/imports/logic/qt3dquick3dlogicplugin.cpp +++ b/src/quick3d/imports/logic/qt3dquick3dlogicplugin.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2015 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$ -** -****************************************************************************/ +// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qt3dquick3dlogicplugin.h" @@ -54,3 +18,5 @@ void Qt3DQuick3DLogicPlugin::registerTypes(const char *uri) } QT_END_NAMESPACE + +#include "moc_qt3dquick3dlogicplugin.cpp" diff --git a/src/quick3d/imports/logic/qt3dquick3dlogicplugin.h b/src/quick3d/imports/logic/qt3dquick3dlogicplugin.h index d59d7d09d..af23272b5 100644 --- a/src/quick3d/imports/logic/qt3dquick3dlogicplugin.h +++ b/src/quick3d/imports/logic/qt3dquick3dlogicplugin.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2015 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$ -** -****************************************************************************/ +// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QT3DQUICK3DLOGICPLUGIN_H #define QT3DQUICK3DLOGICPLUGIN_H diff --git a/src/quick3d/imports/render/CMakeLists.txt b/src/quick3d/imports/render/CMakeLists.txt index 7cd7df848..ebce125ac 100644 --- a/src/quick3d/imports/render/CMakeLists.txt +++ b/src/quick3d/imports/render/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from importsrender.pro. ##################################################################### diff --git a/src/quick3d/imports/render/importsrender.pro b/src/quick3d/imports/render/importsrender.pro deleted file mode 100644 index 977668c40..000000000 --- a/src/quick3d/imports/render/importsrender.pro +++ /dev/null @@ -1,16 +0,0 @@ -CXX_MODULE = qml -TARGET = quick3drenderplugin -TARGETPATH = Qt3D/Render -IMPORT_VERSION = 2.$$QT_MINOR_VERSION - -QT += core-private qml qml-private 3dcore 3drender 3drender-private 3dquick 3dquick-private 3dquickrender-private - -HEADERS += \ - qt3dquick3drenderplugin.h - -SOURCES += \ - qt3dquick3drenderplugin.cpp - -OTHER_FILES += qmldir - -load(qml_plugin) diff --git a/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp b/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp index 59fcfa6d6..325deac93 100644 --- a/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp +++ b/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp @@ -1,42 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies). -** 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$ -** -****************************************************************************/ +// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qt3dquick3drenderplugin.h" #include <Qt3DRender/qabstractlight.h> @@ -321,4 +285,6 @@ void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri) QT_END_NAMESPACE +#include "moc_qt3dquick3drenderplugin.cpp" + diff --git a/src/quick3d/imports/render/qt3dquick3drenderplugin.h b/src/quick3d/imports/render/qt3dquick3drenderplugin.h index 68a5cade5..9169e8a39 100644 --- a/src/quick3d/imports/render/qt3dquick3drenderplugin.h +++ b/src/quick3d/imports/render/qt3dquick3drenderplugin.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QT3DQUICK3DRENDERPLUGIN_H #define QT3DQUICK3DRENDERPLUGIN_H diff --git a/src/quick3d/imports/scene2d/CMakeLists.txt b/src/quick3d/imports/scene2d/CMakeLists.txt index 89c4ef865..9f891edb3 100644 --- a/src/quick3d/imports/scene2d/CMakeLists.txt +++ b/src/quick3d/imports/scene2d/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from importsscene2d.pro. ##################################################################### diff --git a/src/quick3d/imports/scene2d/importsscene2d.pro b/src/quick3d/imports/scene2d/importsscene2d.pro deleted file mode 100644 index cb87f4ca9..000000000 --- a/src/quick3d/imports/scene2d/importsscene2d.pro +++ /dev/null @@ -1,16 +0,0 @@ -CXX_MODULE = qml -TARGET = qtquickscene2dplugin -TARGETPATH = QtQuick/Scene2D -IMPORT_VERSION = 2.$$QT_MINOR_VERSION - -QT += qml quick 3dcore 3drender 3drender-private 3dinput 3dlogic 3dquickscene2d 3dquickscene2d-private - -HEADERS += \ - qtquickscene2dplugin.h \ - -SOURCES += \ - qtquickscene2dplugin.cpp \ - -OTHER_FILES += qmldir - -load(qml_plugin) diff --git a/src/quick3d/imports/scene2d/qtquickscene2dplugin.cpp b/src/quick3d/imports/scene2d/qtquickscene2dplugin.cpp index 0ddb9eb0c..57e69533d 100644 --- a/src/quick3d/imports/scene2d/qtquickscene2dplugin.cpp +++ b/src/quick3d/imports/scene2d/qtquickscene2dplugin.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qtquickscene2dplugin.h" @@ -63,3 +27,5 @@ void QtQuickScene2DPlugin::registerTypes(const char *uri) } QT_END_NAMESPACE + +#include "moc_qtquickscene2dplugin.cpp" diff --git a/src/quick3d/imports/scene2d/qtquickscene2dplugin.h b/src/quick3d/imports/scene2d/qtquickscene2dplugin.h index 66304c1d0..89e776a6a 100644 --- a/src/quick3d/imports/scene2d/qtquickscene2dplugin.h +++ b/src/quick3d/imports/scene2d/qtquickscene2dplugin.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QTQUICKSCENE2DPLUGIN_H #define QTQUICKSCENE2DPLUGIN_H diff --git a/src/quick3d/imports/scene3d/CMakeLists.txt b/src/quick3d/imports/scene3d/CMakeLists.txt index b5e848f16..af9aa835e 100644 --- a/src/quick3d/imports/scene3d/CMakeLists.txt +++ b/src/quick3d/imports/scene3d/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from importsscene3d.pro. ##################################################################### diff --git a/src/quick3d/imports/scene3d/importsscene3d.pro b/src/quick3d/imports/scene3d/importsscene3d.pro deleted file mode 100644 index f8f3320b9..000000000 --- a/src/quick3d/imports/scene3d/importsscene3d.pro +++ /dev/null @@ -1,35 +0,0 @@ -CXX_MODULE = qml -TARGET = qtquickscene3dplugin -TARGETPATH = QtQuick/Scene3D -IMPORT_VERSION = 2.$$QT_MINOR_VERSION - -QT += qml quick 3dcore 3drender 3drender-private quick-private - -qtConfig(qt3d-input): QT += 3dinput -qtConfig(qt3d-logic): QT += 3dlogic -qtConfig(qt3d-animation): QT += 3danimation - -HEADERS += \ - qtquickscene3dplugin.h \ - scene3dlogging_p.h \ - scene3ditem_p.h \ - scene3drenderer_p.h \ - scene3dsgnode_p.h \ - scene3dsgmaterialshader_p.h \ - scene3dsgmaterial_p.h - -SOURCES += \ - qtquickscene3dplugin.cpp \ - scene3ditem.cpp \ - scene3dlogging.cpp \ - scene3drenderer.cpp \ - scene3dsgnode.cpp \ - scene3dsgmaterialshader.cpp \ - scene3dsgmaterial.cpp - -OTHER_FILES += qmldir shaders/* - -load(qml_plugin) - -RESOURCES += \ - scene3d.qrc diff --git a/src/quick3d/imports/scene3d/qtquickscene3dplugin.cpp b/src/quick3d/imports/scene3d/qtquickscene3dplugin.cpp index fa79af1cd..0810bedc5 100644 --- a/src/quick3d/imports/scene3d/qtquickscene3dplugin.cpp +++ b/src/quick3d/imports/scene3d/qtquickscene3dplugin.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2015 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$ -** -****************************************************************************/ +// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qtquickscene3dplugin.h" @@ -56,3 +20,5 @@ void QtQuickScene3DPlugin::registerTypes(const char *uri) } QT_END_NAMESPACE + +#include "moc_qtquickscene3dplugin.cpp" diff --git a/src/quick3d/imports/scene3d/qtquickscene3dplugin.h b/src/quick3d/imports/scene3d/qtquickscene3dplugin.h index c70b8358b..3129cffa9 100644 --- a/src/quick3d/imports/scene3d/qtquickscene3dplugin.h +++ b/src/quick3d/imports/scene3d/qtquickscene3dplugin.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2015 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$ -** -****************************************************************************/ +// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QTQUICKSCENE3DPLUGIN_H #define QTQUICKSCENE3DPLUGIN_H diff --git a/src/quick3d/imports/scene3d/scene3ditem.cpp b/src/quick3d/imports/scene3d/scene3ditem.cpp index 6f84fff7e..ef0ae6409 100644 --- a/src/quick3d/imports/scene3d/scene3ditem.cpp +++ b/src/quick3d/imports/scene3d/scene3ditem.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2015 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$ -** -****************************************************************************/ +// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "scene3ditem_p.h" @@ -62,6 +26,7 @@ #include <QtGui/qguiapplication.h> #include <QtGui/qoffscreensurface.h> +#include <QtQml/private/qqmlglobal_p.h> #include <QtQuick/qquickwindow.h> #include <QtQuick/qquickrendercontrol.h> @@ -257,7 +222,7 @@ void Scene3DItem::applyAspects() return; // Aspects are owned by the aspect engine - for (const QString &aspect : qAsConst(m_aspects)) { + for (const QString &aspect : std::as_const(m_aspects)) { if (aspect == QLatin1String("render")) // This one is hardwired anyway continue; if (aspect == QLatin1String("input")) { @@ -583,8 +548,11 @@ void Scene3DItem::createDummySurface(QWindow *rw, Qt3DRender::QRenderSurfaceSele */ void Scene3DItem::setItemAreaAndDevicePixelRatio(QSize area, qreal devicePixelRatio) { - Qt3DRender::QRenderSurfaceSelector *surfaceSelector - = Qt3DRender::QRenderSurfaceSelectorPrivate::find(entity()); + Qt3DCore::QEntity *rootEntity = entity(); + if (!rootEntity) { + return; + } + Qt3DRender::QRenderSurfaceSelector *surfaceSelector = Qt3DRender::QRenderSurfaceSelectorPrivate::find(rootEntity); if (surfaceSelector) { surfaceSelector->setExternalRenderTargetSize(area); surfaceSelector->setSurfacePixelRatio(devicePixelRatio); @@ -778,9 +746,13 @@ QSGNode *Scene3DItem::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNode qCWarning(Scene3D) << "Renderer for Scene3DItem has requested a reset due to the item " "moving to another window"; QObject::disconnect(m_windowConnection); + // We are in the Render thread, and the m_aspectEngineDestroyer lives in the Main + // thread, so we must avoid sending ChildRemoved or ChildAdded events to it with a + // QObject::setParent(). QCoreApplication::sendEvent() would fail with "Cannot + // send events to objects owned by a different thread." + QQml_setParent_noEvent(m_aspectEngine, nullptr); // Note: AspectEngine can only be deleted once we have set the root // entity on the new instance - m_aspectEngine->setParent(nullptr); m_aspectToDelete = m_aspectEngine; m_aspectEngine = nullptr; } @@ -797,6 +769,7 @@ QSGNode *Scene3DItem::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNode // Needs to belong in the same thread as the item which is the same as // the original QAspectEngine m_aspectEngineDestroyer->moveToThread(thread()); + m_aspectEngine->moveToThread(thread()); // To destroy AspectEngine m_aspectEngineDestroyer->reset(2); @@ -881,6 +854,11 @@ QSGNode *Scene3DItem::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNode } } + // Set whether we want the Renderer to be allowed to render or not + const bool skipFrame = !needsRender(renderAspect); + renderer->setSkipFrame(skipFrame); + renderer->allowRender(); + // Let the renderer prepare anything it needs to prior to the rendering if (m_wasFrameProcessed) renderer->beforeSynchronize(); @@ -888,11 +866,6 @@ QSGNode *Scene3DItem::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNode // Force window->beforeRendering to be triggered managerNode->markDirty(QSGNode::DirtyForceUpdate); - // Set whether we want the Renderer to be allowed to render or not - const bool skipFrame = !needsRender(renderAspect); - renderer->setSkipFrame(skipFrame); - renderer->allowRender(); - m_wasSGUpdated = true; return managerNode; @@ -908,4 +881,5 @@ void Scene3DItem::mousePressEvent(QMouseEvent *event) QT_END_NAMESPACE +#include "moc_scene3ditem_p.cpp" #include "scene3ditem.moc" diff --git a/src/quick3d/imports/scene3d/scene3ditem_p.h b/src/quick3d/imports/scene3d/scene3ditem_p.h index 525118fbf..323e93d65 100644 --- a/src/quick3d/imports/scene3d/scene3ditem_p.h +++ b/src/quick3d/imports/scene3d/scene3ditem_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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$ -** -****************************************************************************/ +// Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef SCENE3DITEM_H #define SCENE3DITEM_H @@ -162,7 +126,7 @@ private: QMetaObject::Connection m_windowConnection; qint8 m_framesToRender; - static const qint8 ms_framesNeededToFlushPipeline = 2; + static const qint8 ms_framesNeededToFlushPipeline = 3; }; } // Qt3DRender diff --git a/src/quick3d/imports/scene3d/scene3dlogging.cpp b/src/quick3d/imports/scene3d/scene3dlogging.cpp index b6656541b..781b208e9 100644 --- a/src/quick3d/imports/scene3d/scene3dlogging.cpp +++ b/src/quick3d/imports/scene3d/scene3dlogging.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2015 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$ -** -****************************************************************************/ +// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "scene3dlogging_p.h" diff --git a/src/quick3d/imports/scene3d/scene3dlogging_p.h b/src/quick3d/imports/scene3d/scene3dlogging_p.h index 9ec646c8a..48b6517fb 100644 --- a/src/quick3d/imports/scene3d/scene3dlogging_p.h +++ b/src/quick3d/imports/scene3d/scene3dlogging_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ +// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QT3D_SCENE3DLOGGING_P_H #define QT3D_SCENE3DLOGGING_P_H diff --git a/src/quick3d/imports/scene3d/scene3drenderer.cpp b/src/quick3d/imports/scene3d/scene3drenderer.cpp index e99705006..eefe81919 100644 --- a/src/quick3d/imports/scene3d/scene3drenderer.cpp +++ b/src/quick3d/imports/scene3d/scene3drenderer.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "scene3drenderer_p.h" @@ -45,9 +9,7 @@ #include <qopenglcontext.h> #include <qopenglframebufferobject.h> #include <QtQuick/qquickwindow.h> -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) -#include <private/qrhi_p.h> -#endif +#include <rhi/qrhi.h> #include <Qt3DRender/private/qrenderaspect_p.h> #include <Qt3DRender/private/abstractrenderer_p.h> @@ -163,12 +125,10 @@ void Scene3DRenderer::init(Qt3DCore::QAspectEngine *aspectEngine, Qt3DRender::QRenderAspectPrivate *aspectPriv = static_cast<QRenderAspectPrivate*>(QRenderAspectPrivate::get(m_renderAspect)); Qt3DRender::Render::AbstractRenderer *renderer = aspectPriv->m_renderer; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) const bool isRHI = renderer->api() == API::RHI; if (isRHI) m_quickRenderer = new Scene3DRenderer::RHIRenderer; else -#endif m_quickRenderer = new Scene3DRenderer::GLRenderer; m_quickRenderer->initialize(this, renderer); } @@ -182,15 +142,10 @@ void Scene3DRenderer::setWindow(QQuickWindow *window) m_window = window; if (m_window) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QObject::connect(m_window, &QQuickWindow::beforeRendering, this, [this] () { m_quickRenderer->beforeRendering(this); }, Qt::DirectConnection); QObject::connect(m_window, &QQuickWindow::beforeRenderPassRecording, this, [this] () { m_quickRenderer->beforeRenderPassRecording(this); }, Qt::DirectConnection); -#else - QObject::connect(m_window, &QQuickWindow::beforeRendering, this, - [this] () { m_quickRenderer->beforeRenderPassRecording(this); }, Qt::DirectConnection); -#endif } else { shutdown(); } @@ -347,12 +302,7 @@ void Scene3DRenderer::GLRenderer::beforeSynchronize(Scene3DRenderer *scene3DRend if (generateNewTexture) { m_finalFBO.reset(createFramebufferObject(m_lastSize)); m_textureId = m_finalFBO->texture(); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) m_texture.reset(QNativeInterface::QSGOpenGLTexture::fromNative(m_textureId, window, m_finalFBO->size(), QQuickWindow::TextureHasAlphaChannel)); -#else - m_texture.reset(window->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture, &m_textureId, - 0, m_finalFBO->size(), QQuickWindow::TextureHasAlphaChannel)); -#endif } // Set texture on node @@ -385,12 +335,6 @@ void Scene3DRenderer::GLRenderer::beforeRenderPassRecording(Scene3DRenderer *sce scene3DRenderer->m_shouldRender = false; ContextSaver saver; -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - // The OpenGL state may be dirty from the previous QtQuick nodes, so reset - // it here to give Qt3D the clean state it expects - scene3DRenderer->m_window->resetOpenGLState(); -#endif - // Create and bind FBO if using the FBO compositing mode const bool usesFBO = scene3DRenderer->m_compositingMode == Scene3DItem::FBO; if (usesFBO) { @@ -431,12 +375,6 @@ void Scene3DRenderer::GLRenderer::beforeRenderPassRecording(Scene3DRenderer *sce if (scene3DRenderer->m_node) scene3DRenderer->m_node->show(); } - -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - // Reset the state used by the QtQuick scenegraph to avoid any - // interference when rendering the rest of the UI - scene3DRenderer->m_window->resetOpenGLState(); -#endif } void Scene3DRenderer::GLRenderer::shutdown(Scene3DRenderer *sceneRenderer) @@ -450,8 +388,6 @@ void Scene3DRenderer::GLRenderer::shutdown(Scene3DRenderer *sceneRenderer) m_multisampledFBO.reset(); } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - void Scene3DRenderer::RHIRenderer::initialize(Scene3DRenderer *scene3DRenderer, Qt3DRender::Render::AbstractRenderer *renderer) { @@ -655,11 +591,11 @@ void Scene3DRenderer::RHIRenderer::releaseRHIResources() m_rhiRenderTargetPassDescriptor = nullptr; } -#endif - Scene3DRenderer::QuickRenderer::QuickRenderer() {} Scene3DRenderer::QuickRenderer::~QuickRenderer() {} } // namespace Qt3DRender QT_END_NAMESPACE + +#include "moc_scene3drenderer_p.cpp" diff --git a/src/quick3d/imports/scene3d/scene3drenderer_p.h b/src/quick3d/imports/scene3d/scene3drenderer_p.h index c7f1fca2c..f131c7525 100644 --- a/src/quick3d/imports/scene3d/scene3drenderer_p.h +++ b/src/quick3d/imports/scene3d/scene3drenderer_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QT3DRENDER_SCENE3DRENDERER_P_H #define QT3DRENDER_SCENE3DRENDERER_P_H @@ -159,7 +123,6 @@ private: quint32 m_textureId = 0; }; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) class RHIRenderer : public QuickRenderer { public: @@ -182,7 +145,6 @@ private: QRhiRenderPassDescriptor *m_rhiRenderTargetPassDescriptor = nullptr; QRhi *m_rhi = nullptr; }; -#endif Qt3DCore::QAspectEngine *m_aspectEngine; // Will be released by the Scene3DItem QRenderAspect *m_renderAspect; // Will be released by the aspectEngine diff --git a/src/quick3d/imports/scene3d/scene3dsgmaterial.cpp b/src/quick3d/imports/scene3d/scene3dsgmaterial.cpp index dd2f4b712..0d1ea7384 100644 --- a/src/quick3d/imports/scene3d/scene3dsgmaterial.cpp +++ b/src/quick3d/imports/scene3d/scene3dsgmaterial.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "scene3dsgmaterial_p.h" @@ -64,15 +28,9 @@ Scene3DSGMaterial::Scene3DSGMaterial() { } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QSGMaterialShader *Scene3DSGMaterial::createShader(QSGRendererInterface::RenderMode renderMode) const -#else -QSGMaterialShader *Scene3DSGMaterial::createShader() const -#endif { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) Q_UNUSED(renderMode); -#endif return new Scene3DSGMaterialShader(); } diff --git a/src/quick3d/imports/scene3d/scene3dsgmaterial_p.h b/src/quick3d/imports/scene3d/scene3dsgmaterial_p.h index 940c9da84..b84f55f26 100644 --- a/src/quick3d/imports/scene3d/scene3dsgmaterial_p.h +++ b/src/quick3d/imports/scene3d/scene3dsgmaterial_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef SCENE3DSGMATERIAL_H #define SCENE3DSGMATERIAL_H @@ -73,11 +37,7 @@ public: QSGTexture *texture() const noexcept { return m_texture; } QSGMaterialType *type() const final { return &Scene3DSGMaterialShader::type; } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const final; -#else - QSGMaterialShader *createShader() const final; -#endif void show() { m_visible = true; } bool visible() const { return m_visible; } diff --git a/src/quick3d/imports/scene3d/scene3dsgmaterialshader.cpp b/src/quick3d/imports/scene3d/scene3dsgmaterialshader.cpp index ec797eafd..16d5942dd 100644 --- a/src/quick3d/imports/scene3d/scene3dsgmaterialshader.cpp +++ b/src/quick3d/imports/scene3d/scene3dsgmaterialshader.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "scene3dsgmaterialshader_p.h" @@ -76,15 +40,12 @@ Scene3DSGMaterialShader::Scene3DSGMaterialShader() : QSGMaterialShader() { // Generated with qsb, we target all GL version Qt3D can handle - // qsb -b --glsl "460,450,440,430,420,410,400,330,150,120,320 es,300 es,100 es" --hlsl 50 --msl 12 -o scene3dmaterial.vert.qsb scene3dmaterial.vert - // qsb --glsl "460,450,440,430,420,410,400,330,150,120,320 es,300 es,100 es" --hlsl 50 --msl 12 -o scene3dmaterial.frag.qsb scene3dmaterial.frag -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + // qsb -b --glsl "460,450,440,430,420,410,400,330,150,130,120,320 es,300 es,100 es" --hlsl 50 --msl 12 -o scene3dmaterial.vert.qsb scene3dmaterial.vert + // qsb --glsl "460,450,440,430,420,410,400,330,150,130,120,320 es,300 es,100 es" --hlsl 50 --msl 12 -o scene3dmaterial.frag.qsb scene3dmaterial.frag setShaderFileName(VertexStage, QLatin1String(":/shaders/scene3dmaterial.vert.qsb")); setShaderFileName(FragmentStage, QLatin1String(":/shaders/scene3dmaterial.frag.qsb")); -#endif } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool Scene3DSGMaterialShader::updateUniformData(QSGMaterialShader::RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) @@ -154,100 +115,6 @@ void Scene3DSGMaterialShader::updateSampledImage(QSGMaterialShader::RenderState } } -#else - -const char * const *Qt3DRender::Scene3DSGMaterialShader::attributeNames() const -{ - static char const *const attr[] = { "qt_VertexPosition", "qt_VertexTexCoord", nullptr }; - return attr; -} - -const char *Scene3DSGMaterialShader::vertexShader() const -{ - QOpenGLContext *ctx = QOpenGLContext::currentContext(); - if (ctx->format().version() >= qMakePair(3, 2) && ctx->format().profile() == QSurfaceFormat::CoreProfile) { - return "" - "#version 150 core \n" - "uniform mat4 qt_Matrix; \n" - "in vec4 qt_VertexPosition; \n" - "in vec2 qt_VertexTexCoord; \n" - "out vec2 qt_TexCoord; \n" - "void main() { \n" - " qt_TexCoord = qt_VertexTexCoord; \n" - " gl_Position = qt_Matrix * qt_VertexPosition; \n" - "}"; - } else { - return "" - "uniform highp mat4 qt_Matrix; \n" - "attribute highp vec4 qt_VertexPosition; \n" - "attribute highp vec2 qt_VertexTexCoord; \n" - "varying highp vec2 qt_TexCoord; \n" - "void main() { \n" - " qt_TexCoord = qt_VertexTexCoord; \n" - " gl_Position = qt_Matrix * qt_VertexPosition; \n" - "}"; - } -} -const char *Scene3DSGMaterialShader::fragmentShader() const -{ - QOpenGLContext *ctx = QOpenGLContext::currentContext(); - if (ctx->format().version() >= qMakePair(3, 2) && ctx->format().profile() == QSurfaceFormat::CoreProfile) { - return "" - "#version 150 core \n" - "uniform sampler2D source; \n" - "uniform float qt_Opacity; \n" - "in vec2 qt_TexCoord; \n" - "out vec4 fragColor; \n" - "void main() { \n" - " vec4 p = texture(source, qt_TexCoord); \n" - " float a = qt_Opacity * p.a; \n" - " fragColor = vec4(p.rgb * a, a); \n" - "}"; - } else { - return "" - "uniform highp sampler2D source; \n" - "uniform highp float qt_Opacity; \n" - "varying highp vec2 qt_TexCoord; \n" - "void main() { \n" - " highp vec4 p = texture2D(source, qt_TexCoord); \n" - " highp float a = qt_Opacity * p.a; \n" - " gl_FragColor = vec4(p.rgb * a, a); \n" - "}"; - } -} -void Scene3DSGMaterialShader::initialize() -{ - m_matrixId = program()->uniformLocation("qt_Matrix"); - m_opacityId = program()->uniformLocation("qt_Opacity"); -} -void Scene3DSGMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) -{ - Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type()); - Scene3DSGMaterial *tx = static_cast<Scene3DSGMaterial *>(newEffect); - Scene3DSGMaterial *oldTx = static_cast<Scene3DSGMaterial *>(oldEffect); - QSGTexture *t = tx->texture(); - bool npotSupported = const_cast<QOpenGLContext *>(state.context()) - ->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat); - if (!npotSupported) { - QSize size = t->textureSize(); - const bool isNpot = !isPowerOfTwo(size.width()) || !isPowerOfTwo(size.height()); - if (isNpot) { - t->setHorizontalWrapMode(QSGTexture::ClampToEdge); - t->setVerticalWrapMode(QSGTexture::ClampToEdge); - } - } - if (oldTx == 0 || oldTx->texture()->textureId() != t->textureId()) - t->bind(); - else - t->updateBindOptions(); - if (state.isMatrixDirty()) - program()->setUniformValue(m_matrixId, state.combinedMatrix()); - if (state.isOpacityDirty()) - program()->setUniformValue(m_opacityId, state.opacity()); -} - -#endif - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/quick3d/imports/scene3d/scene3dsgmaterialshader_p.h b/src/quick3d/imports/scene3d/scene3dsgmaterialshader_p.h index 38ab0abd1..ce02a8608 100644 --- a/src/quick3d/imports/scene3d/scene3dsgmaterialshader_p.h +++ b/src/quick3d/imports/scene3d/scene3dsgmaterialshader_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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$ -** -****************************************************************************/ +// Copyright (C) 2021 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QT3DRENDER_SCENE3DSGMATERIALSHADER_P_H #define QT3DRENDER_SCENE3DSGMATERIALSHADER_P_H @@ -65,23 +29,8 @@ public: protected: // QSGMaterialShader interface -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) final; void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) final; -#else -public: - char const *const *attributeNames() const final; - void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) final; - -protected: - const char *vertexShader() const final; - const char *fragmentShader() const final; - void initialize() final; - -private: - int m_matrixId = -1; - int m_opacityId = -1; -#endif }; } // namespace Qt3DRender diff --git a/src/quick3d/imports/scene3d/scene3dsgnode.cpp b/src/quick3d/imports/scene3d/scene3dsgnode.cpp index 011f0d0d3..65fc261dc 100644 --- a/src/quick3d/imports/scene3d/scene3dsgnode.cpp +++ b/src/quick3d/imports/scene3d/scene3dsgnode.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "scene3dsgnode_p.h" diff --git a/src/quick3d/imports/scene3d/scene3dsgnode_p.h b/src/quick3d/imports/scene3d/scene3dsgnode_p.h index b33840aaf..043bd4c39 100644 --- a/src/quick3d/imports/scene3d/scene3dsgnode_p.h +++ b/src/quick3d/imports/scene3d/scene3dsgnode_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QT3DRENDER_SCENE3DSGNODE_P_H #define QT3DRENDER_SCENE3DSGNODE_P_H diff --git a/src/quick3d/imports/scene3d/shaders/scene3dmaterial.frag.qsb b/src/quick3d/imports/scene3d/shaders/scene3dmaterial.frag.qsb Binary files differindex b24ef4019..18a00e79b 100644 --- a/src/quick3d/imports/scene3d/shaders/scene3dmaterial.frag.qsb +++ b/src/quick3d/imports/scene3d/shaders/scene3dmaterial.frag.qsb diff --git a/src/quick3d/imports/scene3d/shaders/scene3dmaterial.vert.qsb b/src/quick3d/imports/scene3d/shaders/scene3dmaterial.vert.qsb Binary files differindex 6e17b49fb..ff27bb16d 100644 --- a/src/quick3d/imports/scene3d/shaders/scene3dmaterial.vert.qsb +++ b/src/quick3d/imports/scene3d/shaders/scene3dmaterial.vert.qsb |