diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2014-10-02 09:40:37 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2014-10-03 21:18:49 +0200 |
commit | 3f20529e605eac75f416931c5c96ea03efa0c3ce (patch) | |
tree | 1db3865f104a9a61ab5eeb71b5fc77868adbe07b | |
parent | 7b26f6a1746419161a8f875e341b3e31220f4141 (diff) |
QAbstract removed from core
Task-number: QTBUG-41530
Change-Id: I32ed3d9b819e4e9eafdd36adc30bed9156284777
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
54 files changed, 347 insertions, 1502 deletions
diff --git a/examples/cpp_example/main.cpp b/examples/cpp_example/main.cpp index e329e0eb4..f64d47e11 100644 --- a/examples/cpp_example/main.cpp +++ b/examples/cpp_example/main.cpp @@ -52,7 +52,7 @@ #include <Qt3DRenderer/qmesh.h> #include <Qt3DRenderer/qtechnique.h> #include <Qt3DRenderer/qmaterial.h> -#include <Qt3DCore/qabstracteffect.h> +#include <Qt3DRenderer/qeffect.h> #include <Qt3DRenderer/qtexture.h> #include <Qt3DRenderer/qrenderpass.h> #include <Qt3DRenderer/qsceneloader.h> diff --git a/examples/cylinder-cpp/main.cpp b/examples/cylinder-cpp/main.cpp index 6880a1bb8..9e780c8d6 100644 --- a/examples/cylinder-cpp/main.cpp +++ b/examples/cylinder-cpp/main.cpp @@ -50,7 +50,7 @@ #include <Qt3DRenderer/qmesh.h> #include <Qt3DRenderer/qtechnique.h> #include <Qt3DRenderer/qmaterial.h> -#include <Qt3DCore/qabstracteffect.h> +#include <Qt3DRenderer/qeffect.h> #include <Qt3DRenderer/qtexture.h> #include <Qt3DRenderer/qrenderpass.h> diff --git a/examples/rollerball/AdsEffect.qml b/examples/rollerball/AdsEffect.qml index c7d964951..56000811e 100644 --- a/examples/rollerball/AdsEffect.qml +++ b/examples/rollerball/AdsEffect.qml @@ -85,7 +85,6 @@ Effect { renderPasses: [ RenderPass { - name: "lighting" // The bindings property allows us to map from names of parameters (uniforms or vertex attributes) // within a shader to more friendly names in QML. By default the parameter names are exposed from diff --git a/examples/tessellation-modes/TessellatedWireframeEffect.qml b/examples/tessellation-modes/TessellatedWireframeEffect.qml index a20608686..6ef82580e 100644 --- a/examples/tessellation-modes/TessellatedWireframeEffect.qml +++ b/examples/tessellation-modes/TessellatedWireframeEffect.qml @@ -87,7 +87,6 @@ Effect { renderPasses: [ RenderPass { - name: "lighting" bindings: [ ParameterMapper { parameterName: "ambient"; shaderVariableName: "ka"; bindingType: ParameterMapper.Uniform }, diff --git a/examples/torus-cpp/main.cpp b/examples/torus-cpp/main.cpp index 065780f40..91bde0558 100644 --- a/examples/torus-cpp/main.cpp +++ b/examples/torus-cpp/main.cpp @@ -50,7 +50,7 @@ #include <Qt3DRenderer/qmesh.h> #include <Qt3DRenderer/qtechnique.h> #include <Qt3DRenderer/qmaterial.h> -#include <Qt3DCore/qabstracteffect.h> +#include <Qt3DRenderer/qeffect.h> #include <Qt3DRenderer/qtexture.h> #include <Qt3DRenderer/qrenderpass.h> #include <Qt3DRenderer/qsceneloader.h> diff --git a/examples/wireframe/WireframeEffect.qml b/examples/wireframe/WireframeEffect.qml index 0cd3d2f76..2b31aa603 100644 --- a/examples/wireframe/WireframeEffect.qml +++ b/examples/wireframe/WireframeEffect.qml @@ -89,7 +89,6 @@ Effect { renderPasses: [ RenderPass { - name: "lighting" // The bindings property allows us to map from names of parameters (uniforms or vertex attributes) // within a shader to more friendly names in QML. By default the parameter names are exposed from diff --git a/src/core/core-components/core-components.pri b/src/core/core-components/core-components.pri index 38c0ab820..ff4be66c1 100644 --- a/src/core/core-components/core-components.pri +++ b/src/core/core-components/core-components.pri @@ -3,27 +3,12 @@ HEADERS += \ $$PWD/qcamera.h \ $$PWD/qcameralens.h \ $$PWD/qcameralens_p.h \ - $$PWD/qabstractmaterial.h \ - $$PWD/qabstractmaterial_p.h \ $$PWD/qabstractmesh.h \ - $$PWD/qabstracttechnique.h \ - $$PWD/qabstractrenderpass.h \ - $$PWD/qabstracteffect.h \ - $$PWD/qabstractshader.h \ - $$PWD/qabstractmesh_p.h \ - $$PWD/qabstracteffect_p.h \ - $$PWD/qabstracttechnique_p.h \ - $$PWD/qabstractrenderpass_p.h \ - $$PWD/qabstractshader_p.h + $$PWD/qabstractmesh_p.h SOURCES += \ $$PWD/qcamera.cpp \ $$PWD/qcameralens.cpp \ - $$PWD/qabstractmaterial.cpp \ - $$PWD/qabstractmesh.cpp \ - $$PWD/qabstracttechnique.cpp \ - $$PWD/qabstractrenderpass.cpp \ - $$PWD/qabstracteffect.cpp \ - $$PWD/qabstractshader.cpp + $$PWD/qabstractmesh.cpp INCLUDEPATH += $$PWD diff --git a/src/core/core-components/qabstracteffect.cpp b/src/core/core-components/qabstracteffect.cpp deleted file mode 100644 index 5de20afd6..000000000 --- a/src/core/core-components/qabstracteffect.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qabstracteffect.h" -#include "qabstracteffect_p.h" -#include "qabstracttechnique.h" -#include <Qt3DCore/qscenepropertychange.h> - -/*! - * \class QAbstractEffect - * \namespace Qt3D - * - * \brief Provides an abstract class that should be the base of all Effect element - * classes in a scene - * - * QAbstractEffect is bound to be linked by a Material. It is responsible for holding all the - * techniques that can be used to perform rendering. - * - * \sa QAbstractTechnique, Component - */ - - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - - -QAbstractEffectPrivate::QAbstractEffectPrivate(QAbstractEffect *qq) - : QNodePrivate(qq) -{} - -QAbstractEffect::QAbstractEffect(QNode *parent) - : QNode(*new QAbstractEffectPrivate(this), parent) -{ -} - -QAbstractEffect::QAbstractEffect(QAbstractEffectPrivate &dd, QNode *parent) - : QNode(dd, parent) -{ -} - -/*! - * Adds a new technique \a t to the effect. This posts a CommponentAdded - * QScenePropertyChange notification to the QChangeArbiter, the value is - * the added technique and the property name is "technique". - */ -void QAbstractEffect::addTechnique(QAbstractTechnique *t) -{ - Q_ASSERT(t); - Q_D(QAbstractEffect); - if (!d->m_techniques.contains(t)) { - d->m_techniques.append(t); - - // We need to add it as a child of the current node if it has been declared inline - // Or not previously added as a child of the current node so that - // 1) The backend gets notified about it's creation - // 2) When the current node is destroyed, tit gets destroyed as well - if (!t->parent()) - t->setParent(this); - - if (d->m_changeArbiter != Q_NULLPTR) { - QScenePropertyChangePtr e(new QScenePropertyChange(NodeAdded, this)); - e->setPropertyName(QByteArrayLiteral("technique")); - e->setValue(QVariant::fromValue(t)); - d->notifyObservers(e); - } - } -} - -/*! - * Removes a technique \t from the effect. This posts a ComponentRemoved - * QScenePropertyChange notification to the QChangeArbiter, the value is - * the removed technique's uuid and the property name is "technique". - */ -void QAbstractEffect::removeTechnique(QAbstractTechnique *t) -{ - Q_D(QAbstractEffect); - if (d->m_changeArbiter != Q_NULLPTR) { - QScenePropertyChangePtr e(new QScenePropertyChange(NodeRemoved, this)); - e->setPropertyName(QByteArrayLiteral("technique")); - e->setValue(QVariant::fromValue(t->uuid())); - d->notifyObservers(e); - } - d->m_techniques.removeOne(t); -} - -/*! - * Returns the list of techniques used by the effect. - */ -QList<QAbstractTechnique *> QAbstractEffect::techniques() const -{ - Q_D(const QAbstractEffect); - return d->m_techniques; -} - -/*! - * Clears the list of techniques used by the effet. - * No notification is posted when using this method. - */ -void QAbstractEffect::clearTechniques() -{ - Q_D(QAbstractEffect); - qDeleteAll(d->m_techniques); - d->m_techniques.clear(); -} - -} // namespace Qt3D - -QT_END_NAMESPACE diff --git a/src/core/core-components/qabstracteffect.h b/src/core/core-components/qabstracteffect.h deleted file mode 100644 index c4cdcf9df..000000000 --- a/src/core/core-components/qabstracteffect.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QABSTRACTEFFECT_H -#define QT3D_QABSTRACTEFFECT_H - -#include <Qt3DCore/qnode.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QAbstractTechnique; -class QAbstractEffectPrivate; - -// TO DO : Abstract doesn't apply but that might evolve as we further define -// the class - -class QT3DCORESHARED_EXPORT QAbstractEffect - : public QNode -{ - Q_OBJECT -public: - explicit QAbstractEffect(QNode *parent = 0); - - virtual void addTechnique(QAbstractTechnique *t); - virtual void removeTechnique(QAbstractTechnique *t); - - QList<QAbstractTechnique *> techniques() const; - - void clearTechniques(); - -Q_SIGNALS: - void techniquesChanged(); - -protected: - Q_DECLARE_PRIVATE(QAbstractEffect) - QAbstractEffect(QAbstractEffectPrivate &dd, QNode *parent = 0); -}; - -} // Qt3D - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(Qt3D::QAbstractEffect*) - - -#endif // QT3D_QABSTRACTEFFECT_H diff --git a/src/core/core-components/qabstracteffect_p.h b/src/core/core-components/qabstracteffect_p.h deleted file mode 100644 index bcf5d1847..000000000 --- a/src/core/core-components/qabstracteffect_p.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QABSTRACTEFFECT_P_H -#define QT3D_QABSTRACTEFFECT_P_H - -#include <private/qnode_p.h> -#include <Qt3DCore/qt3dcore_global.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QAbstractEffect; -class QAbstractTechnique; - -class QT3DCORESHARED_EXPORT QAbstractEffectPrivate : public QNodePrivate -{ -public : - QAbstractEffectPrivate(QAbstractEffect *qq); - QList<QAbstractTechnique *> m_techniques; - Q_DECLARE_PUBLIC(QAbstractEffect) -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QABSTRACTEFFECT_P_H diff --git a/src/core/core-components/qabstractmaterial.cpp b/src/core/core-components/qabstractmaterial.cpp deleted file mode 100644 index b5c3aa5f4..000000000 --- a/src/core/core-components/qabstractmaterial.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qabstractmaterial.h" -#include "qabstractmaterial_p.h" -#include "qscenepropertychange.h" -#include "qabstracteffect.h" - -/*! - * \class QAbstractMaterial - * \namespace Qt3D - * - * \inherits Component - * - * \brief Provides an abstract class that should be the base of all - * Material component classes in a scene. - * - * QAbstractMaterial provide a way to specify the rendering of an Entity. - * Any aspect can define its own subclass of QAbstractMaterial so that a - * Material can be used to describe a visual element, the way sound should - * reflect on an element, the temperature of a surface and so on. - * - * \sa QAbstractEffect, QAbstractMesh, Component - */ - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -QAbstractMaterialPrivate::QAbstractMaterialPrivate(QAbstractMaterial *qq) - : QComponentPrivate(qq) - , m_effect(Q_NULLPTR) -{} - -QAbstractMaterial::QAbstractMaterial(QNode *parent) - : QComponent(*new QAbstractMaterialPrivate(this), parent) -{ -} - -QAbstractMaterial::QAbstractMaterial(QAbstractMaterialPrivate &dd, QNode *parent) - : QComponent(dd, parent) -{ -} - -/*! - * Sets the \a effect to be used with the Material. - */ -void QAbstractMaterial::setEffect(QAbstractEffect *effect) -{ - Q_D(QAbstractMaterial); - if (effect != d->m_effect) { - - if (d->m_effect != Q_NULLPTR && d->m_changeArbiter != Q_NULLPTR) { - QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, this)); - change->setPropertyName(QByteArrayLiteral("effect")); - change->setValue(QVariant::fromValue(d->m_effect)); - d->notifyObservers(change); - } - - d->m_effect = effect; - emit effectChanged(); - - // We need to add it as a child of the current node if it has been declared inline - // Or not previously added as a child of the current node so that - // 1) The backend gets notified about it's creation - // 2) When the current node is destroyed, it gets destroyed as well - if (!effect->parent()) - effect->setParent(this); - - if (d->m_changeArbiter != Q_NULLPTR) { - QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, this)); - change->setPropertyName(QByteArrayLiteral("effect")); - change->setValue(QVariant::fromValue(effect)); - d->notifyObservers(change); - } - } -} - -/*! - * Returns the effect used by the Material. - */ -QAbstractEffect *QAbstractMaterial::effect() const -{ - Q_D(const QAbstractMaterial); - return d->m_effect; -} - -} // Qt3D - -QT_END_NAMESPACE diff --git a/src/core/core-components/qabstractmaterial.h b/src/core/core-components/qabstractmaterial.h deleted file mode 100644 index af1a83abc..000000000 --- a/src/core/core-components/qabstractmaterial.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QABSTRACTMATERIAL_H -#define QT3D_QABSTRACTMATERIAL_H - -#include <Qt3DCore/qcomponent.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3D -{ - -class QAbstractEffect; -class QAbstractMaterialPrivate; - -class QT3DCORESHARED_EXPORT QAbstractMaterial : public QComponent -{ - Q_OBJECT - Q_PROPERTY(Qt3D::QAbstractEffect* effect READ effect WRITE setEffect NOTIFY effectChanged) -public: - QAbstractMaterial(QNode *parent = 0); - - virtual void setEffect(Qt3D::QAbstractEffect *effect); - QAbstractEffect *effect() const; - -Q_SIGNALS: - void effectChanged(); - -protected: - Q_DECLARE_PRIVATE(QAbstractMaterial) - QAbstractMaterial(QAbstractMaterialPrivate &dd, QNode *parent = 0); -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3D_QABSTRACTMATERIAL_H diff --git a/src/core/core-components/qabstractmaterial_p.h b/src/core/core-components/qabstractmaterial_p.h deleted file mode 100644 index b1b9effe4..000000000 --- a/src/core/core-components/qabstractmaterial_p.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QABSTRACTMATERIAL_P_H -#define QT3D_QABSTRACTMATERIAL_P_H - -#include <Qt3DCore/qt3dcore_global.h> -#include <private/qcomponent_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QAbstractMaterial; -class QAbstractEffect; - -class QT3DCORESHARED_EXPORT QAbstractMaterialPrivate : public QComponentPrivate -{ -public : - QAbstractMaterialPrivate(QAbstractMaterial *qq); - - Q_DECLARE_PUBLIC(QAbstractMaterial) - - QAbstractEffect *m_effect; -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3D_QABSTRACTMATERIAL_P_H diff --git a/src/core/core-components/qabstractrenderpass.cpp b/src/core/core-components/qabstractrenderpass.cpp deleted file mode 100644 index 6484f1701..000000000 --- a/src/core/core-components/qabstractrenderpass.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qabstractrenderpass.h" -#include "qabstractrenderpass_p.h" -#include "qabstractshader.h" -#include <Qt3DCore/qscenepropertychange.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -QAbstractRenderPassPrivate::QAbstractRenderPassPrivate(QAbstractRenderPass *qq) - : QNodePrivate(qq) - , m_shader(Q_NULLPTR) -{ -} - -QAbstractRenderPass::QAbstractRenderPass(QNode *parent) - : QNode(*new QAbstractRenderPassPrivate(this), parent) -{ -} - -QAbstractRenderPass::QAbstractRenderPass(QAbstractRenderPassPrivate &dd, QNode *parent) - : QNode(dd, parent) -{ -} - -void QAbstractRenderPass::setName(const QString &name) -{ - Q_D(QAbstractRenderPass); - if (d->m_name != name) { - d->m_name = name; - emit nameChanged(); - } -} - -QString QAbstractRenderPass::name() const -{ - Q_D(const QAbstractRenderPass); - return d->m_name; -} - -/*! - * Sets the pass's \a shaderProgram. This posts a ComponentUpdated - * QScenePropertyChange to the QChangeArbiter. The value is set to - * the \a ShaderProgram and the property name to "shaderProgram". - */ -void QAbstractRenderPass::setShaderProgram(QAbstractShader *shaderProgram) -{ - Q_D(QAbstractRenderPass); - if (d->m_shader != shaderProgram) { - - if (d->m_shader != Q_NULLPTR && d->m_changeArbiter != Q_NULLPTR) { - QScenePropertyChangePtr e(new QScenePropertyChange(NodeRemoved, this)); - e->setPropertyName(QByteArrayLiteral("shaderProgram")); - e->setValue(QVariant::fromValue(d->m_shader->uuid())); - d->notifyObservers(e); - } - - d->m_shader = shaderProgram; - emit shaderProgramChanged(); - - // We need to add it as a child of the current node if it has been declared inline - // Or not previously added as a child of the current node so that - // 1) The backend gets notified about it's creation - // 2) When the current node is destroyed, it gets destroyed as well - if (!shaderProgram->parent()) - shaderProgram->setParent(this); - - if (d->m_changeArbiter != Q_NULLPTR) { - QScenePropertyChangePtr e(new QScenePropertyChange(NodeAdded, this)); - e->setPropertyName(QByteArrayLiteral("shaderProgram")); - e->setValue(QVariant::fromValue(shaderProgram->uuid())); - d->notifyObservers(e); - } - } -} - -QAbstractShader *QAbstractRenderPass::shaderProgram() const -{ - Q_D(const QAbstractRenderPass); - return d->m_shader; -} - -} // Qt3D - -QT_END_NAMESPACE diff --git a/src/core/core-components/qabstractrenderpass.h b/src/core/core-components/qabstractrenderpass.h deleted file mode 100644 index 71a48dec3..000000000 --- a/src/core/core-components/qabstractrenderpass.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QABSTRACTRENDERPASS_H -#define QT3D_QABSTRACTRENDERPASS_H - -#include <Qt3DCore/qnode.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QAbstractShader; -class QAbstractRenderPassPrivate; - -class QT3DCORESHARED_EXPORT QAbstractRenderPass - : public QNode -{ - Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(Qt3D::QAbstractShader * shaderProgram READ shaderProgram WRITE setShaderProgram NOTIFY shaderProgramChanged) - -public: - explicit QAbstractRenderPass(QNode *parent = 0); - - virtual void setName(const QString &name); - QString name() const; - - virtual void setShaderProgram(QAbstractShader* shaderProgram); - QAbstractShader* shaderProgram() const; -Q_SIGNALS: - void nameChanged(); - void shaderProgramChanged(); - -protected: - Q_DECLARE_PRIVATE(QAbstractRenderPass) - QAbstractRenderPass(QAbstractRenderPassPrivate &dd, QNode *parent = 0); -}; - -} // Qt3D - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(Qt3D::QAbstractRenderPass *) - -#endif // QT3D_QABSTRACTRENDERPASS_H diff --git a/src/core/core-components/qabstractrenderpass_p.h b/src/core/core-components/qabstractrenderpass_p.h deleted file mode 100644 index 13045de0f..000000000 --- a/src/core/core-components/qabstractrenderpass_p.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QABSTRACTRENDERPASS_P_H -#define QT3D_QABSTRACTRENDERPASS_P_H - -#include <private/qnode_p.h> -#include <Qt3DCore/qabstractrenderpass.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QAbstractShader; - -class QT3DCORESHARED_EXPORT QAbstractRenderPassPrivate : public QNodePrivate -{ -public: - QAbstractRenderPassPrivate(QAbstractRenderPass *qq); - - Q_DECLARE_PUBLIC(QAbstractRenderPass) - QAbstractShader *m_shader; - QString m_name; -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3D_QABSTRACTRENDERPASS_P_H diff --git a/src/core/core-components/qabstractshader.cpp b/src/core/core-components/qabstractshader.cpp deleted file mode 100644 index 7b272c872..000000000 --- a/src/core/core-components/qabstractshader.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qabstractshader.h" -#include "qabstractshader_p.h" - -/*! - * \class QAbstractShader - * - * \namespace Qt3D - * \inherits Node - * - * \brief QAbstractShader is the base class of all Shader element classes. - * - */ - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -QAbstractShaderPrivate::QAbstractShaderPrivate(QAbstractShader *qq) - : QNodePrivate(qq) -{ -} - -QAbstractShader::QAbstractShader(QNode *parent) - : QNode(*new QAbstractShaderPrivate(this), parent) -{ -} - -QAbstractShader::QAbstractShader(QAbstractShaderPrivate &dd, QNode *parent) - : QNode(dd, parent) -{ -} - -} // Qt3D - -QT_END_NAMESPACE diff --git a/src/core/core-components/qabstractshader.h b/src/core/core-components/qabstractshader.h deleted file mode 100644 index b8b73c30b..000000000 --- a/src/core/core-components/qabstractshader.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QABSTRACTSHADER_H -#define QT3D_QABSTRACTSHADER_H - -#include <Qt3DCore/qnode.h> -#include <QUuid> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QAbstractShaderPrivate; - -class QT3DCORESHARED_EXPORT QAbstractShader - : public QNode -{ - Q_OBJECT -public: - explicit QAbstractShader(QNode *parent = 0); - -protected: - Q_DECLARE_PRIVATE(QAbstractShader) - QAbstractShader(QAbstractShaderPrivate &dd, QNode *parent = 0); -}; - -} // Qt3D - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(Qt3D::QAbstractShader *) - -#endif // QT3D_QABSTRACTSHADER_H diff --git a/src/core/core-components/qabstractshader_p.h b/src/core/core-components/qabstractshader_p.h deleted file mode 100644 index 1e86d264c..000000000 --- a/src/core/core-components/qabstractshader_p.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QABSTRACTSHADER_P_H -#define QT3D_QABSTRACTSHADER_P_H - -#include <private/qnode_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QT3DCORESHARED_EXPORT QAbstractShaderPrivate : public QNodePrivate -{ -public: - QAbstractShaderPrivate(QAbstractShader *qq); - - QUuid m_uuid; - Q_DECLARE_PUBLIC(QAbstractShader) -}; - -} // Qt3D - -QT_END_NAMESPACE - - -#endif // QT3D_QABSTRACTSHADER_P_H diff --git a/src/core/core-components/qabstracttechnique.cpp b/src/core/core-components/qabstracttechnique.cpp deleted file mode 100644 index d9c9f04b1..000000000 --- a/src/core/core-components/qabstracttechnique.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qabstracttechnique.h" -#include "qabstractrenderpass.h" -#include "qabstracttechnique_p.h" - -#include <Qt3DCore/qscenepropertychange.h> - -/*! - * \class QAbstractTechnique - * \namespace Qt3D - * - * \inherits Node - * - * \brief Provides an abstract class that should be the base of all - * Technique classes in a scene. - * - * A QAbstractTechnique is a container of QAbstractRenderPasses. If it contains - * several passes, that doesn't mean they will all be used during rendering. This - * depends on the aspect behind used for that purpose and any pass filtering set up - * by the QAbstractTechnique subclass. - * - * \sa QAbstractEffect, QAbstractRenderPass - */ - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - - -QAbstractTechniquePrivate::QAbstractTechniquePrivate(QAbstractTechnique *qq) - : QNodePrivate(qq) -{ -} - -QAbstractTechnique::QAbstractTechnique(QNode *parent) - : QNode(*new QAbstractTechniquePrivate(this), parent) -{ -} - - -QAbstractTechnique::QAbstractTechnique(QAbstractTechniquePrivate &dd, QNode *parent) - : QNode(dd, parent) -{ -} - -/*! - * Appends a \a pass to the technique. This posts a ComponentAdded - * QScenePropertyChange notification to the QChangeArbiter with the - * value being the \a pass and the property name being "pass". - */ -void QAbstractTechnique::addPass(QAbstractRenderPass *pass) -{ - Q_D(QAbstractTechnique); - if (!d->m_renderPasses.contains(pass)) { - d->m_renderPasses.append(pass); - - // We need to add it as a child of the current node if it has been declared inline - // Or not previously added as a child of the current node so that - // 1) The backend gets notified about it's creation - // 2) When the current node is destroyed, it gets destroyed as well - if (!pass->parent()) - pass->setParent(this); - - if (d->m_changeArbiter != Q_NULLPTR) { - QScenePropertyChangePtr e(new QScenePropertyChange(NodeAdded, this)); - e->setPropertyName(QByteArrayLiteral("pass")); - e->setValue(QVariant::fromValue(pass)); - d->notifyObservers(e); - } - } -} - -/*! - * Removes a \a pass from the technique. This posts a ComponentRemoved - * QScenePropertyChange notification to the QChangeArbiter with the value - * being the \a pass' uuid and the property name being "pass". - */ -void QAbstractTechnique::removePass(QAbstractRenderPass *pass) -{ - Q_D(QAbstractTechnique); - if (d->m_changeArbiter) { - QScenePropertyChangePtr e(new QScenePropertyChange(NodeRemoved, this)); - e->setPropertyName(QByteArrayLiteral("pass")); - e->setValue(QVariant::fromValue(pass->uuid())); - d->notifyObservers(e); - } - d->m_renderPasses.removeOne(pass); -} - -/*! - * Returns the list of render passes contained in the technique. - */ -QList<QAbstractRenderPass *> QAbstractTechnique::renderPasses() const -{ - Q_D(const QAbstractTechnique); - return d->m_renderPasses; -} - -} // Qt3D - -QT_END_NAMESPACE diff --git a/src/core/core-components/qabstracttechnique.h b/src/core/core-components/qabstracttechnique.h deleted file mode 100644 index 1487ea0df..000000000 --- a/src/core/core-components/qabstracttechnique.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QABSTRACTTECHNIQUE_H -#define QT3D_QABSTRACTTECHNIQUE_H - -#include <Qt3DCore/qnode.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QAbstractRenderPass; -class QAbstractTechniquePrivate; - -class QT3DCORESHARED_EXPORT QAbstractTechnique - : public QNode -{ - Q_OBJECT - -public: - explicit QAbstractTechnique(QNode *parent = 0); - - virtual void addPass(QAbstractRenderPass *pass); - virtual void removePass(QAbstractRenderPass *pass); - QList<QAbstractRenderPass *> renderPasses() const; - -protected: - Q_DECLARE_PRIVATE(QAbstractTechnique) - QAbstractTechnique(QAbstractTechniquePrivate &dd, QNode *parent = 0); -}; - -} // Qt3D - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(Qt3D::QAbstractTechnique *) - -#endif // QT3D_QABSTRACTTECHNIQUE_H diff --git a/src/core/core-components/qabstracttechnique_p.h b/src/core/core-components/qabstracttechnique_p.h deleted file mode 100644 index 23a761fbc..000000000 --- a/src/core/core-components/qabstracttechnique_p.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_QABSTRACTTECHNIQUE_P_H -#define QT3D_QABSTRACTTECHNIQUE_P_H - -#include <private/qnode_p.h> -#include <Qt3DCore/qt3dcore_global.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class QAbstractTechnique; -class QAbstractRenderPass; - -class QT3DCORESHARED_EXPORT QAbstractTechniquePrivate : public QNodePrivate -{ -public: - QAbstractTechniquePrivate(QAbstractTechnique *qq); - Q_DECLARE_PUBLIC(QAbstractTechnique) - QString m_name; - QList<QAbstractRenderPass*> m_renderPasses; -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3D_QABSTRACTTECHNIQUE_P_H diff --git a/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp b/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp index 429ed2504..cbda8f631 100644 --- a/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp +++ b/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp @@ -48,12 +48,7 @@ #include <Qt3DCore/qmatrixtransform.h> #include <Qt3DCore/qtranslatetransform.h> #include <Qt3DCore/qrotatetransform.h> -#include <Qt3DCore/qabstracteffect.h> -#include <Qt3DCore/qabstractmaterial.h> -#include <Qt3DCore/qabstracttechnique.h> #include <Qt3DCore/qabstractmesh.h> -#include <Qt3DCore/qabstractrenderpass.h> -#include <Qt3DCore/qabstractshader.h> #include <Qt3DQuick/quick3dentity.h> #include <Qt3DQuick/quick3dtransform.h> #include <Qt3DQuick/quick3dconfiguration.h> @@ -64,11 +59,6 @@ void Qt3DQuick3DCorePlugin::registerTypes(const char *uri) { qmlRegisterUncreatableType<Qt3D::QComponent>(uri, 2, 0, "Component", QStringLiteral("")); qmlRegisterUncreatableType<Qt3D::QAbstractMesh>(uri, 2, 0, "QAbstractMesh", QStringLiteral("")); - qmlRegisterUncreatableType<Qt3D::QAbstractMaterial>(uri, 2, 0, "QAbstractMaterial", QStringLiteral("")); - qmlRegisterUncreatableType<Qt3D::QAbstractTechnique>(uri, 2, 0, "QAbstractTechnique", QStringLiteral("")); - qmlRegisterUncreatableType<Qt3D::QAbstractRenderPass>(uri, 2, 0, "QAbstractRenderPass", QStringLiteral("")); - qmlRegisterUncreatableType<Qt3D::QAbstractEffect>(uri, 2, 0, "QAbstractEffect", QStringLiteral("")); - qmlRegisterUncreatableType<Qt3D::QAbstractShader>(uri, 2, 0, "QAbstractShader", QStringLiteral("")); qmlRegisterUncreatableType<Qt3D::QAbstractTransform>(uri, 2, 0, "QAbstractTransform", QStringLiteral("QAbstractTransform is abstract")); qmlRegisterType<Qt3D::Quick::Quick3DConfiguration>(uri, 2, 0, "Configuration"); diff --git a/src/quick3d/quick3drenderer/items/quick3deffect.cpp b/src/quick3d/quick3drenderer/items/quick3deffect.cpp index 5c67da2db..8d9cc2469 100644 --- a/src/quick3d/quick3drenderer/items/quick3deffect.cpp +++ b/src/quick3d/quick3drenderer/items/quick3deffect.cpp @@ -103,7 +103,7 @@ void Quick3DEffect::clearTechniqueList(QQmlListProperty<QTechnique> *list) if (eff) { // Ownership of techniques is handled by the QmlEngine so we shouldn't class clearTechniques // which deletes techniques - Q_FOREACH (QAbstractTechnique *tech, eff->parentEffect()->techniques()) + Q_FOREACH (QTechnique *tech, eff->parentEffect()->techniques()) eff->parentEffect()->removeTechnique(tech); } } diff --git a/src/quick3d/quick3drenderer/items/quick3deffect.h b/src/quick3d/quick3drenderer/items/quick3deffect.h index e61b8efd1..09db27bcf 100644 --- a/src/quick3d/quick3drenderer/items/quick3deffect.h +++ b/src/quick3d/quick3drenderer/items/quick3deffect.h @@ -43,8 +43,8 @@ #define QT3D_RENDER_QUICK_QUICK3DEFFECT_H #include <Qt3DQuickRenderer/qt3dquickrenderer_global.h> -#include <Qt3DCore/qabstracteffect.h> #include <QQmlListProperty> +#include <Qt3DRenderer/qeffect.h> #include <Qt3DRenderer/qtechnique.h> @@ -65,7 +65,7 @@ class QT3DQUICKRENDERERSHARED_EXPORT Quick3DEffect : public QObject public: explicit Quick3DEffect(QObject *parent = 0); - inline QAbstractEffect *parentEffect() const { return qobject_cast<QAbstractEffect*>(parent()); } + inline QEffect *parentEffect() const { return qobject_cast<QEffect*>(parent()); } QQmlListProperty<Qt3D::QTechnique> techniqueList(); QQmlListProperty<Qt3D::QParameter> parameterList(); diff --git a/src/quick3d/quick3drenderer/items/quick3dtechnique.cpp b/src/quick3d/quick3drenderer/items/quick3dtechnique.cpp index a22f60400..a41988ffe 100644 --- a/src/quick3d/quick3drenderer/items/quick3dtechnique.cpp +++ b/src/quick3d/quick3drenderer/items/quick3dtechnique.cpp @@ -126,7 +126,7 @@ void Quick3DTechnique::clearRenderPasses(QQmlListProperty<QRenderPass> *list) { Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object); if (technique) { - Q_FOREACH (QAbstractRenderPass *pass, technique->parentTechnique()->renderPasses()) + Q_FOREACH (QRenderPass *pass, technique->parentTechnique()->renderPasses()) technique->parentTechnique()->removePass(pass); emit technique->renderPassesChanged(); } diff --git a/src/render/backend/entitymanager_p.h b/src/render/backend/entitymanager_p.h index 4b062cbc5..019aa68da 100644 --- a/src/render/backend/entitymanager_p.h +++ b/src/render/backend/entitymanager_p.h @@ -44,7 +44,6 @@ #include <QtGlobal> #include <QUuid> -#include <Qt3DCore/qabstractrenderpass.h> #include <Qt3DCore/qresourcesmanager.h> #include <Qt3DRenderer/private/renderentity_p.h> diff --git a/src/render/backend/matrixmanager_p.h b/src/render/backend/matrixmanager_p.h index f8a79ca64..0b53e083f 100644 --- a/src/render/backend/matrixmanager_p.h +++ b/src/render/backend/matrixmanager_p.h @@ -45,7 +45,6 @@ #include <QMatrix4x4> #include <QUuid> #include <Qt3DCore/qresourcesmanager.h> -#include <Qt3DCore/qabstractrenderpass.h> #include <Qt3DCore/qhandle.h> QT_BEGIN_NAMESPACE diff --git a/src/render/backend/rendereffect.cpp b/src/render/backend/rendereffect.cpp index 9f6fe5844..6e3db610b 100644 --- a/src/render/backend/rendereffect.cpp +++ b/src/render/backend/rendereffect.cpp @@ -48,8 +48,6 @@ #include <Qt3DRenderer/rendereraspect.h> #include <Qt3DCore/qaspectmanager.h> -#include <Qt3DCore/qabstracteffect.h> -#include <Qt3DCore/qabstracttechnique.h> #include <Qt3DCore/qchangearbiter.h> #include <Qt3DCore/qscenepropertychange.h> @@ -77,7 +75,7 @@ void RenderEffect::cleanup() m_renderer->rendererAspect()->aspectManager()->changeArbiter()->unregisterObserver(this, m_effectUuid); } -void RenderEffect::setPeer(QAbstractEffect *effect) +void RenderEffect::setPeer(QEffect *effect) { QUuid peerUuid; if (effect != Q_NULLPTR) @@ -93,12 +91,11 @@ void RenderEffect::setPeer(QAbstractEffect *effect) if (!m_effectUuid.isNull()) { arbiter->registerObserver(this, m_effectUuid, NodeAdded|NodeRemoved|ComponentUpdated); - Q_FOREACH (QAbstractTechnique *t, effect->techniques()) + Q_FOREACH (QTechnique *t, effect->techniques()) appendRenderTechnique(t); - if (qobject_cast<QEffect*>(effect)) - Q_FOREACH (QParameter *p, qobject_cast<QEffect*>(effect)->parameters()) - m_parameterPack.appendParameter(p); + Q_FOREACH (QParameter *p, effect->parameters()) + m_parameterPack.appendParameter(p); } } } @@ -117,7 +114,7 @@ void RenderEffect::sceneChangeEvent(const QSceneChangePtr &e) case NodeAdded: if (propertyChange->propertyName() == QByteArrayLiteral("technique")) { - appendRenderTechnique(propertyValue.value<QAbstractTechnique *>()); + appendRenderTechnique(propertyValue.value<QTechnique *>()); } // We don't need a RenderParameter as we store them in a QHash[QString name] = QVariant value else if (propertyChange->propertyName() == QByteArrayLiteral("parameter")) { @@ -140,9 +137,8 @@ void RenderEffect::sceneChangeEvent(const QSceneChangePtr &e) } } -void RenderEffect::appendRenderTechnique(QAbstractTechnique *t) +void RenderEffect::appendRenderTechnique(QTechnique *technique) { - QTechnique *technique = qobject_cast<QTechnique *>(t); if (!technique) return ; if (!m_techniques.contains(technique->uuid())) diff --git a/src/render/backend/rendereffect_p.h b/src/render/backend/rendereffect_p.h index a3a09d0f3..cb7e91ce6 100644 --- a/src/render/backend/rendereffect_p.h +++ b/src/render/backend/rendereffect_p.h @@ -52,8 +52,8 @@ QT_BEGIN_NAMESPACE namespace Qt3D { -class QAbstractTechnique; -class QAbstractEffect; +class QTechnique; +class QEffect; template <typename T, int INDEXBITS> class QHandle; @@ -74,10 +74,10 @@ public: ~RenderEffect(); void cleanup(); - void setPeer(QAbstractEffect *effect); + void setPeer(QEffect *effect); void setRenderer(Renderer *renderer); void sceneChangeEvent(const QSceneChangePtr &e); - void appendRenderTechnique(QAbstractTechnique *t); + void appendRenderTechnique(QTechnique *t); QList<QUuid> techniques() const; const QHash<QString, QVariant> parameters() const; diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp index 726acd525..b2e2f17f9 100644 --- a/src/render/backend/renderer.cpp +++ b/src/render/backend/renderer.cpp @@ -56,6 +56,7 @@ #include <Qt3DRenderer/qtechnique.h> #include <Qt3DRenderer/rendereraspect.h> #include <Qt3DRenderer/renderlogging.h> +#include <Qt3DRenderer/qeffect.h> #include <Qt3DRenderer/private/blendstate_p.h> #include <Qt3DRenderer/private/cameramanager_p.h> @@ -102,10 +103,8 @@ #include <Qt3DRenderer/private/abstractsceneparser_p.h> #include <Qt3DCore/qcameralens.h> -#include <Qt3DCore/qabstracteffect.h> #include <Qt3DCore/qaspectmanager.h> -#include <qeffect.h> #include <QStack> #include <QSurface> #include <QElapsedTimer> diff --git a/src/render/backend/rendermaterial.cpp b/src/render/backend/rendermaterial.cpp index c55fb5b04..28180375d 100644 --- a/src/render/backend/rendermaterial.cpp +++ b/src/render/backend/rendermaterial.cpp @@ -40,20 +40,20 @@ ****************************************************************************/ #include "rendermaterial_p.h" -#include <Qt3DRenderer/rendereraspect.h> -#include <Qt3DRenderer/private/qgraphicscontext_p.h> -#include <Qt3DRenderer/private/rendertechnique_p.h> -#include <Qt3DRenderer/private/rendertextureprovider_p.h> -#include <Qt3DRenderer/private/renderer_p.h> -#include <Qt3DRenderer/private/effectmanager_p.h> -#include <Qt3DRenderer/private/rendereffect_p.h> -#include <qparameter.h> -#include <qtechnique.h> -#include <qmaterial.h> -#include <Qt3DCore/qabstracteffect.h> +#include "rendereraspect.h" +#include "qgraphicscontext_p.h" +#include "rendertechnique_p.h" +#include "rendertextureprovider_p.h" +#include "renderer_p.h" +#include "effectmanager_p.h" +#include "rendereffect_p.h" +#include "qparameter.h" +#include "qtechnique.h" +#include "qmaterial.h" +#include "qeffect.h" + #include <Qt3DCore/qaspectmanager.h> #include <Qt3DCore/qscenepropertychange.h> - #include <QOpenGLShaderProgram> QT_BEGIN_NAMESPACE @@ -146,7 +146,7 @@ void RenderMaterial::sceneChangeEvent(const QSceneChangePtr &e) m_parameterPack.appendParameter(param); } else if (propertyChange->propertyName() == QByteArrayLiteral("effect")) { - Qt3D::QAbstractEffect *eff = propertyChange->value().value<Qt3D::QAbstractEffect *>(); + QEffect *eff = propertyChange->value().value<QEffect *>(); m_effectUuid = QUuid(); if (eff != Q_NULLPTR) m_effectUuid = eff->uuid(); diff --git a/src/render/backend/renderpassmanager.cpp b/src/render/backend/renderpassmanager.cpp index c3e226f17..f43993391 100644 --- a/src/render/backend/renderpassmanager.cpp +++ b/src/render/backend/renderpassmanager.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include "renderpassmanager_p.h" -#include <Qt3DCore/qabstractrenderpass.h> QT_BEGIN_NAMESPACE diff --git a/src/render/backend/renderrenderpass.cpp b/src/render/backend/renderrenderpass.cpp index 9a64618ae..065d3638f 100644 --- a/src/render/backend/renderrenderpass.cpp +++ b/src/render/backend/renderrenderpass.cpp @@ -51,8 +51,6 @@ #include <Qt3DCore/qaspectmanager.h> #include <Qt3DCore/qchangearbiter.h> #include <Qt3DCore/qscenepropertychange.h> -#include <Qt3DCore/qabstractshader.h> - QT_BEGIN_NAMESPACE diff --git a/src/render/backend/renderscenebuilder.cpp b/src/render/backend/renderscenebuilder.cpp index 4df476cf2..25d26f8c1 100644 --- a/src/render/backend/renderscenebuilder.cpp +++ b/src/render/backend/renderscenebuilder.cpp @@ -61,6 +61,7 @@ #include <Qt3DRenderer/qrendertarget.h> #include <Qt3DRenderer/qclearbuffer.h> #include <Qt3DRenderer/qtexture.h> +#include <Qt3DRenderer/qeffect.h> #include <Qt3DRenderer/private/cameramanager_p.h> #include <Qt3DRenderer/private/cameraselectornode_p.h> @@ -224,15 +225,15 @@ void RenderSceneBuilder::createRenderElement(QNode *frontend) createRenderElementHelper<QTechnique, RenderTechnique, TechniqueManager>(frontend, m_renderer->techniqueManager()); } - else if (qobject_cast<QAbstractEffect *>(frontend)) { - createRenderElementHelper<QAbstractEffect, RenderEffect, EffectManager>(frontend, + else if (qobject_cast<QEffect *>(frontend)) { + createRenderElementHelper<QEffect, RenderEffect, EffectManager>(frontend, m_renderer->effectManager()); } else if (qobject_cast<QRenderPass *>(frontend)) { createRenderElementHelper<QRenderPass, RenderRenderPass, RenderPassManager>(frontend, m_renderer->renderPassManager()); } - else if (qobject_cast<QAbstractShader *>(frontend)) { + else if (qobject_cast<QShaderProgram *>(frontend)) { createRenderElementHelper<QShaderProgram, RenderShader, ShaderManager>(frontend, m_renderer->shaderManager()); } @@ -289,15 +290,15 @@ void RenderSceneBuilder::releaseRenderElement(QNode *frontend) m_renderer->materialManager()->releaseResource(frontend->uuid()); else if (qobject_cast<QTechnique *>(frontend)) m_renderer->techniqueManager()->releaseResource(frontend->uuid()); - else if (qobject_cast<QAbstractEffect *>(frontend)) + else if (qobject_cast<QEffect *>(frontend)) m_renderer->effectManager()->releaseResource(frontend->uuid()); - else if (qobject_cast<QAbstractRenderPass *>(frontend)) + else if (qobject_cast<QRenderPass *>(frontend)) m_renderer->renderPassManager()->releaseResource(frontend->uuid()); else if (qobject_cast<QCriterion *>(frontend)) m_renderer->criterionManager()->releaseResource(frontend->uuid()); else if (qobject_cast<QFrameGraphItem *>(frontend)) m_renderer->frameGraphManager()->releaseResource(frontend->uuid()); - else if (qobject_cast<QAbstractShader *>(frontend)) + else if (qobject_cast<QShaderProgram *>(frontend)) m_renderer->shaderManager()->releaseResource(frontend->uuid()); else if (qobject_cast<QRenderTarget *>(frontend)) m_renderer->renderTargetManager()->releaseResource(frontend->uuid()); diff --git a/src/render/backend/rendertechnique.cpp b/src/render/backend/rendertechnique.cpp index 1ea495c6c..771cfc0c0 100644 --- a/src/render/backend/rendertechnique.cpp +++ b/src/render/backend/rendertechnique.cpp @@ -105,7 +105,7 @@ void RenderTechnique::setPeer(QTechnique *peer) Q_FOREACH (QParameter *p, peer->parameters()) m_parameterPack.appendParameter(p); - Q_FOREACH (QAbstractRenderPass *rPass, peer->renderPasses()) + Q_FOREACH (QRenderPass *rPass, peer->renderPasses()) appendRenderPass(rPass); Q_FOREACH (QCriterion *criterion, peer->criteria()) appendCriterion(criterion); @@ -135,7 +135,7 @@ void RenderTechnique::sceneChangeEvent(const QSceneChangePtr &e) case NodeAdded: { if (propertyChange->propertyName() == QByteArrayLiteral("pass")) { - appendRenderPass(propertyChange->value().value<QAbstractRenderPass *>()); + appendRenderPass(propertyChange->value().value<QRenderPass *>()); } else if (propertyChange->propertyName() == QByteArrayLiteral("parameter")) { m_parameterPack.appendParameter(propertyChange->value().value<QParameter*>()); @@ -169,9 +169,8 @@ const QHash<QString, QVariant> RenderTechnique::parameters() const return m_parameterPack.namedValues(); } -void RenderTechnique::appendRenderPass(QAbstractRenderPass *rPass) +void RenderTechnique::appendRenderPass(QRenderPass *renderPass) { - QRenderPass *renderPass = qobject_cast<QRenderPass *>(rPass); if (!renderPass) return; if (!m_renderPasses.contains(renderPass->uuid())) diff --git a/src/render/backend/rendertechnique_p.h b/src/render/backend/rendertechnique_p.h index 8f234bce1..c7592ef52 100644 --- a/src/render/backend/rendertechnique_p.h +++ b/src/render/backend/rendertechnique_p.h @@ -57,7 +57,7 @@ class QTechnique; class QParameter; class QOpenGLFilter; class QCriterion; -class QAbstractRenderPass; +class QRenderPass; namespace Render { @@ -89,7 +89,7 @@ public: void sceneChangeEvent(const QSceneChangePtr &e); const QHash<QString, QVariant> parameters() const; - void appendRenderPass(QAbstractRenderPass *rPass); + void appendRenderPass(QRenderPass *rPass); void removeRenderPass(const QUuid &renderPassId); void appendCriterion(QCriterion *criterion); diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp index a7230b19f..96b040384 100644 --- a/src/render/backend/renderview.cpp +++ b/src/render/backend/renderview.cpp @@ -86,21 +86,19 @@ #include <Qt3DRenderer/private/sortcriterionmanager_p.h> #include <Qt3DRenderer/sphere.h> -#include "qalphatest.h" -#include "qblendequation.h" -#include "qblendstate.h" -#include "qcullface.h" -#include "qdepthmask.h" -#include "qdepthtest.h" -#include "qdithering.h" -#include "qfrontface.h" -#include "qscissortest.h" -#include "qstenciltest.h" +#include <Qt3DRenderer/qalphatest.h> +#include <Qt3DRenderer/qblendequation.h> +#include <Qt3DRenderer/qblendstate.h> +#include <Qt3DRenderer/qcullface.h> +#include <Qt3DRenderer/qdepthmask.h> +#include <Qt3DRenderer/qdepthtest.h> +#include <Qt3DRenderer/qdithering.h> +#include <Qt3DRenderer/qfrontface.h> +#include <Qt3DRenderer/qscissortest.h> +#include <Qt3DRenderer/qstenciltest.h> #include <Qt3DRenderer/private/blendstate_p.h> #include <Qt3DCore/qentity.h> -#include <Qt3DCore/qabstracteffect.h> -#include <Qt3DCore/qabstracttechnique.h> #include <Qt3DCore/qframeallocator.h> #include <QtGui/qsurface.h> diff --git a/src/render/backend/techniquemanager.cpp b/src/render/backend/techniquemanager.cpp index 09ff40142..c2ce43f97 100644 --- a/src/render/backend/techniquemanager.cpp +++ b/src/render/backend/techniquemanager.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include "techniquemanager_p.h" -#include <Qt3DCore/qabstracteffect.h> QT_BEGIN_NAMESPACE diff --git a/src/render/frontend/qeffect.cpp b/src/render/frontend/qeffect.cpp index b31d86942..0988f3222 100644 --- a/src/render/frontend/qeffect.cpp +++ b/src/render/frontend/qeffect.cpp @@ -51,21 +51,21 @@ QT_BEGIN_NAMESPACE namespace Qt3D { QEffectPrivate::QEffectPrivate(QEffect *qq) - : QAbstractEffectPrivate(qq) + : QNodePrivate(qq) {} QEffect::QEffect(QNode *parent) - : QAbstractEffect(*new QEffectPrivate(this), parent) + : QNode(*new QEffectPrivate(this), parent) { } void QEffectPrivate::copy(const QNodePrivate *ref) { - QAbstractEffectPrivate::copy(ref); + QNodePrivate::copy(ref); } QEffect::QEffect(QEffectPrivate &dd, QNode *parent) - : QAbstractEffect(dd, parent) + : QNode(dd, parent) { } @@ -79,8 +79,8 @@ QEffect *QEffect::doClone() const Q_FOREACH (QParameter *p, d->m_parameters) effect->addParameter(qobject_cast<QParameter *>(QNodePrivate::get(p)->clone())); - Q_FOREACH (QAbstractTechnique *t, d->m_techniques) - effect->addTechnique(qobject_cast<QAbstractTechnique *>(QNodePrivate::get(t)->clone())); + Q_FOREACH (QTechnique *t, d->m_techniques) + effect->addTechnique(qobject_cast<QTechnique *>(QNodePrivate::get(t)->clone())); return effect; } @@ -126,6 +126,61 @@ QList<QParameter *> QEffect::parameters() const return d->m_parameters; } +/*! + * Adds a new technique \a t to the effect. This posts a CommponentAdded + * QScenePropertyChange notification to the QChangeArbiter, the value is + * the added technique and the property name is "technique". + */ +void QEffect::addTechnique(QTechnique *t) +{ + Q_ASSERT(t); + Q_D(QEffect); + if (!d->m_techniques.contains(t)) { + d->m_techniques.append(t); + + // We need to add it as a child of the current node if it has been declared inline + // Or not previously added as a child of the current node so that + // 1) The backend gets notified about it's creation + // 2) When the current node is destroyed, tit gets destroyed as well + if (!t->parent()) + t->setParent(this); + + if (d->m_changeArbiter != Q_NULLPTR) { + QScenePropertyChangePtr e(new QScenePropertyChange(NodeAdded, this)); + e->setPropertyName(QByteArrayLiteral("technique")); + e->setValue(QVariant::fromValue(t)); + d->notifyObservers(e); + } + } +} + +/*! + * Removes a technique \t from the effect. This posts a ComponentRemoved + * QScenePropertyChange notification to the QChangeArbiter, the value is + * the removed technique's uuid and the property name is "technique". + */ +void QEffect::removeTechnique(QTechnique *t) +{ + Q_D(QEffect); + if (d->m_changeArbiter != Q_NULLPTR) { + QScenePropertyChangePtr e(new QScenePropertyChange(NodeRemoved, this)); + e->setPropertyName(QByteArrayLiteral("technique")); + e->setValue(QVariant::fromValue(t->uuid())); + d->notifyObservers(e); + } + d->m_techniques.removeOne(t); +} + +/*! + * Returns the list of techniques used by the effect. + */ +QList<QTechnique *> QEffect::techniques() const +{ + Q_D(const QEffect); + return d->m_techniques; +} + + } // Qt3D QT_END_NAMESPACE diff --git a/src/render/frontend/qeffect.h b/src/render/frontend/qeffect.h index 37b843e99..3f7642e60 100644 --- a/src/render/frontend/qeffect.h +++ b/src/render/frontend/qeffect.h @@ -42,7 +42,6 @@ #ifndef QT3D_QEFFECT_H #define QT3D_QEFFECT_H -#include <Qt3DCore/qabstracteffect.h> #include <Qt3DCore/qnode.h> #include <Qt3DRenderer/qt3drenderer_global.h> @@ -51,10 +50,11 @@ QT_BEGIN_NAMESPACE namespace Qt3D { class QParameter; +class QTechnique; class QEffectPrivate; class QT3DRENDERERSHARED_EXPORT QEffect - : public QAbstractEffect + : public QNode { Q_OBJECT public: @@ -64,6 +64,10 @@ public: void removeParameter(QParameter *parameter); QList<QParameter *> parameters() const; + virtual void addTechnique(QTechnique *t); + virtual void removeTechnique(QTechnique *t); + QList<QTechnique *> techniques() const; + protected: QEffect(QEffectPrivate &dd, QNode *parent = 0); @@ -76,4 +80,6 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(Qt3D::QEffect*) + #endif // QT3D_QEFFECT_H diff --git a/src/render/frontend/qeffect_p.h b/src/render/frontend/qeffect_p.h index 8e383141f..4446dd81e 100644 --- a/src/render/frontend/qeffect_p.h +++ b/src/render/frontend/qeffect_p.h @@ -42,7 +42,7 @@ #ifndef QT3D_QEFFECT_P_H #define QT3D_QEFFECT_P_H -#include <private/qabstracteffect_p.h> +#include <private/qnode_p.h> #include <Qt3DRenderer/qt3drenderer_global.h> QT_BEGIN_NAMESPACE @@ -51,8 +51,9 @@ namespace Qt3D { class QEffect; class QParameter; +class QTechnique; -class QT3DRENDERERSHARED_EXPORT QEffectPrivate : public QAbstractEffectPrivate +class QT3DRENDERERSHARED_EXPORT QEffectPrivate : public QNodePrivate { public : QEffectPrivate(QEffect *qq); @@ -61,6 +62,7 @@ public : Q_DECLARE_PUBLIC(QEffect) QList<QParameter *> m_parameters; + QList<QTechnique *> m_techniques; }; } // Qt3D diff --git a/src/render/frontend/qmaterial.cpp b/src/render/frontend/qmaterial.cpp index c44bd77b8..828078866 100644 --- a/src/render/frontend/qmaterial.cpp +++ b/src/render/frontend/qmaterial.cpp @@ -41,28 +41,51 @@ #include "qmaterial.h" #include "qmaterial_p.h" -#include <qtexture.h> -#include <Qt3DCore/qabstracteffect.h> +#include "qtexture.h" +#include "qeffect.h" #include "renderlogging.h" #include "qparameter.h" #include <Qt3DCore/qscenepropertychange.h> +/*! + * \class QMaterial + * \namespace Qt3D + * + * \inherits Component + * + * \brief Provides an abstract class that should be the base of all + * Material component classes in a scene. + * + * QAbstractMaterial provide a way to specify the rendering of an Entity. + * Any aspect can define its own subclass of QAbstractMaterial so that a + * Material can be used to describe a visual element, the way sound should + * reflect on an element, the temperature of a surface and so on. + * + * \sa QEffect, QMesh, QComponent + */ + QT_BEGIN_NAMESPACE namespace Qt3D { QMaterialPrivate::QMaterialPrivate(QMaterial *qq) - : QAbstractMaterialPrivate(qq) + : QComponentPrivate(qq) + , m_effect(Q_NULLPTR) { } void QMaterialPrivate::copy(const QNodePrivate *ref) { - QAbstractMaterialPrivate::copy(ref); + QComponentPrivate::copy(ref); +} + +QMaterial::QMaterial(QNode *parent) + : QComponent(*new QMaterialPrivate(this), parent) +{ } QMaterial::QMaterial(QMaterialPrivate &dd, QNode *parent) - : QAbstractMaterial(dd, parent) + : QComponent(dd, parent) { } @@ -77,22 +100,52 @@ QMaterial *QMaterial::doClone() const mat->addParameter(qobject_cast<QParameter *>(QNodePrivate::get(p)->clone())); if (d->m_effect != Q_NULLPTR) - mat->setEffect(qobject_cast<QAbstractEffect *>(QNodePrivate::get(d->m_effect)->clone())); + mat->setEffect(qobject_cast<QEffect *>(QNodePrivate::get(d->m_effect)->clone())); return mat; } -QMaterial::QMaterial(QNode *parent) - : QAbstractMaterial(*new QMaterialPrivate(this), parent) +/*! + * Sets the \a effect to be used with the Material. + */ +void QMaterial::setEffect(QEffect *effect) { -} + Q_D(QMaterial); + if (effect != d->m_effect) { + + if (d->m_effect != Q_NULLPTR && d->m_changeArbiter != Q_NULLPTR) { + QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, this)); + change->setPropertyName(QByteArrayLiteral("effect")); + change->setValue(QVariant::fromValue(d->m_effect)); + d->notifyObservers(change); + } + + d->m_effect = effect; + emit effectChanged(); + // We need to add it as a child of the current node if it has been declared inline + // Or not previously added as a child of the current node so that + // 1) The backend gets notified about it's creation + // 2) When the current node is destroyed, it gets destroyed as well + if (!effect->parent()) + effect->setParent(this); + + if (d->m_changeArbiter != Q_NULLPTR) { + QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, this)); + change->setPropertyName(QByteArrayLiteral("effect")); + change->setValue(QVariant::fromValue(effect)); + d->notifyObservers(change); + } + } +} -void QMaterial::setEffect(QAbstractEffect *effect) +/*! + * Returns the effect used by the Material. + */ +QEffect *QMaterial::effect() const { - if (effect == QAbstractMaterial::effect()) - return ; - QAbstractMaterial::setEffect(effect); + Q_D(const QMaterial); + return d->m_effect; } void QMaterial::addParameter(QParameter *parameter) diff --git a/src/render/frontend/qmaterial.h b/src/render/frontend/qmaterial.h index 08bc47fc8..c1560f7a4 100644 --- a/src/render/frontend/qmaterial.h +++ b/src/render/frontend/qmaterial.h @@ -45,9 +45,6 @@ #include <QVariant> #include <Qt3DCore/qcomponent.h> -#include <Qt3DCore/qabstracteffect.h> -#include <Qt3DCore/qabstractmaterial.h> - #include <Qt3DRenderer/qt3drenderer_global.h> QT_BEGIN_NAMESPACE @@ -57,16 +54,19 @@ namespace Qt3D { class QTexture; class QParameter; class QMaterialPrivate; +class QEffect; typedef QMap<QString, QTexture*> TextureDict; -class QT3DRENDERERSHARED_EXPORT QMaterial : public QAbstractMaterial +class QT3DRENDERERSHARED_EXPORT QMaterial : public QComponent { Q_OBJECT + Q_PROPERTY(Qt3D::QEffect* effect READ effect WRITE setEffect NOTIFY effectChanged) public: explicit QMaterial(QNode *parent = 0); - void setEffect(QAbstractEffect *effect) Q_DECL_OVERRIDE; + void setEffect(QEffect *effect); + QEffect *effect() const; void addParameter(QParameter *parameter); void removeParameter(QParameter *parameter); @@ -76,6 +76,9 @@ public: void setTextureParameter(QString name, QTexture* tex); +Q_SIGNALS: + void effectChanged(); + protected: QMaterial(QMaterialPrivate &dd, QNode *parent = 0); diff --git a/src/render/frontend/qmaterial_p.h b/src/render/frontend/qmaterial_p.h index a7e68bef9..c643ee4ed 100644 --- a/src/render/frontend/qmaterial_p.h +++ b/src/render/frontend/qmaterial_p.h @@ -42,14 +42,17 @@ #ifndef QT3D_QMATERIAL_P_H #define QT3D_QMATERIAL_P_H -#include <private/qabstractmaterial_p.h> +#include <private/qcomponent_p.h> #include <Qt3DRenderer/qt3drenderer_global.h> QT_BEGIN_NAMESPACE namespace Qt3D { -class QT3DRENDERERSHARED_EXPORT QMaterialPrivate : public QAbstractMaterialPrivate +class QParameter; +class QEffect; + +class QT3DRENDERERSHARED_EXPORT QMaterialPrivate : public QComponentPrivate { public: QMaterialPrivate(QMaterial *qq); @@ -59,6 +62,7 @@ public: Q_DECLARE_PUBLIC(QMaterial) QList<QParameter *> m_parameters; TextureDict m_textures; + QEffect *m_effect; }; } // Qt3D diff --git a/src/render/frontend/qrenderpass.cpp b/src/render/frontend/qrenderpass.cpp index 99a7b53c3..ad5142533 100644 --- a/src/render/frontend/qrenderpass.cpp +++ b/src/render/frontend/qrenderpass.cpp @@ -56,17 +56,18 @@ QT_BEGIN_NAMESPACE namespace Qt3D { QRenderPassPrivate::QRenderPassPrivate(QRenderPass *qq) - : QAbstractRenderPassPrivate(qq) + : QNodePrivate(qq) + , m_shader(Q_NULLPTR) { } QRenderPass::QRenderPass(QNode *parent) - : QAbstractRenderPass(*new QRenderPassPrivate(this), parent) + : QNode(*new QRenderPassPrivate(this), parent) { } QRenderPass::QRenderPass(QRenderPassPrivate &dd, QNode *parent) - : QAbstractRenderPass(dd, parent) + : QNode(dd, parent) { } @@ -100,6 +101,48 @@ ParameterList QRenderPass::uniforms() const return d->m_uniforms; } +/*! + * Sets the pass's \a shaderProgram. This posts a ComponentUpdated + * QScenePropertyChange to the QChangeArbiter. The value is set to + * the \a ShaderProgram and the property name to "shaderProgram". + */ +void QRenderPass::setShaderProgram(QShaderProgram *shaderProgram) +{ + Q_D(QRenderPass); + if (d->m_shader != shaderProgram) { + + if (d->m_shader != Q_NULLPTR && d->m_changeArbiter != Q_NULLPTR) { + QScenePropertyChangePtr e(new QScenePropertyChange(NodeRemoved, this)); + e->setPropertyName(QByteArrayLiteral("shaderProgram")); + e->setValue(QVariant::fromValue(d->m_shader->uuid())); + d->notifyObservers(e); + } + + d->m_shader = shaderProgram; + emit shaderProgramChanged(); + + // We need to add it as a child of the current node if it has been declared inline + // Or not previously added as a child of the current node so that + // 1) The backend gets notified about it's creation + // 2) When the current node is destroyed, it gets destroyed as well + if (!shaderProgram->parent()) + shaderProgram->setParent(this); + + if (d->m_changeArbiter != Q_NULLPTR) { + QScenePropertyChangePtr e(new QScenePropertyChange(NodeAdded, this)); + e->setPropertyName(QByteArrayLiteral("shaderProgram")); + e->setValue(QVariant::fromValue(shaderProgram->uuid())); + d->notifyObservers(e); + } + } +} + +QShaderProgram *QRenderPass::shaderProgram() const +{ + Q_D(const QRenderPass); + return d->m_shader; +} + void QRenderPass::addCriterion(QCriterion *criterion) { Q_D(QRenderPass); diff --git a/src/render/frontend/qrenderpass.h b/src/render/frontend/qrenderpass.h index 5077ab469..3ceb5ac71 100644 --- a/src/render/frontend/qrenderpass.h +++ b/src/render/frontend/qrenderpass.h @@ -43,7 +43,6 @@ #ifndef QT3D_QRENDERPASS_H #define QT3D_QRENDERPASS_H -#include <Qt3DCore/qabstractrenderpass.h> #include <Qt3DRenderer/qt3drenderer_global.h> #include <Qt3DRenderer/qshaderprogram.h> @@ -64,9 +63,10 @@ typedef QList<QParameter*> ParameterList; class QRenderPassPrivate; -class QT3DRENDERERSHARED_EXPORT QRenderPass : public QAbstractRenderPass +class QT3DRENDERERSHARED_EXPORT QRenderPass : public QNode { Q_OBJECT + Q_PROPERTY(Qt3D::QShaderProgram * shaderProgram READ shaderProgram WRITE setShaderProgram NOTIFY shaderProgramChanged) public: explicit QRenderPass(QNode *parent = 0); @@ -80,6 +80,9 @@ public: ParameterList attributes() const; ParameterList uniforms() const; + void setShaderProgram(QShaderProgram *shaderProgram); + QShaderProgram *shaderProgram() const; + void addCriterion(QCriterion *criterion); void removeCriterion(QCriterion *criterion); QList<QCriterion *> criteria() const; @@ -93,6 +96,9 @@ public: void removeRenderState(QRenderState *state); QList<QRenderState *> renderStates() const; +Q_SIGNALS: + void shaderProgramChanged(); + protected: QRenderPass(QRenderPassPrivate &dd, QNode *parent = 0); @@ -105,4 +111,6 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(Qt3D::QRenderPass *) + #endif // QT3D_QRENDERPASS_H diff --git a/src/render/frontend/qrenderpass_p.h b/src/render/frontend/qrenderpass_p.h index 58951661d..ec0e420d0 100644 --- a/src/render/frontend/qrenderpass_p.h +++ b/src/render/frontend/qrenderpass_p.h @@ -43,7 +43,7 @@ #ifndef QT3D_QRENDERPASS_P_H #define QT3D_QRENDERPASS_P_H -#include <private/qabstractrenderpass_p.h> +#include <private/qnode_p.h> #include <Qt3DRenderer/qrenderpass.h> #include <Qt3DRenderer/qt3drenderer_global.h> @@ -62,7 +62,7 @@ namespace Render class RenderStateSet; } -class QT3DRENDERERSHARED_EXPORT QRenderPassPrivate : public QAbstractRenderPassPrivate +class QT3DRENDERERSHARED_EXPORT QRenderPassPrivate : public QNodePrivate { public: QRenderPassPrivate(QRenderPass *qq); @@ -76,6 +76,7 @@ public: QList<QCriterion *> m_criteriaList; QList<QParameterMapper *> m_bindings; QList<QRenderState *> m_renderStates; + QShaderProgram *m_shader; }; } // Qt3D diff --git a/src/render/frontend/qshaderprogram.cpp b/src/render/frontend/qshaderprogram.cpp index 048c31e4f..cc080b1ca 100644 --- a/src/render/frontend/qshaderprogram.cpp +++ b/src/render/frontend/qshaderprogram.cpp @@ -50,13 +50,13 @@ QT_BEGIN_NAMESPACE namespace Qt3D { QShaderProgramPrivate::QShaderProgramPrivate(QShaderProgram *qq) - : QAbstractShaderPrivate(qq) + : QNodePrivate(qq) { } void QShaderProgramPrivate::copy(const QNodePrivate *ref) { - QAbstractShaderPrivate::copy(ref); + QNodePrivate::copy(ref); const QShaderProgramPrivate *prog = static_cast<const QShaderProgramPrivate *>(ref); m_vertexSourceFile = prog->m_vertexSourceFile; m_tessControlSourceFile = prog->m_tessControlSourceFile; @@ -74,12 +74,12 @@ void QShaderProgramPrivate::copy(const QNodePrivate *ref) } QShaderProgram::QShaderProgram(QNode *parent) - : QAbstractShader(*new QShaderProgramPrivate(this), parent) + : QNode(*new QShaderProgramPrivate(this), parent) { } QShaderProgram::QShaderProgram(QShaderProgramPrivate &dd, QNode *parent) - : QAbstractShader(dd, parent) + : QNode(dd, parent) { } diff --git a/src/render/frontend/qshaderprogram.h b/src/render/frontend/qshaderprogram.h index 7c70f2fb1..6e3b0deeb 100644 --- a/src/render/frontend/qshaderprogram.h +++ b/src/render/frontend/qshaderprogram.h @@ -43,7 +43,7 @@ #define QT3D_QSHADERPROGRAM_H #include <QUuid> -#include <Qt3DCore/qabstractshader.h> +#include <Qt3DCore/qnode.h> #include <Qt3DRenderer/qt3drenderer_global.h> QT_BEGIN_NAMESPACE @@ -52,7 +52,7 @@ namespace Qt3D { class QShaderProgramPrivate; -class QT3DRENDERERSHARED_EXPORT QShaderProgram : public QAbstractShader +class QT3DRENDERERSHARED_EXPORT QShaderProgram : public QNode { Q_OBJECT @@ -153,4 +153,6 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(Qt3D::QShaderProgram *) + #endif // QT3D_QSHADERPROGRAM_H diff --git a/src/render/frontend/qshaderprogram_p.h b/src/render/frontend/qshaderprogram_p.h index cb79f5efb..083dc1530 100644 --- a/src/render/frontend/qshaderprogram_p.h +++ b/src/render/frontend/qshaderprogram_p.h @@ -42,7 +42,7 @@ #ifndef QT3D_QSHADERPROGRAM_P_H #define QT3D_QSHADERPROGRAM_P_H -#include <private/qabstractshader_p.h> +#include <private/qnode_p.h> QT_BEGIN_NAMESPACE @@ -50,7 +50,7 @@ namespace Qt3D { class QShaderProgram; -class QShaderProgramPrivate : public QAbstractShaderPrivate +class QShaderProgramPrivate : public QNodePrivate { public: QShaderProgramPrivate(QShaderProgram *qq); diff --git a/src/render/frontend/qtechnique.cpp b/src/render/frontend/qtechnique.cpp index 5bbfcd0ce..4625efe47 100644 --- a/src/render/frontend/qtechnique.cpp +++ b/src/render/frontend/qtechnique.cpp @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE namespace Qt3D { QTechniquePrivate::QTechniquePrivate(QTechnique *qq) - : QAbstractTechniquePrivate(qq) + : QNodePrivate(qq) , m_openGLFilter(new QOpenGLFilter()) { } @@ -62,7 +62,7 @@ QTechniquePrivate::~QTechniquePrivate() } QTechnique::QTechnique(QNode *parent) - : QAbstractTechnique(*new QTechniquePrivate(this), parent) + : QNode(*new QTechniquePrivate(this), parent) { Q_D(QTechnique); QObject::connect(d->m_openGLFilter, SIGNAL(openGLFilterChanged()), this, SLOT(openGLFilterChanged())); @@ -70,13 +70,13 @@ QTechnique::QTechnique(QNode *parent) void QTechniquePrivate::copy(const QNodePrivate *ref) { - QAbstractTechniquePrivate::copy(ref); + QNodePrivate::copy(ref); const QTechniquePrivate *tech = static_cast<const QTechniquePrivate *>(ref); m_openGLFilter->copy(tech->m_openGLFilter); } QTechnique::QTechnique(QTechniquePrivate &dd, QNode *parent) - : QAbstractTechnique(dd, parent) + : QNode(dd, parent) { Q_D(QTechnique); QObject::connect(d->m_openGLFilter, SIGNAL(openGLFilterChanged()), this, SLOT(openGLFilterChanged())); @@ -91,8 +91,8 @@ QTechnique *QTechnique::doClone() const Q_FOREACH (QCriterion *criterion, d->m_criteriaList) technique->addCriterion(qobject_cast<QCriterion *>(QNodePrivate::get(criterion)->clone())); - Q_FOREACH (QAbstractRenderPass *pass, d->m_renderPasses) - technique->addPass(qobject_cast<QAbstractRenderPass *>(QNodePrivate::get(pass)->clone())); + Q_FOREACH (QRenderPass *pass, d->m_renderPasses) + technique->addPass(qobject_cast<QRenderPass *>(QNodePrivate::get(pass)->clone())); Q_FOREACH (QParameter *p, d->m_parameters) technique->addParameter(qobject_cast<QParameter *>(QNodePrivate::get(p)->clone())); @@ -194,6 +194,59 @@ void QTechnique::removeParameter(QParameter *parameter) d->m_parameters.removeOne(parameter); } +/*! + * Appends a \a pass to the technique. This posts a ComponentAdded + * QScenePropertyChange notification to the QChangeArbiter with the + * value being the \a pass and the property name being "pass". + */ +void QTechnique::addPass(QRenderPass *pass) +{ + Q_D(QTechnique); + if (!d->m_renderPasses.contains(pass)) { + d->m_renderPasses.append(pass); + + // We need to add it as a child of the current node if it has been declared inline + // Or not previously added as a child of the current node so that + // 1) The backend gets notified about it's creation + // 2) When the current node is destroyed, it gets destroyed as well + if (!pass->parent()) + pass->setParent(this); + + if (d->m_changeArbiter != Q_NULLPTR) { + QScenePropertyChangePtr e(new QScenePropertyChange(NodeAdded, this)); + e->setPropertyName(QByteArrayLiteral("pass")); + e->setValue(QVariant::fromValue(pass)); + d->notifyObservers(e); + } + } +} + +/*! + * Removes a \a pass from the technique. This posts a ComponentRemoved + * QScenePropertyChange notification to the QChangeArbiter with the value + * being the \a pass' uuid and the property name being "pass". + */ +void QTechnique::removePass(QRenderPass *pass) +{ + Q_D(QTechnique); + if (d->m_changeArbiter) { + QScenePropertyChangePtr e(new QScenePropertyChange(NodeRemoved, this)); + e->setPropertyName(QByteArrayLiteral("pass")); + e->setValue(QVariant::fromValue(pass->uuid())); + d->notifyObservers(e); + } + d->m_renderPasses.removeOne(pass); +} + +/*! + * Returns the list of render passes contained in the technique. + */ +QList<QRenderPass *> QTechnique::renderPasses() const +{ + Q_D(const QTechnique); + return d->m_renderPasses; +} + QList<QParameter *> QTechnique::parameters() const { Q_D(const QTechnique); diff --git a/src/render/frontend/qtechnique.h b/src/render/frontend/qtechnique.h index 5ec4d5ba0..90a65528f 100644 --- a/src/render/frontend/qtechnique.h +++ b/src/render/frontend/qtechnique.h @@ -45,7 +45,6 @@ #include <Qt3DRenderer/qt3drenderer_global.h> #include <Qt3DCore/qnode.h> #include <Qt3DRenderer/qrenderpass.h> -#include <Qt3DCore/qabstracttechnique.h> #include <Qt3DRenderer/qcriterion.h> #include <QList> #include <QSharedPointer> @@ -58,7 +57,7 @@ class QParameter; class QTechniquePrivate; class QOpenGLFilter; -class QT3DRENDERERSHARED_EXPORT QTechnique : public QAbstractTechnique +class QT3DRENDERERSHARED_EXPORT QTechnique : public QNode { Q_OBJECT Q_PROPERTY(Qt3D::QOpenGLFilter *openGLFilter READ openGLFilter) @@ -76,6 +75,10 @@ public: void removeParameter(QParameter *p); QList<QParameter *> parameters() const; + virtual void addPass(QRenderPass *pass); + virtual void removePass(QRenderPass *pass); + QList<QRenderPass *> renderPasses() const; + QParameter* parameterByName(QString name) const; QOpenGLFilter *openGLFilter() const; @@ -94,4 +97,6 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(Qt3D::QTechnique *) + #endif // QT3D_QTECHNIQUE_H diff --git a/src/render/frontend/qtechnique_p.h b/src/render/frontend/qtechnique_p.h index 265a46bcc..a5e5a5106 100644 --- a/src/render/frontend/qtechnique_p.h +++ b/src/render/frontend/qtechnique_p.h @@ -42,7 +42,7 @@ #ifndef QT3D_QTECHNIQUE_P_H #define QT3D_QTECHNIQUE_P_H -#include <private/qabstracttechnique_p.h> +#include <private/qnode_p.h> #include <Qt3DRenderer/qt3drenderer_global.h> QT_BEGIN_NAMESPACE @@ -52,9 +52,10 @@ namespace Qt3D { class QTechnique; class QCriterion; class QParameter; +class QRenderPass; class QOpenGLFilter; -class QT3DRENDERERSHARED_EXPORT QTechniquePrivate : public QAbstractTechniquePrivate +class QT3DRENDERERSHARED_EXPORT QTechniquePrivate : public QNodePrivate { public: QTechniquePrivate(QTechnique *dd); @@ -65,6 +66,7 @@ public: Q_DECLARE_PUBLIC(QTechnique) QList<QCriterion *> m_criteriaList; QList<QParameter *> m_parameters; + QList<QRenderPass*> m_renderPasses; QOpenGLFilter *m_openGLFilter; }; |