diff options
Diffstat (limited to 'src/render/frontend/framegraph-components')
27 files changed, 152 insertions, 155 deletions
diff --git a/src/render/frontend/framegraph-components/qcameraselector.cpp b/src/render/frontend/framegraph-components/qcameraselector.cpp index 3097e7fac..36429956f 100644 --- a/src/render/frontend/framegraph-components/qcameraselector.cpp +++ b/src/render/frontend/framegraph-components/qcameraselector.cpp @@ -42,6 +42,7 @@ #include "qcameraselector.h" #include "qcameraselector_p.h" #include <Qt3DCore/qentity.h> +#include <Qt3DCore/private/qentity_p.h> #include <Qt3DCore/qscenepropertychange.h> QT_BEGIN_NAMESPACE @@ -53,19 +54,18 @@ QCameraSelector::QCameraSelector(QCameraSelectorPrivate &dd, QNode *parent) { } -QCameraSelector *QCameraSelector::doClone(bool isClone) const +QCameraSelector *QCameraSelector::doClone() const { Q_D(const QCameraSelector); QCameraSelector *cameraSelector = new QCameraSelector(); - cameraSelector->copy(this); - cameraSelector->d_func()->m_isClone = isClone; + cameraSelector->d_func()->copy(d_func()); Q_FOREACH (QFrameGraphItem *fgChild, d->m_fgChildren) - cameraSelector->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(fgChild->clone(isClone))); + cameraSelector->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone())); if (d->m_camera != Q_NULLPTR) - cameraSelector->setCamera(qobject_cast<QEntity *>(d->m_camera->clone(isClone))); + cameraSelector->setCamera(qobject_cast<QEntity *>(QNodePrivate::get(d->m_camera)->clone())); return cameraSelector; } @@ -90,13 +90,13 @@ void QCameraSelector::setCamera(QEntity *camera) // 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 (!camera->parent() || camera->parent() == this) - QNode::addChild(camera); + if (!camera->parent()) + camera->setParent(this); if (d->m_changeArbiter != Q_NULLPTR) { QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeUpdated, this)); propertyChange->setPropertyName(QByteArrayLiteral("camera")); propertyChange->setValue(QVariant::fromValue(d->m_camera->uuid())); - notifyObservers(propertyChange); + d->notifyObservers(propertyChange); } } } diff --git a/src/render/frontend/framegraph-components/qcameraselector.h b/src/render/frontend/framegraph-components/qcameraselector.h index 1b26816a9..cc20c0831 100644 --- a/src/render/frontend/framegraph-components/qcameraselector.h +++ b/src/render/frontend/framegraph-components/qcameraselector.h @@ -69,7 +69,7 @@ Q_SIGNALS: protected: Q_DECLARE_PRIVATE(QCameraSelector) QCameraSelector(QCameraSelectorPrivate &dd, QNode *parent = 0); - QCameraSelector *doClone(bool isClone = true) const Q_DECL_OVERRIDE; + QCameraSelector *doClone() const Q_DECL_OVERRIDE; }; } // namespace Qt3D diff --git a/src/render/frontend/framegraph-components/qclearbuffer.cpp b/src/render/frontend/framegraph-components/qclearbuffer.cpp index 6e9ad4383..77370d53c 100644 --- a/src/render/frontend/framegraph-components/qclearbuffer.cpp +++ b/src/render/frontend/framegraph-components/qclearbuffer.cpp @@ -53,6 +53,13 @@ QClearBufferPrivate::QClearBufferPrivate(QClearBuffer *qq) { } +void QClearBufferPrivate::copy(const QNodePrivate *ref) +{ + QFrameGraphItemPrivate::copy(ref); + const QClearBufferPrivate *b = static_cast<const QClearBufferPrivate *>(ref); + m_buffersType = b->m_buffersType; +} + QClearBuffer::QClearBuffer(QNode *parent) : QFrameGraphItem(*new QClearBufferPrivate(this), parent) { @@ -63,14 +70,6 @@ QClearBuffer::QClearBuffer(QClearBufferPrivate &dd, QNode *parent) { } -void QClearBuffer::copy(const QNode *ref) -{ - Q_D(QClearBuffer); - QFrameGraphItem::copy(ref); - const QClearBuffer *b = qobject_cast<const QClearBuffer *>(ref); - if (b != Q_NULLPTR) - d->m_buffersType = b->buffers(); -} QClearBuffer::BufferType QClearBuffer::buffers() const { @@ -79,11 +78,15 @@ QClearBuffer::BufferType QClearBuffer::buffers() const } -QClearBuffer *QClearBuffer::doClone(bool isClone) const +QClearBuffer *QClearBuffer::doClone() const { + Q_D(const QClearBuffer); QClearBuffer *clone = new QClearBuffer(); - clone->copy(this); - clone->d_func()->m_isClone = isClone; + clone->d_func()->copy(d_func()); + + Q_FOREACH (QFrameGraphItem *fgChild, d->m_fgChildren) + clone->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone())); + return clone; } @@ -98,7 +101,7 @@ void QClearBuffer::setBuffers(QClearBuffer::BufferType buffers) QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeUpdated, this)); propertyChange->setPropertyName(QByteArrayLiteral("buffers")); propertyChange->setValue(buffers); - notifyObservers(propertyChange); + d->notifyObservers(propertyChange); } } } diff --git a/src/render/frontend/framegraph-components/qclearbuffer.h b/src/render/frontend/framegraph-components/qclearbuffer.h index 492880917..8fdf9c926 100644 --- a/src/render/frontend/framegraph-components/qclearbuffer.h +++ b/src/render/frontend/framegraph-components/qclearbuffer.h @@ -69,8 +69,6 @@ public: AllBuffers = 0xFFFFFFFF }; - void copy(const QNode *ref) Q_DECL_OVERRIDE; - void setBuffers(BufferType buffers); BufferType buffers() const; @@ -78,9 +76,11 @@ Q_SIGNALS: void buffersChanged(); protected: - Q_DECLARE_PRIVATE(QClearBuffer) QClearBuffer(QClearBufferPrivate &dd, QNode *parent = 0); - QClearBuffer *doClone(bool isClone = true) const Q_DECL_OVERRIDE; + +private: + Q_DECLARE_PRIVATE(QClearBuffer) + QClearBuffer *doClone() const Q_DECL_OVERRIDE; }; } // Qt3D diff --git a/src/render/frontend/framegraph-components/qclearbuffer_p.h b/src/render/frontend/framegraph-components/qclearbuffer_p.h index 90d4e8be4..eb6a064c1 100644 --- a/src/render/frontend/framegraph-components/qclearbuffer_p.h +++ b/src/render/frontend/framegraph-components/qclearbuffer_p.h @@ -53,6 +53,9 @@ class QClearBufferPrivate : public QFrameGraphItemPrivate { public: QClearBufferPrivate(QClearBuffer *qq); + + void copy(const QNodePrivate *ref) Q_DECL_OVERRIDE; + Q_DECLARE_PUBLIC(QClearBuffer) QClearBuffer::BufferType m_buffersType; }; diff --git a/src/render/frontend/framegraph-components/qframegraph.cpp b/src/render/frontend/framegraph-components/qframegraph.cpp index 090577906..0e6f9ac9b 100644 --- a/src/render/frontend/framegraph-components/qframegraph.cpp +++ b/src/render/frontend/framegraph-components/qframegraph.cpp @@ -43,6 +43,7 @@ #include "qframegraph_p.h" #include <Qt3DCore/qentity.h> #include <Qt3DRenderer/qframegraphitem.h> +#include <Qt3DRenderer/private/qframegraphitem_p.h> QT_BEGIN_NAMESPACE @@ -79,14 +80,13 @@ QFrameGraph::QFrameGraph(QFrameGraphPrivate &dd, QNode *parent) { } -QFrameGraph *QFrameGraph::doClone(bool isClone) const +QFrameGraph *QFrameGraph::doClone() const { Q_D(const QFrameGraph); QFrameGraph *frameGraph = new QFrameGraph(); - frameGraph->copy(this); - frameGraph->d_func()->m_isClone = isClone; + frameGraph->d_func()->copy(d_func()); - frameGraph->setActiveFrameGraph(qobject_cast<QFrameGraphItem *>(d->m_activeFrameGraph->clone(isClone))); + frameGraph->setActiveFrameGraph(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(d->m_activeFrameGraph)->clone())); return frameGraph; } @@ -110,8 +110,8 @@ void QFrameGraph::setActiveFrameGraph(QFrameGraphItem *activeFrameGraph) d->m_activeFrameGraph = activeFrameGraph; emit activeFrameGraphChanged(); - if (!activeFrameGraph->parent() || activeFrameGraph->parent() == this) - QNode::addChild(activeFrameGraph); + if (!activeFrameGraph->parent()) + activeFrameGraph->setParent(this); if (d->m_changeArbiter != Q_NULLPTR) { // TO DO : Add QChangeArbiterNotification diff --git a/src/render/frontend/framegraph-components/qframegraph.h b/src/render/frontend/framegraph-components/qframegraph.h index 6a4706c47..df7c3938e 100644 --- a/src/render/frontend/framegraph-components/qframegraph.h +++ b/src/render/frontend/framegraph-components/qframegraph.h @@ -70,9 +70,11 @@ Q_SIGNALS: void activeFrameGraphChanged(); protected: - Q_DECLARE_PRIVATE(QFrameGraph) QFrameGraph(QFrameGraphPrivate &dd, QNode *parent = 0); - QFrameGraph *doClone(bool isClone = true) const Q_DECL_OVERRIDE; + +private: + Q_DECLARE_PRIVATE(QFrameGraph) + QFrameGraph *doClone() const Q_DECL_OVERRIDE; }; } //Qt3D diff --git a/src/render/frontend/framegraph-components/qframegraphitem.cpp b/src/render/frontend/framegraph-components/qframegraphitem.cpp index be5fb7d1c..684772c4b 100644 --- a/src/render/frontend/framegraph-components/qframegraphitem.cpp +++ b/src/render/frontend/framegraph-components/qframegraphitem.cpp @@ -64,6 +64,11 @@ QFrameGraphItemPrivate::QFrameGraphItemPrivate(QFrameGraphItem *qq) { } +void QFrameGraphItemPrivate::copy(const QNodePrivate *ref) +{ + QNodePrivate::copy(ref); +} + QFrameGraphItem::QFrameGraphItem(QNode *parent) : QNode(*new QFrameGraphItemPrivate(this), parent) { @@ -74,26 +79,12 @@ QFrameGraphItem::QFrameGraphItem(QFrameGraphItemPrivate &dd, QNode *parent) { } -void QFrameGraphItem::setEnabled(bool enabled) -{ - Q_D(QFrameGraphItem); - if (d->m_enabled != enabled) { - d->m_enabled = enabled; - emit enabledChanged(); - } -} - -bool QFrameGraphItem::isEnabled() const -{ - Q_D(const QFrameGraphItem); - return d->m_enabled; -} - void QFrameGraphItem::appendFrameGraphItem(QFrameGraphItem *item) { Q_D(QFrameGraphItem); if (!d->m_fgChildren.contains(item)) { - QNode::addChild(item); + if (!item->parent()) + item->setParent(this); d->m_fgChildren.append(item); } } @@ -103,7 +94,6 @@ void QFrameGraphItem::removeFrameGraphItem(QFrameGraphItem *item) Q_D(QFrameGraphItem); if (!d->m_fgChildren.contains(item)) { d->m_fgChildren.removeOne(item); - QNode::removeChild(item); } } diff --git a/src/render/frontend/framegraph-components/qframegraphitem.h b/src/render/frontend/framegraph-components/qframegraphitem.h index ba8b5a604..857914649 100644 --- a/src/render/frontend/framegraph-components/qframegraphitem.h +++ b/src/render/frontend/framegraph-components/qframegraphitem.h @@ -58,19 +58,15 @@ class QT3DRENDERERSHARED_EXPORT QFrameGraphItem : public QNode public: explicit QFrameGraphItem(QNode *parent = 0); - void setEnabled(bool enabled); - bool isEnabled() const; - void appendFrameGraphItem(QFrameGraphItem *item); void removeFrameGraphItem(QFrameGraphItem *item); QList<QFrameGraphItem *> frameGraphChildren() const; -Q_SIGNALS: - void enabledChanged(); - protected: - Q_DECLARE_PRIVATE(QFrameGraphItem) QFrameGraphItem(QFrameGraphItemPrivate &dd, QNode *parent = 0); + +private: + Q_DECLARE_PRIVATE(QFrameGraphItem) }; } // Qt3D diff --git a/src/render/frontend/framegraph-components/qframegraphitem_p.h b/src/render/frontend/framegraph-components/qframegraphitem_p.h index c889eba7d..3dbae8a16 100644 --- a/src/render/frontend/framegraph-components/qframegraphitem_p.h +++ b/src/render/frontend/framegraph-components/qframegraphitem_p.h @@ -57,6 +57,8 @@ class QFrameGraphItemPrivate : public QNodePrivate public: QFrameGraphItemPrivate(QFrameGraphItem *qq); + virtual void copy(const QNodePrivate *ref) Q_DECL_OVERRIDE; + Q_DECLARE_PUBLIC(QFrameGraphItem) bool m_enabled; QList<QFrameGraphItem *> m_fgChildren; diff --git a/src/render/frontend/framegraph-components/qlayerfilter.cpp b/src/render/frontend/framegraph-components/qlayerfilter.cpp index 2117980a2..e9a7f9621 100644 --- a/src/render/frontend/framegraph-components/qlayerfilter.cpp +++ b/src/render/frontend/framegraph-components/qlayerfilter.cpp @@ -52,37 +52,32 @@ QLayerFilterPrivate::QLayerFilterPrivate(QLayerFilter *qq) { } -QLayerFilter::QLayerFilter(QNode *parent) - : QFrameGraphItem(*new QLayerFilterPrivate(this), parent) +void QLayerFilterPrivate::copy(const QNodePrivate *ref) { + QFrameGraphItemPrivate::copy(ref); + const QLayerFilterPrivate *layer = static_cast<const QLayerFilterPrivate *>(ref); + m_layers = layer->m_layers; } -void QLayerFilter::copy(const QNode *ref) +QLayerFilter::QLayerFilter(QNode *parent) + : QFrameGraphItem(*new QLayerFilterPrivate(this), parent) { - Q_D(QLayerFilter); - QFrameGraphItem::copy(ref); - const QLayerFilter *layer = qobject_cast<const QLayerFilter *>(ref); - if (layer != Q_NULLPTR) { - d->m_layers = layer->layers(); - } } - QLayerFilter::QLayerFilter(QLayerFilterPrivate &dd, QNode *parent) : QFrameGraphItem(dd, parent) { } -QLayerFilter *QLayerFilter::doClone(bool isClone) const +QLayerFilter *QLayerFilter::doClone() const { Q_D(const QLayerFilter); QLayerFilter *filter = new QLayerFilter(); - filter->copy(this); - filter->d_func()->m_isClone = isClone; + filter->d_func()->copy(d_func()); Q_FOREACH (QFrameGraphItem *fgChild, d->m_fgChildren) - filter->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(fgChild->clone(isClone))); + filter->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone())); return filter; } @@ -98,7 +93,7 @@ void QLayerFilter::setLayers(const QStringList &layers) QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeUpdated, this)); propertyChange->setPropertyName(QByteArrayLiteral("layers")); propertyChange->setValue(QVariant::fromValue(d->m_layers)); - notifyObservers(propertyChange); + d->notifyObservers(propertyChange); } } } diff --git a/src/render/frontend/framegraph-components/qlayerfilter.h b/src/render/frontend/framegraph-components/qlayerfilter.h index ed6b74e61..983fc305a 100644 --- a/src/render/frontend/framegraph-components/qlayerfilter.h +++ b/src/render/frontend/framegraph-components/qlayerfilter.h @@ -43,6 +43,7 @@ #define QT3D_QLAYERFILTER_H #include <Qt3DRenderer/qframegraphitem.h> +#include <QStringList> QT_BEGIN_NAMESPACE @@ -57,8 +58,6 @@ class QT3DRENDERERSHARED_EXPORT QLayerFilter : public QFrameGraphItem public: explicit QLayerFilter(QNode *parent = 0); - void copy(const QNode *ref) Q_DECL_OVERRIDE; - void setLayers(const QStringList &layers); QStringList layers() const; @@ -66,9 +65,11 @@ Q_SIGNALS: void layersChanged(); protected: - Q_DECLARE_PRIVATE(QLayerFilter) QLayerFilter(QLayerFilterPrivate &dd, QNode *parent = 0); - QLayerFilter *doClone(bool isClone = true) const Q_DECL_OVERRIDE; + +private: + Q_DECLARE_PRIVATE(QLayerFilter) + QLayerFilter *doClone() const Q_DECL_OVERRIDE; }; } // Qt3D diff --git a/src/render/frontend/framegraph-components/qlayerfilter_p.h b/src/render/frontend/framegraph-components/qlayerfilter_p.h index 32405fff6..56f3a988e 100644 --- a/src/render/frontend/framegraph-components/qlayerfilter_p.h +++ b/src/render/frontend/framegraph-components/qlayerfilter_p.h @@ -56,6 +56,8 @@ class QT3DRENDERERSHARED_EXPORT QLayerFilterPrivate : public QFrameGraphItemPriv public: explicit QLayerFilterPrivate(QLayerFilter *qq); + void copy(const QNodePrivate *ref) Q_DECL_OVERRIDE; + Q_DECLARE_PUBLIC(QLayerFilter) QStringList m_layers; }; diff --git a/src/render/frontend/framegraph-components/qrenderpassfilter.cpp b/src/render/frontend/framegraph-components/qrenderpassfilter.cpp index 14f260e05..37df2cf69 100644 --- a/src/render/frontend/framegraph-components/qrenderpassfilter.cpp +++ b/src/render/frontend/framegraph-components/qrenderpassfilter.cpp @@ -43,6 +43,7 @@ #include "qrenderpassfilter_p.h" #include "qcriterion.h" +#include "qcriterion_p.h" #include <Qt3DCore/qscenepropertychange.h> QT_BEGIN_NAMESPACE @@ -58,18 +59,17 @@ QRenderPassFilter::QRenderPassFilter(QRenderPassFilterPrivate &dd, QNode *parent { } -QRenderPassFilter *QRenderPassFilter::doClone(bool isClone) const +QRenderPassFilter *QRenderPassFilter::doClone() const { Q_D(const QRenderPassFilter); QRenderPassFilter *clone = new QRenderPassFilter(); - clone->copy(this); - clone->d_func()->m_isClone = isClone; + clone->d_func()->copy(d_func()); Q_FOREACH (QFrameGraphItem *fgChild, d->m_fgChildren) - clone->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(fgChild->clone(isClone))); + clone->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone())); Q_FOREACH (QCriterion *c, d->m_criteriaList) - clone->addCriterion(qobject_cast<QCriterion *>(c->clone(isClone))); + clone->addCriterion(qobject_cast<QCriterion *>(QNodePrivate::get(c)->clone())); return clone; } @@ -90,14 +90,14 @@ void QRenderPassFilter::addCriterion(QCriterion *criterion) // 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 (!criterion->parent() || criterion->parent() == this) - QNode::addChild(criterion); + if (!criterion->parent()) + criterion->setParent(this); if (d->m_changeArbiter != Q_NULLPTR) { QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeAdded, this)); propertyChange->setPropertyName(QByteArrayLiteral("renderPassCriterion")); propertyChange->setValue(QVariant::fromValue(criterion)); - notifyObservers(propertyChange); + d->notifyObservers(propertyChange); } } } @@ -109,7 +109,7 @@ void QRenderPassFilter::removeCriterion(QCriterion *criterion) QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeRemoved, this)); propertyChange->setPropertyName(QByteArrayLiteral("renderPassCriterion")); propertyChange->setValue(QVariant::fromValue(criterion)); - notifyObservers(propertyChange); + d->notifyObservers(propertyChange); } d->m_criteriaList.removeOne(criterion); } diff --git a/src/render/frontend/framegraph-components/qrenderpassfilter.h b/src/render/frontend/framegraph-components/qrenderpassfilter.h index cca5d71cf..e7e663368 100644 --- a/src/render/frontend/framegraph-components/qrenderpassfilter.h +++ b/src/render/frontend/framegraph-components/qrenderpassfilter.h @@ -66,9 +66,11 @@ public: void removeCriterion(QCriterion *criterion); protected: - Q_DECLARE_PRIVATE(QRenderPassFilter) QRenderPassFilter(QRenderPassFilterPrivate &dd, QNode *parent = 0); - QRenderPassFilter *doClone(bool isClone = true) const Q_DECL_OVERRIDE; + +private: + Q_DECLARE_PRIVATE(QRenderPassFilter) + QRenderPassFilter *doClone() const Q_DECL_OVERRIDE; }; } // namespace Qt3D diff --git a/src/render/frontend/framegraph-components/qrendertargetselector.cpp b/src/render/frontend/framegraph-components/qrendertargetselector.cpp index c3f5a21aa..89cf7d126 100644 --- a/src/render/frontend/framegraph-components/qrendertargetselector.cpp +++ b/src/render/frontend/framegraph-components/qrendertargetselector.cpp @@ -43,6 +43,7 @@ #include "qrendertargetselector_p.h" #include <Qt3DRenderer/qrendertarget.h> #include <Qt3DCore/qscenepropertychange.h> +#include <Qt3DRenderer/private/qrenderpass_p.h> QT_BEGIN_NAMESPACE @@ -67,14 +68,14 @@ void QRenderTargetSelector::setTarget(QRenderTarget *target) emit targetChanged(); // For inline declaration cases - if (!target->parent() || target->parent() == this) - QNode::addChild(target); + if (!target->parent()) + target->setParent(this); if (d->m_changeArbiter != Q_NULLPTR) { QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeUpdated, this)); propertyChange->setPropertyName(QByteArrayLiteral("target")); propertyChange->setValue(QVariant::fromValue(target->uuid())); - notifyObservers(propertyChange); + d->notifyObservers(propertyChange); } } } @@ -90,19 +91,18 @@ QRenderTargetSelector::QRenderTargetSelector(QRenderTargetSelectorPrivate &dd, Q { } -QRenderTargetSelector *QRenderTargetSelector::doClone(bool isClone) const +QRenderTargetSelector *QRenderTargetSelector::doClone() const { Q_D(const QRenderTargetSelector); QRenderTargetSelector *clone = new QRenderTargetSelector(); - clone->copy(this); - clone->d_func()->m_isClone = isClone; + clone->d_func()->copy(d_func()); Q_FOREACH (QFrameGraphItem *fgChild, d->m_fgChildren) - clone->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(fgChild->clone(isClone))); + clone->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone())); if (d->m_target != Q_NULLPTR) - clone->setTarget(qobject_cast<QRenderTarget *>(d->m_target->clone(clone))); + clone->setTarget(qobject_cast<QRenderTarget *>(QNodePrivate::get(d->m_target)->clone())); return clone; } diff --git a/src/render/frontend/framegraph-components/qrendertargetselector.h b/src/render/frontend/framegraph-components/qrendertargetselector.h index 308e09807..5205e19e6 100644 --- a/src/render/frontend/framegraph-components/qrendertargetselector.h +++ b/src/render/frontend/framegraph-components/qrendertargetselector.h @@ -67,9 +67,11 @@ Q_SIGNALS: void targetChanged(); protected: - Q_DECLARE_PRIVATE(QRenderTargetSelector) QRenderTargetSelector(QRenderTargetSelectorPrivate &dd, QNode *parent = 0); - QRenderTargetSelector *doClone(bool isClone = true) const Q_DECL_OVERRIDE; + +private: + Q_DECLARE_PRIVATE(QRenderTargetSelector) + QRenderTargetSelector *doClone() const Q_DECL_OVERRIDE; }; } // Qt3D diff --git a/src/render/frontend/framegraph-components/qsortcriterion.cpp b/src/render/frontend/framegraph-components/qsortcriterion.cpp index f219e5d97..5584839c4 100644 --- a/src/render/frontend/framegraph-components/qsortcriterion.cpp +++ b/src/render/frontend/framegraph-components/qsortcriterion.cpp @@ -53,18 +53,16 @@ QSortCriterionPrivate::QSortCriterionPrivate(QSortCriterion *qq) { } -QSortCriterion::QSortCriterion(QNode *parent) - : QNode(*new QSortCriterionPrivate(this), parent) +void QSortCriterionPrivate::copy(const QNodePrivate *ref) { + QNodePrivate::copy(ref); + const QSortCriterionPrivate *s = static_cast<const QSortCriterionPrivate *>(ref); + m_sort = s->m_sort; } -void QSortCriterion::copy(const QNode *ref) +QSortCriterion::QSortCriterion(QNode *parent) + : QNode(*new QSortCriterionPrivate(this), parent) { - Q_D(QSortCriterion); - QNode::copy(ref); - const QSortCriterion *s = qobject_cast<const QSortCriterion *>(ref); - if (s != Q_NULLPTR) - d->m_sort = s->sort(); } QSortCriterion::SortType QSortCriterion::sort() const @@ -82,7 +80,7 @@ void QSortCriterion::setSort(QSortCriterion::SortType &sort) QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeUpdated, this)); propertyChange->setPropertyName(QByteArrayLiteral("sort")); propertyChange->setValue(d->m_sort); - notifyObservers(propertyChange); + d->notifyObservers(propertyChange); } d->m_sort = sort; @@ -92,7 +90,7 @@ void QSortCriterion::setSort(QSortCriterion::SortType &sort) QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeUpdated, this)); propertyChange->setPropertyName(QByteArrayLiteral("sort")); propertyChange->setValue(d->m_sort); - notifyObservers(propertyChange); + d->notifyObservers(propertyChange); } } } @@ -102,11 +100,10 @@ QSortCriterion::QSortCriterion(QSortCriterionPrivate &dd, QNode *parent) { } -QSortCriterion *QSortCriterion::doClone(bool isClone) const +QSortCriterion *QSortCriterion::doClone() const { QSortCriterion *clone = new QSortCriterion(); - clone->copy(this); - clone->d_func()->m_isClone = isClone; + clone->d_func()->copy(d_func()); return clone; } diff --git a/src/render/frontend/framegraph-components/qsortcriterion.h b/src/render/frontend/framegraph-components/qsortcriterion.h index 39cac29b7..130980c89 100644 --- a/src/render/frontend/framegraph-components/qsortcriterion.h +++ b/src/render/frontend/framegraph-components/qsortcriterion.h @@ -65,8 +65,6 @@ public: Material = (1 << 2) }; - void copy(const QNode *ref) Q_DECL_OVERRIDE; - SortType sort() const; void setSort(SortType &sort); @@ -74,10 +72,11 @@ Q_SIGNALS: void sortChanged(); protected: - Q_DECLARE_PRIVATE(QSortCriterion) QSortCriterion(QSortCriterionPrivate &dd, QNode *parent = 0); - QSortCriterion *doClone(bool isClone = true) const Q_DECL_OVERRIDE; +private: + QSortCriterion *doClone() const Q_DECL_OVERRIDE; + Q_DECLARE_PRIVATE(QSortCriterion) }; } // Qt3D diff --git a/src/render/frontend/framegraph-components/qsortcriterion_p.h b/src/render/frontend/framegraph-components/qsortcriterion_p.h index bde637488..1ba2e9271 100644 --- a/src/render/frontend/framegraph-components/qsortcriterion_p.h +++ b/src/render/frontend/framegraph-components/qsortcriterion_p.h @@ -54,6 +54,8 @@ class QSortCriterionPrivate : public QNodePrivate public: QSortCriterionPrivate(QSortCriterion *qq); + void copy(const QNodePrivate *ref) Q_DECL_OVERRIDE; + Q_DECLARE_PUBLIC(QSortCriterion) QSortCriterion::SortType m_sort; }; diff --git a/src/render/frontend/framegraph-components/qsortmethod.cpp b/src/render/frontend/framegraph-components/qsortmethod.cpp index 39671af84..f71b09f68 100644 --- a/src/render/frontend/framegraph-components/qsortmethod.cpp +++ b/src/render/frontend/framegraph-components/qsortmethod.cpp @@ -41,6 +41,7 @@ #include "qsortmethod.h" #include "qsortmethod_p.h" +#include "qsortcriterion_p.h" #include <Qt3DCore/qscenepropertychange.h> #include <Qt3DRenderer/qsortcriterion.h> @@ -63,16 +64,15 @@ QSortMethod::QSortMethod(QSortMethodPrivate &dd, QNode *parent) { } -QSortMethod *QSortMethod::doClone(bool isClone) const +QSortMethod *QSortMethod::doClone() const { Q_D(const QSortMethod); QSortMethod *clone = new QSortMethod(); - clone->copy(this); - clone->d_func()->m_isClone = isClone; + clone->d_func()->copy(d_func()); Q_FOREACH (QSortCriterion *c, d->m_criteria) - clone->addCriterion(qobject_cast<QSortCriterion *>(c->clone(isClone))); + clone->addCriterion(qobject_cast<QSortCriterion *>(QNodePrivate::get(c)->clone())); return clone; } @@ -83,14 +83,14 @@ void QSortMethod::addCriterion(QSortCriterion *criterion) if (!d->m_criteria.contains(criterion)) { d->m_criteria.append(criterion); - if (!criterion->parent() || criterion->parent() == this) - QNode::addChild(criterion); + if (!criterion->parent()) + criterion->setParent(this); if (d->m_changeArbiter != Q_NULLPTR) { QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeAdded, this)); propertyChange->setPropertyName(QByteArrayLiteral("sortCriterion")); propertyChange->setValue(QVariant::fromValue(criterion)); - notifyObservers(propertyChange); + d->notifyObservers(propertyChange); } } } @@ -102,7 +102,7 @@ void QSortMethod::removeCriterion(QSortCriterion *criterion) QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeRemoved, this)); propertyChange->setPropertyName(QByteArrayLiteral("sortCriterion")); propertyChange->setValue(QVariant::fromValue(criterion)); - notifyObservers(propertyChange); + d->notifyObservers(propertyChange); } d->m_criteria.removeOne(criterion); } diff --git a/src/render/frontend/framegraph-components/qsortmethod.h b/src/render/frontend/framegraph-components/qsortmethod.h index 5830aae9b..b971e5572 100644 --- a/src/render/frontend/framegraph-components/qsortmethod.h +++ b/src/render/frontend/framegraph-components/qsortmethod.h @@ -63,9 +63,11 @@ public: QList<QSortCriterion *> criteria() const; protected: - Q_DECLARE_PRIVATE(QSortMethod) QSortMethod(QSortMethodPrivate &dd, QNode *parent = 0); - QSortMethod *doClone(bool isClone = true) const Q_DECL_OVERRIDE; + +private: + Q_DECLARE_PRIVATE(QSortMethod) + QSortMethod *doClone() const Q_DECL_OVERRIDE; }; } // Qt3D diff --git a/src/render/frontend/framegraph-components/qtechniquefilter.cpp b/src/render/frontend/framegraph-components/qtechniquefilter.cpp index 48ee5daa9..b65d8a879 100644 --- a/src/render/frontend/framegraph-components/qtechniquefilter.cpp +++ b/src/render/frontend/framegraph-components/qtechniquefilter.cpp @@ -42,7 +42,7 @@ #include "qtechniquefilter.h" #include "qtechniquefilter_p.h" - +#include "qcriterion_p.h" #include <Qt3DRenderer/qcriterion.h> #include <Qt3DCore/qscenepropertychange.h> @@ -65,18 +65,17 @@ QTechniqueFilter::QTechniqueFilter(QTechniqueFilterPrivate &dd, QNode *parent) { } -QTechniqueFilter *QTechniqueFilter::doClone(bool isClone) const +QTechniqueFilter *QTechniqueFilter::doClone() const { Q_D(const QTechniqueFilter); QTechniqueFilter *clone = new QTechniqueFilter(); - clone->copy(this); - clone->d_func()->m_isClone = isClone; + clone->d_func()->copy(d_func()); Q_FOREACH (QFrameGraphItem *fgChild, d->m_fgChildren) - clone->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(fgChild->clone(isClone))); + clone->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone())); Q_FOREACH (QCriterion *crit, d->m_criteriaList) - clone->addCriterion(qobject_cast<QCriterion *>(crit->clone(isClone))); + clone->addCriterion(qobject_cast<QCriterion *>(QNodePrivate::get(crit)->clone())); return clone; } @@ -96,14 +95,14 @@ void QTechniqueFilter::addCriterion(QCriterion *criterion) // 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 (!criterion->parent() || criterion->parent() == this) - QNode::addChild(criterion); + if (!criterion->parent()) + criterion->setParent(this); if (d->m_changeArbiter != Q_NULLPTR) { QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeAdded, this)); propertyChange->setPropertyName(QByteArrayLiteral("techniqueCriterion")); propertyChange->setValue(QVariant::fromValue(criterion)); - notifyObservers(propertyChange); + d->notifyObservers(propertyChange); } } @@ -114,7 +113,7 @@ void QTechniqueFilter::removeCriterion(QCriterion *criterion) QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeRemoved, this)); propertyChange->setPropertyName(QByteArrayLiteral("techniqueCriterion")); propertyChange->setValue(QVariant::fromValue(criterion->uuid())); - notifyObservers(propertyChange); + d->notifyObservers(propertyChange); } d->m_criteriaList.removeOne(criterion); } diff --git a/src/render/frontend/framegraph-components/qtechniquefilter.h b/src/render/frontend/framegraph-components/qtechniquefilter.h index 9d7319709..37e7e96ed 100644 --- a/src/render/frontend/framegraph-components/qtechniquefilter.h +++ b/src/render/frontend/framegraph-components/qtechniquefilter.h @@ -63,9 +63,11 @@ public: void removeCriterion(QCriterion *criterion); protected: - Q_DECLARE_PRIVATE(QTechniqueFilter) QTechniqueFilter(QTechniqueFilterPrivate &dd, QNode *parent = 0); - QTechniqueFilter *doClone(bool isClone = true) const Q_DECL_OVERRIDE; + +private: + Q_DECLARE_PRIVATE(QTechniqueFilter) + QTechniqueFilter *doClone() const Q_DECL_OVERRIDE; }; } // namespace Qt3D diff --git a/src/render/frontend/framegraph-components/qviewport.cpp b/src/render/frontend/framegraph-components/qviewport.cpp index a2d9bd972..79f8403c3 100644 --- a/src/render/frontend/framegraph-components/qviewport.cpp +++ b/src/render/frontend/framegraph-components/qviewport.cpp @@ -53,19 +53,16 @@ QViewportPrivate::QViewportPrivate(QViewport *qq) : { } -QViewport::QViewport(QNode *parent) - : QFrameGraphItem(*new QViewportPrivate(this), parent) +void QViewportPrivate::copy(const QNodePrivate *ref) { + QFrameGraphItemPrivate::copy(ref); + const QViewportPrivate *viewport = static_cast<const QViewportPrivate *>(ref); + m_rect = viewport->m_rect; } -void QViewport::copy(const QNode *ref) +QViewport::QViewport(QNode *parent) + : QFrameGraphItem(*new QViewportPrivate(this), parent) { - Q_D(QViewport); - QFrameGraphItem::copy(ref); - const QViewport *viewport = qobject_cast<const QViewport *>(ref); - if (viewport != Q_NULLPTR) { - d->m_rect = viewport->rect(); - } } QViewport::QViewport(QViewportPrivate &dd, QNode *parent) @@ -73,16 +70,15 @@ QViewport::QViewport(QViewportPrivate &dd, QNode *parent) { } -QViewport *QViewport::doClone(bool isClone) const +QViewport *QViewport::doClone() const { Q_D(const QViewport); QViewport *clone = new QViewport(); - clone->copy(this); - clone->d_func()->m_isClone = isClone; + clone->d_func()->copy(d_func()); Q_FOREACH (QFrameGraphItem *fgChild, d->m_fgChildren) - clone->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(fgChild->clone(isClone))); + clone->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone())); return clone; } @@ -103,7 +99,7 @@ void QViewport::setRect(const QRectF &rect) QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeUpdated, this)); propertyChange->setPropertyName(QByteArrayLiteral("rect")); propertyChange->setValue(QVariant::fromValue(d->m_rect)); - notifyObservers(propertyChange); + d->notifyObservers(propertyChange); } } } @@ -124,7 +120,7 @@ void QViewport::setClearColor(const QColor &color) QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeUpdated, this)); propertyChange->setPropertyName(QByteArrayLiteral("clearColor")); propertyChange->setValue(QVariant::fromValue(d->m_clearColor)); - notifyObservers(propertyChange); + d->notifyObservers(propertyChange); } } } diff --git a/src/render/frontend/framegraph-components/qviewport.h b/src/render/frontend/framegraph-components/qviewport.h index c1041f3ca..4b8499eea 100644 --- a/src/render/frontend/framegraph-components/qviewport.h +++ b/src/render/frontend/framegraph-components/qviewport.h @@ -61,8 +61,6 @@ class QT3DRENDERERSHARED_EXPORT QViewport : public QFrameGraphItem public: explicit QViewport(QNode *parent = 0); - void copy(const QNode *ref) Q_DECL_OVERRIDE; - QRectF rect() const; void setRect(const QRectF& rect); @@ -74,9 +72,11 @@ Q_SIGNALS: void clearColorChanged(); protected: - Q_DECLARE_PRIVATE(QViewport) QViewport(QViewportPrivate &dd, QNode *parent = 0); - QViewport *doClone(bool isClone = true) const Q_DECL_OVERRIDE; + +private: + Q_DECLARE_PRIVATE(QViewport) + QViewport *doClone() const Q_DECL_OVERRIDE; }; } // Qt3D diff --git a/src/render/frontend/framegraph-components/qviewport_p.h b/src/render/frontend/framegraph-components/qviewport_p.h index e178c4f20..6281acaf3 100644 --- a/src/render/frontend/framegraph-components/qviewport_p.h +++ b/src/render/frontend/framegraph-components/qviewport_p.h @@ -55,6 +55,8 @@ class QViewportPrivate : public QFrameGraphItemPrivate public : QViewportPrivate(QViewport *qq); + void copy(const QNodePrivate *ref) Q_DECL_OVERRIDE; + Q_DECLARE_PUBLIC(QViewport) QRectF m_rect; QColor m_clearColor; |