summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2014-10-15 11:20:02 +0200
committerSean Harmer <sean.harmer@kdab.com>2014-10-15 19:37:49 +0200
commit0f1d0ff5b3adb16afcda091e4ff4657f53581f79 (patch)
treebc82ff1bd2f31fe5fa54590ab3f1500d716b07eb /src/render
parenta4b9ce44ae244104a941981405742ee42d53ebe0 (diff)
Hide doClone implementations behind a macro
This way we will avoid inconsistencies. It also means making some of the copy() implementations more clever. Change-Id: Ic79c9ec7c9c32f8951d5d9f5184592880bf8d5fd Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render')
-rw-r--r--src/render/frontend/framegraph-components/qcameraselector.cpp27
-rw-r--r--src/render/frontend/framegraph-components/qcameraselector.h2
-rw-r--r--src/render/frontend/framegraph-components/qcameraselector_p.h1
-rw-r--r--src/render/frontend/framegraph-components/qclearbuffer.cpp16
-rw-r--r--src/render/frontend/framegraph-components/qclearbuffer.h2
-rw-r--r--src/render/frontend/framegraph-components/qframegraph.cpp18
-rw-r--r--src/render/frontend/framegraph-components/qframegraph.h2
-rw-r--r--src/render/frontend/framegraph-components/qframegraph_p.h1
-rw-r--r--src/render/frontend/framegraph-components/qlayerfilter.cpp15
-rw-r--r--src/render/frontend/framegraph-components/qlayerfilter.h2
-rw-r--r--src/render/frontend/framegraph-components/qrenderpassfilter.cpp25
-rw-r--r--src/render/frontend/framegraph-components/qrenderpassfilter.h2
-rw-r--r--src/render/frontend/framegraph-components/qrenderpassfilter_p.h1
-rw-r--r--src/render/frontend/framegraph-components/qrendertargetselector.cpp28
-rw-r--r--src/render/frontend/framegraph-components/qrendertargetselector.h2
-rw-r--r--src/render/frontend/framegraph-components/qrendertargetselector_p.h1
-rw-r--r--src/render/frontend/framegraph-components/qsortcriterion.cpp7
-rw-r--r--src/render/frontend/framegraph-components/qsortcriterion.h2
-rw-r--r--src/render/frontend/framegraph-components/qsortmethod.cpp21
-rw-r--r--src/render/frontend/framegraph-components/qsortmethod.h2
-rw-r--r--src/render/frontend/framegraph-components/qsortmethod_p.h1
-rw-r--r--src/render/frontend/framegraph-components/qtechniquefilter.cpp25
-rw-r--r--src/render/frontend/framegraph-components/qtechniquefilter.h2
-rw-r--r--src/render/frontend/framegraph-components/qtechniquefilter_p.h1
-rw-r--r--src/render/frontend/framegraph-components/qviewport.cpp15
-rw-r--r--src/render/frontend/framegraph-components/qviewport.h2
-rw-r--r--src/render/frontend/qalphacoverage.cpp7
-rw-r--r--src/render/frontend/qalphacoverage.h2
-rw-r--r--src/render/frontend/qalphatest.cpp7
-rw-r--r--src/render/frontend/qalphatest.h2
-rw-r--r--src/render/frontend/qblendequation.cpp7
-rw-r--r--src/render/frontend/qblendequation.h2
-rw-r--r--src/render/frontend/qblendstate.cpp7
-rw-r--r--src/render/frontend/qblendstate.h2
-rw-r--r--src/render/frontend/qcriterion.cpp8
-rw-r--r--src/render/frontend/qcriterion.h2
-rw-r--r--src/render/frontend/qcuboidmesh.cpp7
-rw-r--r--src/render/frontend/qcuboidmesh.h2
-rw-r--r--src/render/frontend/qcullface.cpp7
-rw-r--r--src/render/frontend/qcullface.h2
-rw-r--r--src/render/frontend/qcylindermesh.cpp7
-rw-r--r--src/render/frontend/qcylindermesh.h2
-rw-r--r--src/render/frontend/qdepthmask.cpp7
-rw-r--r--src/render/frontend/qdepthmask.h2
-rw-r--r--src/render/frontend/qdepthtest.cpp7
-rw-r--r--src/render/frontend/qdepthtest.h2
-rw-r--r--src/render/frontend/qdirectionallight.cpp7
-rw-r--r--src/render/frontend/qdirectionallight.h2
-rw-r--r--src/render/frontend/qdithering.cpp7
-rw-r--r--src/render/frontend/qdithering.h2
-rw-r--r--src/render/frontend/qeffect.cpp22
-rw-r--r--src/render/frontend/qeffect.h2
-rw-r--r--src/render/frontend/qfrontface.cpp7
-rw-r--r--src/render/frontend/qfrontface.h2
-rw-r--r--src/render/frontend/qlayer.cpp7
-rw-r--r--src/render/frontend/qlayer.h2
-rw-r--r--src/render/frontend/qmaterial.cpp22
-rw-r--r--src/render/frontend/qmaterial.h2
-rw-r--r--src/render/frontend/qmesh.cpp7
-rw-r--r--src/render/frontend/qmesh.h2
-rw-r--r--src/render/frontend/qparameter.cpp7
-rw-r--r--src/render/frontend/qparameter.h2
-rw-r--r--src/render/frontend/qparametermapper.cpp7
-rw-r--r--src/render/frontend/qparametermapper.h2
-rw-r--r--src/render/frontend/qplanemesh.cpp7
-rw-r--r--src/render/frontend/qplanemesh.h2
-rw-r--r--src/render/frontend/qpointlight.cpp7
-rw-r--r--src/render/frontend/qpointlight.h2
-rw-r--r--src/render/frontend/qrenderattachment.cpp10
-rw-r--r--src/render/frontend/qrenderattachment.h2
-rw-r--r--src/render/frontend/qrenderpass.cpp32
-rw-r--r--src/render/frontend/qrenderpass.h2
-rw-r--r--src/render/frontend/qrenderpass_p.h1
-rw-r--r--src/render/frontend/qrendertarget.cpp16
-rw-r--r--src/render/frontend/qrendertarget.h2
-rw-r--r--src/render/frontend/qsceneloader.cpp7
-rw-r--r--src/render/frontend/qsceneloader.h2
-rw-r--r--src/render/frontend/qscissortest.cpp7
-rw-r--r--src/render/frontend/qscissortest.h2
-rw-r--r--src/render/frontend/qshaderprogram.cpp7
-rw-r--r--src/render/frontend/qshaderprogram.h2
-rw-r--r--src/render/frontend/qspheremesh.cpp7
-rw-r--r--src/render/frontend/qspheremesh.h2
-rw-r--r--src/render/frontend/qspotlight.cpp7
-rw-r--r--src/render/frontend/qspotlight.h2
-rw-r--r--src/render/frontend/qstenciltest.cpp7
-rw-r--r--src/render/frontend/qstenciltest.h2
-rw-r--r--src/render/frontend/qtechnique.cpp24
-rw-r--r--src/render/frontend/qtechnique.h2
-rw-r--r--src/render/frontend/qtexture.cpp9
-rw-r--r--src/render/frontend/qtexture.h2
-rw-r--r--src/render/frontend/qtorusmesh.cpp7
-rw-r--r--src/render/frontend/qtorusmesh.h2
-rw-r--r--src/render/io/gltfparser.cpp9
94 files changed, 154 insertions, 463 deletions
diff --git a/src/render/frontend/framegraph-components/qcameraselector.cpp b/src/render/frontend/framegraph-components/qcameraselector.cpp
index 959158774..4c84bb700 100644
--- a/src/render/frontend/framegraph-components/qcameraselector.cpp
+++ b/src/render/frontend/framegraph-components/qcameraselector.cpp
@@ -54,27 +54,22 @@ QCameraSelector::QCameraSelector(QCameraSelectorPrivate &dd, QNode *parent)
{
}
-QCameraSelector *QCameraSelector::doClone() const
-{
- Q_D(const QCameraSelector);
- QCameraSelector *cameraSelector = new QCameraSelector();
-
- cameraSelector->d_func()->copy(d_func());
-
- Q_FOREACH (QFrameGraphItem *fgChild, d->m_fgChildren)
- cameraSelector->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone()));
-
- if (d->m_camera != Q_NULLPTR)
- cameraSelector->setCamera(qobject_cast<QEntity *>(QNodePrivate::get(d->m_camera)->clone()));
-
- return cameraSelector;
-}
-
QCameraSelectorPrivate::QCameraSelectorPrivate(Qt3D::QCameraSelector *qq)
: QFrameGraphItemPrivate(qq)
, m_camera(Q_NULLPTR)
{}
+void QCameraSelectorPrivate::copy(const QNodePrivate *ref)
+{
+ QFrameGraphItemPrivate::copy(ref);
+ const QCameraSelectorPrivate *other = static_cast<const QCameraSelectorPrivate*>(ref);
+ Q_FOREACH (QFrameGraphItem *fgChild, other->m_fgChildren)
+ q_func()->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone()));
+
+ if (other->m_camera != Q_NULLPTR)
+ q_func()->setCamera(qobject_cast<QEntity *>(QNodePrivate::get(other->m_camera)->clone()));
+}
+
QCameraSelector::QCameraSelector(Qt3D::QNode *parent)
: QFrameGraphItem(*new QCameraSelectorPrivate(this), parent)
{}
diff --git a/src/render/frontend/framegraph-components/qcameraselector.h b/src/render/frontend/framegraph-components/qcameraselector.h
index cc20c0831..01723ed6c 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() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QCameraSelector)
};
} // namespace Qt3D
diff --git a/src/render/frontend/framegraph-components/qcameraselector_p.h b/src/render/frontend/framegraph-components/qcameraselector_p.h
index 077fb131d..47f9ea6f0 100644
--- a/src/render/frontend/framegraph-components/qcameraselector_p.h
+++ b/src/render/frontend/framegraph-components/qcameraselector_p.h
@@ -55,6 +55,7 @@ class QCameraSelectorPrivate : public QFrameGraphItemPrivate
{
public:
QCameraSelectorPrivate(QCameraSelector *qq);
+ void copy(const QNodePrivate *ref) Q_DECL_OVERRIDE;
Q_DECLARE_PUBLIC(QCameraSelector)
QEntity *m_camera;
diff --git a/src/render/frontend/framegraph-components/qclearbuffer.cpp b/src/render/frontend/framegraph-components/qclearbuffer.cpp
index b1bd12eea..bbf006e1f 100644
--- a/src/render/frontend/framegraph-components/qclearbuffer.cpp
+++ b/src/render/frontend/framegraph-components/qclearbuffer.cpp
@@ -58,6 +58,9 @@ void QClearBufferPrivate::copy(const QNodePrivate *ref)
QFrameGraphItemPrivate::copy(ref);
const QClearBufferPrivate *b = static_cast<const QClearBufferPrivate *>(ref);
m_buffersType = b->m_buffersType;
+
+ Q_FOREACH (QFrameGraphItem *fgChild, b->m_fgChildren)
+ q_func()->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone()));
}
QClearBuffer::QClearBuffer(QNode *parent)
@@ -77,19 +80,6 @@ QClearBuffer::BufferType QClearBuffer::buffers() const
return d->m_buffersType;
}
-
-QClearBuffer *QClearBuffer::doClone() const
-{
- Q_D(const QClearBuffer);
- QClearBuffer *clone = new QClearBuffer();
- clone->d_func()->copy(d_func());
-
- Q_FOREACH (QFrameGraphItem *fgChild, d->m_fgChildren)
- clone->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone()));
-
- return clone;
-}
-
void QClearBuffer::setBuffers(QClearBuffer::BufferType buffers)
{
Q_D(QClearBuffer);
diff --git a/src/render/frontend/framegraph-components/qclearbuffer.h b/src/render/frontend/framegraph-components/qclearbuffer.h
index 8fdf9c926..15d60d492 100644
--- a/src/render/frontend/framegraph-components/qclearbuffer.h
+++ b/src/render/frontend/framegraph-components/qclearbuffer.h
@@ -80,7 +80,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QClearBuffer)
- QClearBuffer *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QClearBuffer)
};
} // Qt3D
diff --git a/src/render/frontend/framegraph-components/qframegraph.cpp b/src/render/frontend/framegraph-components/qframegraph.cpp
index 0e6f9ac9b..4cf9d1944 100644
--- a/src/render/frontend/framegraph-components/qframegraph.cpp
+++ b/src/render/frontend/framegraph-components/qframegraph.cpp
@@ -56,6 +56,13 @@ QFrameGraphPrivate::QFrameGraphPrivate(QFrameGraph *qq)
}
+void QFrameGraphPrivate::copy(const QNodePrivate *ref)
+{
+ QComponentPrivate::copy(ref);
+ const QFrameGraphPrivate *other = static_cast<const QFrameGraphPrivate *>(ref);
+ q_func()->setActiveFrameGraph(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(other->m_activeFrameGraph)->clone()));
+}
+
/*!
* \class FrameGraph
*
@@ -80,17 +87,6 @@ QFrameGraph::QFrameGraph(QFrameGraphPrivate &dd, QNode *parent)
{
}
-QFrameGraph *QFrameGraph::doClone() const
-{
- Q_D(const QFrameGraph);
- QFrameGraph *frameGraph = new QFrameGraph();
- frameGraph->d_func()->copy(d_func());
-
- frameGraph->setActiveFrameGraph(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(d->m_activeFrameGraph)->clone()));
-
- return frameGraph;
-}
-
/*!
* Returns the current activeFrameGraph root node.
*/
diff --git a/src/render/frontend/framegraph-components/qframegraph.h b/src/render/frontend/framegraph-components/qframegraph.h
index df7c3938e..798cd0ca1 100644
--- a/src/render/frontend/framegraph-components/qframegraph.h
+++ b/src/render/frontend/framegraph-components/qframegraph.h
@@ -74,7 +74,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QFrameGraph)
- QFrameGraph *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QFrameGraph)
};
} //Qt3D
diff --git a/src/render/frontend/framegraph-components/qframegraph_p.h b/src/render/frontend/framegraph-components/qframegraph_p.h
index aacf641a5..f7ce12ad8 100644
--- a/src/render/frontend/framegraph-components/qframegraph_p.h
+++ b/src/render/frontend/framegraph-components/qframegraph_p.h
@@ -56,6 +56,7 @@ class QFrameGraphPrivate : public QComponentPrivate
{
public:
QFrameGraphPrivate(QFrameGraph *qq);
+ void copy(const QNodePrivate *ref) Q_DECL_OVERRIDE;
Q_DECLARE_PUBLIC(QFrameGraph)
diff --git a/src/render/frontend/framegraph-components/qlayerfilter.cpp b/src/render/frontend/framegraph-components/qlayerfilter.cpp
index a01f676d9..088c85121 100644
--- a/src/render/frontend/framegraph-components/qlayerfilter.cpp
+++ b/src/render/frontend/framegraph-components/qlayerfilter.cpp
@@ -57,6 +57,8 @@ void QLayerFilterPrivate::copy(const QNodePrivate *ref)
QFrameGraphItemPrivate::copy(ref);
const QLayerFilterPrivate *layer = static_cast<const QLayerFilterPrivate *>(ref);
m_layers = layer->m_layers;
+ Q_FOREACH (QFrameGraphItem *fgChild, layer->m_fgChildren)
+ q_func()->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone()));
}
QLayerFilter::QLayerFilter(QNode *parent)
@@ -69,19 +71,6 @@ QLayerFilter::QLayerFilter(QLayerFilterPrivate &dd, QNode *parent)
{
}
-QLayerFilter *QLayerFilter::doClone() const
-{
- Q_D(const QLayerFilter);
- QLayerFilter *filter = new QLayerFilter();
-
- filter->d_func()->copy(d_func());
-
- Q_FOREACH (QFrameGraphItem *fgChild, d->m_fgChildren)
- filter->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone()));
-
- return filter;
-}
-
void QLayerFilter::setLayers(const QStringList &layers)
{
Q_D(QLayerFilter);
diff --git a/src/render/frontend/framegraph-components/qlayerfilter.h b/src/render/frontend/framegraph-components/qlayerfilter.h
index 983fc305a..304e96121 100644
--- a/src/render/frontend/framegraph-components/qlayerfilter.h
+++ b/src/render/frontend/framegraph-components/qlayerfilter.h
@@ -69,7 +69,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QLayerFilter)
- QLayerFilter *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QLayerFilter)
};
} // Qt3D
diff --git a/src/render/frontend/framegraph-components/qrenderpassfilter.cpp b/src/render/frontend/framegraph-components/qrenderpassfilter.cpp
index 37df2cf69..530e09783 100644
--- a/src/render/frontend/framegraph-components/qrenderpassfilter.cpp
+++ b/src/render/frontend/framegraph-components/qrenderpassfilter.cpp
@@ -59,21 +59,6 @@ QRenderPassFilter::QRenderPassFilter(QRenderPassFilterPrivate &dd, QNode *parent
{
}
-QRenderPassFilter *QRenderPassFilter::doClone() const
-{
- Q_D(const QRenderPassFilter);
- QRenderPassFilter *clone = new QRenderPassFilter();
-
- clone->d_func()->copy(d_func());
-
- Q_FOREACH (QFrameGraphItem *fgChild, d->m_fgChildren)
- clone->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone()));
- Q_FOREACH (QCriterion *c, d->m_criteriaList)
- clone->addCriterion(qobject_cast<QCriterion *>(QNodePrivate::get(c)->clone()));
-
- return clone;
-}
-
QList<QCriterion *> QRenderPassFilter::criteria() const
{
Q_D(const QRenderPassFilter);
@@ -114,6 +99,16 @@ void QRenderPassFilter::removeCriterion(QCriterion *criterion)
d->m_criteriaList.removeOne(criterion);
}
+void QRenderPassFilterPrivate::copy(const QNodePrivate *ref)
+{
+ QFrameGraphItemPrivate::copy(ref);
+ const QRenderPassFilterPrivate *other = static_cast<const QRenderPassFilterPrivate*>(ref);
+ Q_FOREACH (QFrameGraphItem *fgChild, other->m_fgChildren)
+ q_func()->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone()));
+ Q_FOREACH (QCriterion *c, other->m_criteriaList)
+ q_func()->addCriterion(qobject_cast<QCriterion *>(QNodePrivate::get(c)->clone()));
+}
+
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/framegraph-components/qrenderpassfilter.h b/src/render/frontend/framegraph-components/qrenderpassfilter.h
index e7e663368..d2a4202ce 100644
--- a/src/render/frontend/framegraph-components/qrenderpassfilter.h
+++ b/src/render/frontend/framegraph-components/qrenderpassfilter.h
@@ -70,7 +70,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QRenderPassFilter)
- QRenderPassFilter *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QRenderPassFilter)
};
} // namespace Qt3D
diff --git a/src/render/frontend/framegraph-components/qrenderpassfilter_p.h b/src/render/frontend/framegraph-components/qrenderpassfilter_p.h
index 3da27e1e2..1b7207e34 100644
--- a/src/render/frontend/framegraph-components/qrenderpassfilter_p.h
+++ b/src/render/frontend/framegraph-components/qrenderpassfilter_p.h
@@ -56,6 +56,7 @@ public:
QRenderPassFilterPrivate(QRenderPassFilter *qq)
: QFrameGraphItemPrivate(qq)
{}
+ void copy(const QNodePrivate *ref) Q_DECL_OVERRIDE;
Q_DECLARE_PUBLIC(QRenderPassFilter)
QString m_renderPassName;
diff --git a/src/render/frontend/framegraph-components/qrendertargetselector.cpp b/src/render/frontend/framegraph-components/qrendertargetselector.cpp
index 81804903a..54f43ee90 100644
--- a/src/render/frontend/framegraph-components/qrendertargetselector.cpp
+++ b/src/render/frontend/framegraph-components/qrendertargetselector.cpp
@@ -55,6 +55,18 @@ QRenderTargetSelectorPrivate::QRenderTargetSelectorPrivate(QRenderTargetSelector
{
}
+void QRenderTargetSelectorPrivate::copy(const QNodePrivate *ref)
+{
+ QFrameGraphItemPrivate::copy(ref);
+
+ const QRenderTargetSelectorPrivate *other = static_cast<const QRenderTargetSelectorPrivate*>(ref);
+ Q_FOREACH (QFrameGraphItem *fgChild, other->m_fgChildren)
+ q_func()->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone()));
+
+ if (other->m_target != Q_NULLPTR)
+ q_func()->setTarget(qobject_cast<QRenderTarget *>(QNodePrivate::get(other->m_target)->clone()));
+}
+
QRenderTargetSelector::QRenderTargetSelector(QNode *parent)
: QFrameGraphItem(*new QRenderTargetSelectorPrivate(this), parent)
{
@@ -84,22 +96,6 @@ QRenderTargetSelector::QRenderTargetSelector(QRenderTargetSelectorPrivate &dd, Q
{
}
-QRenderTargetSelector *QRenderTargetSelector::doClone() const
-{
- Q_D(const QRenderTargetSelector);
- QRenderTargetSelector *clone = new QRenderTargetSelector();
-
- clone->d_func()->copy(d_func());
-
- Q_FOREACH (QFrameGraphItem *fgChild, d->m_fgChildren)
- clone->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone()));
-
- if (d->m_target != Q_NULLPTR)
- clone->setTarget(qobject_cast<QRenderTarget *>(QNodePrivate::get(d->m_target)->clone()));
-
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/framegraph-components/qrendertargetselector.h b/src/render/frontend/framegraph-components/qrendertargetselector.h
index 5205e19e6..504a0711f 100644
--- a/src/render/frontend/framegraph-components/qrendertargetselector.h
+++ b/src/render/frontend/framegraph-components/qrendertargetselector.h
@@ -71,7 +71,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QRenderTargetSelector)
- QRenderTargetSelector *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QRenderTargetSelector)
};
} // Qt3D
diff --git a/src/render/frontend/framegraph-components/qrendertargetselector_p.h b/src/render/frontend/framegraph-components/qrendertargetselector_p.h
index 285004952..0d4e2acb7 100644
--- a/src/render/frontend/framegraph-components/qrendertargetselector_p.h
+++ b/src/render/frontend/framegraph-components/qrendertargetselector_p.h
@@ -55,6 +55,7 @@ class QRenderTargetSelectorPrivate : public QFrameGraphItemPrivate
{
public:
QRenderTargetSelectorPrivate(QRenderTargetSelector *qq);
+ void copy(const QNodePrivate *ref) Q_DECL_OVERRIDE;
Q_DECLARE_PUBLIC(QRenderTargetSelector)
QRenderTarget *m_target;
diff --git a/src/render/frontend/framegraph-components/qsortcriterion.cpp b/src/render/frontend/framegraph-components/qsortcriterion.cpp
index f91cc655f..a2e7de7de 100644
--- a/src/render/frontend/framegraph-components/qsortcriterion.cpp
+++ b/src/render/frontend/framegraph-components/qsortcriterion.cpp
@@ -86,13 +86,6 @@ QSortCriterion::QSortCriterion(QSortCriterionPrivate &dd, QNode *parent)
{
}
-QSortCriterion *QSortCriterion::doClone() const
-{
- QSortCriterion *clone = new QSortCriterion();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/framegraph-components/qsortcriterion.h b/src/render/frontend/framegraph-components/qsortcriterion.h
index 130980c89..2bd5914bc 100644
--- a/src/render/frontend/framegraph-components/qsortcriterion.h
+++ b/src/render/frontend/framegraph-components/qsortcriterion.h
@@ -75,7 +75,7 @@ protected:
QSortCriterion(QSortCriterionPrivate &dd, QNode *parent = 0);
private:
- QSortCriterion *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QSortCriterion)
Q_DECLARE_PRIVATE(QSortCriterion)
};
diff --git a/src/render/frontend/framegraph-components/qsortmethod.cpp b/src/render/frontend/framegraph-components/qsortmethod.cpp
index f71b09f68..741e0aced 100644
--- a/src/render/frontend/framegraph-components/qsortmethod.cpp
+++ b/src/render/frontend/framegraph-components/qsortmethod.cpp
@@ -54,6 +54,14 @@ QSortMethodPrivate::QSortMethodPrivate(QSortMethod *qq)
{
}
+void QSortMethodPrivate::copy(const QNodePrivate *ref)
+{
+ QFrameGraphItemPrivate::copy(ref);
+ const QSortMethodPrivate *other = static_cast<const QSortMethodPrivate*>(ref);
+ Q_FOREACH (QSortCriterion *c, other->m_criteria)
+ q_func()->addCriterion(qobject_cast<QSortCriterion *>(QNodePrivate::get(c)->clone()));
+}
+
QSortMethod::QSortMethod(QNode *parent)
: QFrameGraphItem(*new QSortMethodPrivate(this), parent)
{
@@ -64,19 +72,6 @@ QSortMethod::QSortMethod(QSortMethodPrivate &dd, QNode *parent)
{
}
-QSortMethod *QSortMethod::doClone() const
-{
- Q_D(const QSortMethod);
- QSortMethod *clone = new QSortMethod();
-
- clone->d_func()->copy(d_func());
-
- Q_FOREACH (QSortCriterion *c, d->m_criteria)
- clone->addCriterion(qobject_cast<QSortCriterion *>(QNodePrivate::get(c)->clone()));
-
- return clone;
-}
-
void QSortMethod::addCriterion(QSortCriterion *criterion)
{
Q_D(QSortMethod);
diff --git a/src/render/frontend/framegraph-components/qsortmethod.h b/src/render/frontend/framegraph-components/qsortmethod.h
index b971e5572..fd53f4b7a 100644
--- a/src/render/frontend/framegraph-components/qsortmethod.h
+++ b/src/render/frontend/framegraph-components/qsortmethod.h
@@ -67,7 +67,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QSortMethod)
- QSortMethod *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QSortMethod)
};
} // Qt3D
diff --git a/src/render/frontend/framegraph-components/qsortmethod_p.h b/src/render/frontend/framegraph-components/qsortmethod_p.h
index 6ef90b90f..551cb897d 100644
--- a/src/render/frontend/framegraph-components/qsortmethod_p.h
+++ b/src/render/frontend/framegraph-components/qsortmethod_p.h
@@ -55,6 +55,7 @@ class QSortMethodPrivate : public QFrameGraphItemPrivate
{
public:
QSortMethodPrivate(QSortMethod *qq);
+ void copy(const QNodePrivate *ref) Q_DECL_OVERRIDE;
Q_DECLARE_PUBLIC(QSortMethod)
QList<QSortCriterion *> m_criteria;
};
diff --git a/src/render/frontend/framegraph-components/qtechniquefilter.cpp b/src/render/frontend/framegraph-components/qtechniquefilter.cpp
index b65d8a879..71404b94c 100644
--- a/src/render/frontend/framegraph-components/qtechniquefilter.cpp
+++ b/src/render/frontend/framegraph-components/qtechniquefilter.cpp
@@ -55,6 +55,16 @@ QTechniqueFilterPrivate::QTechniqueFilterPrivate(QTechniqueFilter *qq)
{
}
+void QTechniqueFilterPrivate::copy(const QNodePrivate *ref)
+{
+ QFrameGraphItemPrivate::copy(ref);
+ const QTechniqueFilterPrivate *other = static_cast<const QTechniqueFilterPrivate*>(ref);
+ Q_FOREACH (QFrameGraphItem *fgChild, other->m_fgChildren)
+ q_func()->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone()));
+ Q_FOREACH (QCriterion *crit, other->m_criteriaList)
+ q_func()->addCriterion(qobject_cast<QCriterion *>(QNodePrivate::get(crit)->clone()));
+}
+
QTechniqueFilter::QTechniqueFilter(QNode *parent)
: QFrameGraphItem(*new QTechniqueFilterPrivate(this), parent)
{
@@ -65,21 +75,6 @@ QTechniqueFilter::QTechniqueFilter(QTechniqueFilterPrivate &dd, QNode *parent)
{
}
-QTechniqueFilter *QTechniqueFilter::doClone() const
-{
- Q_D(const QTechniqueFilter);
- QTechniqueFilter *clone = new QTechniqueFilter();
-
- clone->d_func()->copy(d_func());
-
- Q_FOREACH (QFrameGraphItem *fgChild, d->m_fgChildren)
- clone->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone()));
- Q_FOREACH (QCriterion *crit, d->m_criteriaList)
- clone->addCriterion(qobject_cast<QCriterion *>(QNodePrivate::get(crit)->clone()));
-
- return clone;
-}
-
QList<QCriterion *> QTechniqueFilter::criteria() const
{
Q_D(const QTechniqueFilter);
diff --git a/src/render/frontend/framegraph-components/qtechniquefilter.h b/src/render/frontend/framegraph-components/qtechniquefilter.h
index 37e7e96ed..00994b466 100644
--- a/src/render/frontend/framegraph-components/qtechniquefilter.h
+++ b/src/render/frontend/framegraph-components/qtechniquefilter.h
@@ -67,7 +67,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QTechniqueFilter)
- QTechniqueFilter *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QTechniqueFilter)
};
} // namespace Qt3D
diff --git a/src/render/frontend/framegraph-components/qtechniquefilter_p.h b/src/render/frontend/framegraph-components/qtechniquefilter_p.h
index edcc3c454..c642b38ed 100644
--- a/src/render/frontend/framegraph-components/qtechniquefilter_p.h
+++ b/src/render/frontend/framegraph-components/qtechniquefilter_p.h
@@ -54,6 +54,7 @@ class QTechniqueFilterPrivate : public QFrameGraphItemPrivate
{
public :
QTechniqueFilterPrivate(QTechniqueFilter *qq);
+ void copy(const QNodePrivate *ref) Q_DECL_OVERRIDE;
Q_DECLARE_PUBLIC(QTechniqueFilter)
QList<QCriterion *> m_criteriaList;
diff --git a/src/render/frontend/framegraph-components/qviewport.cpp b/src/render/frontend/framegraph-components/qviewport.cpp
index d86094065..9894ff08e 100644
--- a/src/render/frontend/framegraph-components/qviewport.cpp
+++ b/src/render/frontend/framegraph-components/qviewport.cpp
@@ -58,6 +58,8 @@ void QViewportPrivate::copy(const QNodePrivate *ref)
QFrameGraphItemPrivate::copy(ref);
const QViewportPrivate *viewport = static_cast<const QViewportPrivate *>(ref);
m_rect = viewport->m_rect;
+ Q_FOREACH (QFrameGraphItem *fgChild, viewport->m_fgChildren)
+ q_func()->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone()));
}
QViewport::QViewport(QNode *parent)
@@ -70,19 +72,6 @@ QViewport::QViewport(QViewportPrivate &dd, QNode *parent)
{
}
-QViewport *QViewport::doClone() const
-{
- Q_D(const QViewport);
- QViewport *clone = new QViewport();
-
- clone->d_func()->copy(d_func());
-
- Q_FOREACH (QFrameGraphItem *fgChild, d->m_fgChildren)
- clone->appendFrameGraphItem(qobject_cast<QFrameGraphItem *>(QNodePrivate::get(fgChild)->clone()));
-
- return clone;
-}
-
QRectF QViewport::rect() const
{
Q_D(const QViewport);
diff --git a/src/render/frontend/framegraph-components/qviewport.h b/src/render/frontend/framegraph-components/qviewport.h
index 4b8499eea..ce2410e84 100644
--- a/src/render/frontend/framegraph-components/qviewport.h
+++ b/src/render/frontend/framegraph-components/qviewport.h
@@ -76,7 +76,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QViewport)
- QViewport *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QViewport)
};
} // Qt3D
diff --git a/src/render/frontend/qalphacoverage.cpp b/src/render/frontend/qalphacoverage.cpp
index 7240720b9..c9e9d12b5 100644
--- a/src/render/frontend/qalphacoverage.cpp
+++ b/src/render/frontend/qalphacoverage.cpp
@@ -62,13 +62,6 @@ QAlphaCoverage::QAlphaCoverage(QNode *parent)
{
}
-QNode *QAlphaCoverage::doClone() const
-{
- QAlphaCoverage *clone = new QAlphaCoverage();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qalphacoverage.h b/src/render/frontend/qalphacoverage.h
index e4b903c7b..ac0fef8e2 100644
--- a/src/render/frontend/qalphacoverage.h
+++ b/src/render/frontend/qalphacoverage.h
@@ -59,7 +59,7 @@ public:
private:
Q_DECLARE_PRIVATE(QAlphaCoverage)
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QAlphaCoverage)
};
} // Qt3D
diff --git a/src/render/frontend/qalphatest.cpp b/src/render/frontend/qalphatest.cpp
index 58b05e5cb..de0837df3 100644
--- a/src/render/frontend/qalphatest.cpp
+++ b/src/render/frontend/qalphatest.cpp
@@ -109,13 +109,6 @@ void QAlphaTest::setClamp(float clamp)
}
}
-QNode *QAlphaTest::doClone() const
-{
- QAlphaTest *clone = new QAlphaTest();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qalphatest.h b/src/render/frontend/qalphatest.h
index 4234b66e0..0180e2074 100644
--- a/src/render/frontend/qalphatest.h
+++ b/src/render/frontend/qalphatest.h
@@ -84,7 +84,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QAlphaTest)
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QAlphaTest)
};
} // Qt3D
diff --git a/src/render/frontend/qblendequation.cpp b/src/render/frontend/qblendequation.cpp
index 9028140c7..450fab6ed 100644
--- a/src/render/frontend/qblendequation.cpp
+++ b/src/render/frontend/qblendequation.cpp
@@ -90,13 +90,6 @@ void QBlendEquation::setMode(QBlendEquation::BlendMode mode)
}
}
-QNode *QBlendEquation::doClone() const
-{
- QBlendEquation *clone = new QBlendEquation();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qblendequation.h b/src/render/frontend/qblendequation.h
index f60e50c5f..cdf683c9e 100644
--- a/src/render/frontend/qblendequation.h
+++ b/src/render/frontend/qblendequation.h
@@ -77,7 +77,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QBlendEquation)
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QBlendEquation)
};
} // Qt3D
diff --git a/src/render/frontend/qblendstate.cpp b/src/render/frontend/qblendstate.cpp
index 99ba09c32..d19a9b73f 100644
--- a/src/render/frontend/qblendstate.cpp
+++ b/src/render/frontend/qblendstate.cpp
@@ -146,13 +146,6 @@ void QBlendState::setDstAlpha(QBlendState::Blending dstAlpha)
}
}
-QNode *QBlendState::doClone() const
-{
- QBlendState *clone = new QBlendState();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qblendstate.h b/src/render/frontend/qblendstate.h
index 73295d37e..33d4d6a9e 100644
--- a/src/render/frontend/qblendstate.h
+++ b/src/render/frontend/qblendstate.h
@@ -107,7 +107,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QBlendState)
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QBlendState)
};
} // Qt3D
diff --git a/src/render/frontend/qcriterion.cpp b/src/render/frontend/qcriterion.cpp
index 659fee961..b7dc6ee74 100644
--- a/src/render/frontend/qcriterion.cpp
+++ b/src/render/frontend/qcriterion.cpp
@@ -67,14 +67,6 @@ QCriterion::QCriterion(QNode *parent)
{
}
-
-QCriterion *QCriterion::doClone() const
-{
- QCriterion *clone = new QCriterion();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
void QCriterion::setValue(const QVariant &value)
{
Q_D(QCriterion);
diff --git a/src/render/frontend/qcriterion.h b/src/render/frontend/qcriterion.h
index c0d9e0585..eaa3c29e8 100644
--- a/src/render/frontend/qcriterion.h
+++ b/src/render/frontend/qcriterion.h
@@ -72,7 +72,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QCriterion)
- QCriterion *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QCriterion)
};
} // Qt3D
diff --git a/src/render/frontend/qcuboidmesh.cpp b/src/render/frontend/qcuboidmesh.cpp
index ea58fd9c0..eeb79528a 100644
--- a/src/render/frontend/qcuboidmesh.cpp
+++ b/src/render/frontend/qcuboidmesh.cpp
@@ -86,13 +86,6 @@ QCuboidMesh::QCuboidMesh(QCuboidMeshPrivate &dd, QNode *parent)
setDirty(true);
}
-QCuboidMesh *QCuboidMesh::doClone() const
-{
- QCuboidMesh *clone = new QCuboidMesh();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
void QCuboidMesh::setXExtent(float xExtent)
{
Q_D(QCuboidMesh);
diff --git a/src/render/frontend/qcuboidmesh.h b/src/render/frontend/qcuboidmesh.h
index 8b8087dd6..33b79050a 100644
--- a/src/render/frontend/qcuboidmesh.h
+++ b/src/render/frontend/qcuboidmesh.h
@@ -98,7 +98,7 @@ protected:
QCuboidMesh(QCuboidMeshPrivate &dd, QNode *parent = 0);
private:
- QCuboidMesh *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QCuboidMesh)
Q_DECLARE_PRIVATE(QCuboidMesh)
};
diff --git a/src/render/frontend/qcullface.cpp b/src/render/frontend/qcullface.cpp
index e473e2ebc..9972c66ae 100644
--- a/src/render/frontend/qcullface.cpp
+++ b/src/render/frontend/qcullface.cpp
@@ -91,13 +91,6 @@ void QCullFace::setMode(QCullFace::CullingMode mode)
}
}
-QNode *QCullFace::doClone() const
-{
- QCullFace *clone = new QCullFace();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qcullface.h b/src/render/frontend/qcullface.h
index b814d2687..98544376a 100644
--- a/src/render/frontend/qcullface.h
+++ b/src/render/frontend/qcullface.h
@@ -77,7 +77,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QCullFace)
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QCullFace)
};
} // Qt3D
diff --git a/src/render/frontend/qcylindermesh.cpp b/src/render/frontend/qcylindermesh.cpp
index cd6eb7b69..da371db4d 100644
--- a/src/render/frontend/qcylindermesh.cpp
+++ b/src/render/frontend/qcylindermesh.cpp
@@ -334,13 +334,6 @@ QAbstractMeshFunctorPtr QCylinderMesh::meshFunctor() const
return QAbstractMeshFunctorPtr(new CylinderMeshFunctor(d->m_rings, d->m_slices, d->m_radius, d->m_length));
}
-QCylinderMesh *QCylinderMesh::doClone() const
-{
- QCylinderMesh *clone = new QCylinderMesh();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
CylinderMeshFunctor::CylinderMeshFunctor(int rings, int slices, float radius, float length)
: QAbstractMeshFunctor()
, m_rings(rings)
diff --git a/src/render/frontend/qcylindermesh.h b/src/render/frontend/qcylindermesh.h
index 590191cdb..17be25404 100644
--- a/src/render/frontend/qcylindermesh.h
+++ b/src/render/frontend/qcylindermesh.h
@@ -82,7 +82,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QCylinderMesh)
- QCylinderMesh *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QCylinderMesh)
};
} // Qt3D
diff --git a/src/render/frontend/qdepthmask.cpp b/src/render/frontend/qdepthmask.cpp
index aca996c19..bd0258089 100644
--- a/src/render/frontend/qdepthmask.cpp
+++ b/src/render/frontend/qdepthmask.cpp
@@ -91,13 +91,6 @@ void QDepthMask::setMask(bool mask)
}
}
-QNode *QDepthMask::doClone() const
-{
- QDepthMask *clone = new QDepthMask();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qdepthmask.h b/src/render/frontend/qdepthmask.h
index 10aa2e4d6..88b1df4a4 100644
--- a/src/render/frontend/qdepthmask.h
+++ b/src/render/frontend/qdepthmask.h
@@ -66,7 +66,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QDepthMask)
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QDepthMask)
};
} // Qt3D
diff --git a/src/render/frontend/qdepthtest.cpp b/src/render/frontend/qdepthtest.cpp
index 67d42dbfa..c99401339 100644
--- a/src/render/frontend/qdepthtest.cpp
+++ b/src/render/frontend/qdepthtest.cpp
@@ -93,13 +93,6 @@ void QDepthTest::setFunc(QDepthTest::DepthFunc func)
}
}
-QNode *QDepthTest::doClone() const
-{
- QDepthTest *clone = new QDepthTest();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qdepthtest.h b/src/render/frontend/qdepthtest.h
index 95b96922c..9f75efcbb 100644
--- a/src/render/frontend/qdepthtest.h
+++ b/src/render/frontend/qdepthtest.h
@@ -79,7 +79,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QDepthTest)
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QDepthTest)
};
} // Qt3D
diff --git a/src/render/frontend/qdirectionallight.cpp b/src/render/frontend/qdirectionallight.cpp
index 4dc4cf4cb..31a5f110a 100644
--- a/src/render/frontend/qdirectionallight.cpp
+++ b/src/render/frontend/qdirectionallight.cpp
@@ -88,13 +88,6 @@ QDirectionalLight::QDirectionalLight(QDirectionalLightPrivate &dd, QNode *parent
{
}
-QDirectionalLight *QDirectionalLight::doClone() const
-{
- QDirectionalLight *clone = new QDirectionalLight();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
void QDirectionalLight::setDirection(const QVector3D &direction)
{
Q_D(QDirectionalLight);
diff --git a/src/render/frontend/qdirectionallight.h b/src/render/frontend/qdirectionallight.h
index 30cc66fe2..420c1019b 100644
--- a/src/render/frontend/qdirectionallight.h
+++ b/src/render/frontend/qdirectionallight.h
@@ -73,7 +73,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QDirectionalLight)
- QDirectionalLight *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QDirectionalLight)
};
} // Qt3D
diff --git a/src/render/frontend/qdithering.cpp b/src/render/frontend/qdithering.cpp
index d08e7c18f..23f1da195 100644
--- a/src/render/frontend/qdithering.cpp
+++ b/src/render/frontend/qdithering.cpp
@@ -64,13 +64,6 @@ QDithering::QDithering(QNode *parent)
{
}
-QNode *QDithering::doClone() const
-{
- QDithering *clone = new QDithering();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qdithering.h b/src/render/frontend/qdithering.h
index 8bd5a158a..e5b6fda02 100644
--- a/src/render/frontend/qdithering.h
+++ b/src/render/frontend/qdithering.h
@@ -59,7 +59,7 @@ public:
private:
Q_DECLARE_PRIVATE(QDithering)
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QDithering)
};
} // Qt3D
diff --git a/src/render/frontend/qeffect.cpp b/src/render/frontend/qeffect.cpp
index 0988f3222..a9f5250a1 100644
--- a/src/render/frontend/qeffect.cpp
+++ b/src/render/frontend/qeffect.cpp
@@ -62,6 +62,12 @@ QEffect::QEffect(QNode *parent)
void QEffectPrivate::copy(const QNodePrivate *ref)
{
QNodePrivate::copy(ref);
+ const QEffectPrivate *effect = static_cast<const QEffectPrivate*>(ref);
+ Q_FOREACH (QParameter *p, effect->m_parameters)
+ q_func()->addParameter(qobject_cast<QParameter *>(QNodePrivate::get(p)->clone()));
+
+ Q_FOREACH (QTechnique *t, effect->m_techniques)
+ q_func()->addTechnique(qobject_cast<QTechnique *>(QNodePrivate::get(t)->clone()));
}
QEffect::QEffect(QEffectPrivate &dd, QNode *parent)
@@ -69,22 +75,6 @@ QEffect::QEffect(QEffectPrivate &dd, QNode *parent)
{
}
-QEffect *QEffect::doClone() const
-{
- Q_D(const QEffect);
- QEffect *effect = new QEffect();
-
- effect->d_func()->copy(d_func());
-
- Q_FOREACH (QParameter *p, d->m_parameters)
- effect->addParameter(qobject_cast<QParameter *>(QNodePrivate::get(p)->clone()));
-
- Q_FOREACH (QTechnique *t, d->m_techniques)
- effect->addTechnique(qobject_cast<QTechnique *>(QNodePrivate::get(t)->clone()));
-
- return effect;
-}
-
void QEffect::addParameter(QParameter *parameter)
{
Q_D(QEffect);
diff --git a/src/render/frontend/qeffect.h b/src/render/frontend/qeffect.h
index 3f7642e60..05192dd2b 100644
--- a/src/render/frontend/qeffect.h
+++ b/src/render/frontend/qeffect.h
@@ -73,7 +73,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QEffect)
- QEffect *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QEffect)
};
} // Qt3D
diff --git a/src/render/frontend/qfrontface.cpp b/src/render/frontend/qfrontface.cpp
index e6e4d7674..8d60857e7 100644
--- a/src/render/frontend/qfrontface.cpp
+++ b/src/render/frontend/qfrontface.cpp
@@ -91,13 +91,6 @@ void QFrontFace::setDirection(QFrontFace::FaceDir direction)
}
}
-QNode *QFrontFace::doClone() const
-{
- QFrontFace *clone = new QFrontFace();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qfrontface.h b/src/render/frontend/qfrontface.h
index 8acb8b28d..5160a553d 100644
--- a/src/render/frontend/qfrontface.h
+++ b/src/render/frontend/qfrontface.h
@@ -74,7 +74,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QFrontFace)
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QFrontFace)
};
} // Qt3D
diff --git a/src/render/frontend/qlayer.cpp b/src/render/frontend/qlayer.cpp
index 79dbfca97..5c9f4de13 100644
--- a/src/render/frontend/qlayer.cpp
+++ b/src/render/frontend/qlayer.cpp
@@ -69,13 +69,6 @@ QLayer::QLayer(QLayerPrivate &dd, QNode *parent)
{
}
-QLayer *QLayer::doClone() const
-{
- QLayer *clone = new QLayer();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
QString QLayer::name() const
{
Q_D(const QLayer);
diff --git a/src/render/frontend/qlayer.h b/src/render/frontend/qlayer.h
index 5523c0c85..b5d79bb3f 100644
--- a/src/render/frontend/qlayer.h
+++ b/src/render/frontend/qlayer.h
@@ -69,7 +69,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QLayer)
- QLayer *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QLayer)
};
} // Qt3D
diff --git a/src/render/frontend/qmaterial.cpp b/src/render/frontend/qmaterial.cpp
index 828078866..bedae8753 100644
--- a/src/render/frontend/qmaterial.cpp
+++ b/src/render/frontend/qmaterial.cpp
@@ -77,6 +77,12 @@ QMaterialPrivate::QMaterialPrivate(QMaterial *qq)
void QMaterialPrivate::copy(const QNodePrivate *ref)
{
QComponentPrivate::copy(ref);
+ const QMaterialPrivate *material = static_cast<const QMaterialPrivate*>(ref);
+ Q_FOREACH (QParameter *p, material->m_parameters)
+ q_func()->addParameter(qobject_cast<QParameter *>(QNodePrivate::get(p)->clone()));
+
+ if (material->m_effect != Q_NULLPTR)
+ q_func()->setEffect(qobject_cast<QEffect *>(QNodePrivate::get(material->m_effect)->clone()));
}
QMaterial::QMaterial(QNode *parent)
@@ -89,22 +95,6 @@ QMaterial::QMaterial(QMaterialPrivate &dd, QNode *parent)
{
}
-QMaterial *QMaterial::doClone() const
-{
- Q_D(const QMaterial);
- QMaterial *mat = new QMaterial();
-
- mat->d_func()->copy(d_func());
-
- Q_FOREACH (QParameter *p, d->m_parameters)
- mat->addParameter(qobject_cast<QParameter *>(QNodePrivate::get(p)->clone()));
-
- if (d->m_effect != Q_NULLPTR)
- mat->setEffect(qobject_cast<QEffect *>(QNodePrivate::get(d->m_effect)->clone()));
-
- return mat;
-}
-
/*!
* Sets the \a effect to be used with the Material.
*/
diff --git a/src/render/frontend/qmaterial.h b/src/render/frontend/qmaterial.h
index c1560f7a4..e23264b9d 100644
--- a/src/render/frontend/qmaterial.h
+++ b/src/render/frontend/qmaterial.h
@@ -84,7 +84,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QMaterial)
- QMaterial *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QMaterial)
};
}
diff --git a/src/render/frontend/qmesh.cpp b/src/render/frontend/qmesh.cpp
index 4d3d15a0b..e8c8279c4 100644
--- a/src/render/frontend/qmesh.cpp
+++ b/src/render/frontend/qmesh.cpp
@@ -88,13 +88,6 @@ QMesh::QMesh(QMeshPrivate &dd, QNode *parent)
{
}
-QMesh *QMesh::doClone() const
-{
- QMesh *clone = new QMesh();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
void QMesh::setSource( const QString& source )
{
Q_D(QMesh);
diff --git a/src/render/frontend/qmesh.h b/src/render/frontend/qmesh.h
index fe6044d01..7a65db92c 100644
--- a/src/render/frontend/qmesh.h
+++ b/src/render/frontend/qmesh.h
@@ -79,7 +79,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QMesh)
- QMesh *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QMesh)
};
}
diff --git a/src/render/frontend/qparameter.cpp b/src/render/frontend/qparameter.cpp
index ab609cbc3..247b9ebe2 100644
--- a/src/render/frontend/qparameter.cpp
+++ b/src/render/frontend/qparameter.cpp
@@ -75,13 +75,6 @@ QParameter::QParameter(QParameterPrivate &dd, QNode *parent)
{
}
-QParameter *QParameter::doClone() const
-{
- QParameter *clone = new QParameter();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
QParameter::QParameter(QNode *parent)
: QNode(*new QParameterPrivate(this), parent)
{
diff --git a/src/render/frontend/qparameter.h b/src/render/frontend/qparameter.h
index cbda5c76a..7c42a7c76 100644
--- a/src/render/frontend/qparameter.h
+++ b/src/render/frontend/qparameter.h
@@ -85,7 +85,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QParameter)
- QParameter *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QParameter)
};
} // Qt3D
diff --git a/src/render/frontend/qparametermapper.cpp b/src/render/frontend/qparametermapper.cpp
index 141ce6428..28e7c698b 100644
--- a/src/render/frontend/qparametermapper.cpp
+++ b/src/render/frontend/qparametermapper.cpp
@@ -71,13 +71,6 @@ QParameterMapper::QParameterMapper(QParameterMapperPrivate &dd, QNode *parent)
{
}
-QNode *QParameterMapper::doClone() const
-{
- QParameterMapper *clone = new QParameterMapper();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
QParameterMapper::QParameterMapper(const QString &parameterName, const QString &shaderParameterName, QParameterMapper::Binding bindingType, QNode *parent)
: QNode(*new QParameterMapperPrivate(this), parent)
{
diff --git a/src/render/frontend/qparametermapper.h b/src/render/frontend/qparametermapper.h
index fd78ea3a1..51b99757b 100644
--- a/src/render/frontend/qparametermapper.h
+++ b/src/render/frontend/qparametermapper.h
@@ -88,7 +88,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QParameterMapper)
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QParameterMapper)
};
} // Qt3D
diff --git a/src/render/frontend/qplanemesh.cpp b/src/render/frontend/qplanemesh.cpp
index 4803ecc53..560cf5b24 100644
--- a/src/render/frontend/qplanemesh.cpp
+++ b/src/render/frontend/qplanemesh.cpp
@@ -81,13 +81,6 @@ QPlaneMesh::QPlaneMesh(QPlaneMeshPrivate &dd, QNode *parent)
}
-QPlaneMesh *QPlaneMesh::doClone() const
-{
- QPlaneMesh *clone = new QPlaneMesh();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
void QPlaneMesh::setWidth(float width)
{
Q_D(QPlaneMesh);
diff --git a/src/render/frontend/qplanemesh.h b/src/render/frontend/qplanemesh.h
index 2eca40feb..a2199a1d3 100644
--- a/src/render/frontend/qplanemesh.h
+++ b/src/render/frontend/qplanemesh.h
@@ -83,7 +83,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QPlaneMesh)
- QPlaneMesh *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QPlaneMesh)
};
} // namespace Qt3D
diff --git a/src/render/frontend/qpointlight.cpp b/src/render/frontend/qpointlight.cpp
index 34d07ecbc..c402a2cfd 100644
--- a/src/render/frontend/qpointlight.cpp
+++ b/src/render/frontend/qpointlight.cpp
@@ -84,13 +84,6 @@ QPointLight::QPointLight(QPointLightPrivate &dd, QNode *parent)
{
}
-QPointLight *QPointLight::doClone() const
-{
- QPointLight *clone = new QPointLight();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qpointlight.h b/src/render/frontend/qpointlight.h
index 3fbb0fa2c..c91a09c38 100644
--- a/src/render/frontend/qpointlight.h
+++ b/src/render/frontend/qpointlight.h
@@ -63,7 +63,7 @@ public:
protected:
Q_DECLARE_PRIVATE(QPointLight)
QPointLight(QPointLightPrivate &dd, QNode *parent);
- QPointLight *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QPointLight)
};
} // Qt3D
diff --git a/src/render/frontend/qrenderattachment.cpp b/src/render/frontend/qrenderattachment.cpp
index 9070876d9..d3cd769ea 100644
--- a/src/render/frontend/qrenderattachment.cpp
+++ b/src/render/frontend/qrenderattachment.cpp
@@ -62,6 +62,7 @@ void QRenderAttachmentPrivate::copy(const QNodePrivate *ref)
QNodePrivate::copy(ref);
const QRenderAttachmentPrivate *rA = static_cast<const QRenderAttachmentPrivate *>(ref);
m_type = rA->m_type;
+ q_func()->setTexture(qobject_cast<QTexture *>(QNodePrivate::get(rA->m_texture)->clone()));
}
QRenderAttachment::QRenderAttachment(QNode *parent)
@@ -168,15 +169,6 @@ QString QRenderAttachment::name() const
return d->m_name;
}
-QNode *QRenderAttachment::doClone() const
-{
- Q_D(const QRenderAttachment);
- QRenderAttachment *clone = new QRenderAttachment();;
- clone->d_func()->copy(d_func());
- clone->setTexture(qobject_cast<QTexture *>(QNodePrivate::get(d->m_texture)->clone()));
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qrenderattachment.h b/src/render/frontend/qrenderattachment.h
index 0c63ece5e..7b93b2980 100644
--- a/src/render/frontend/qrenderattachment.h
+++ b/src/render/frontend/qrenderattachment.h
@@ -129,7 +129,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QRenderAttachment)
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QRenderAttachment)
};
} // Qt3D
diff --git a/src/render/frontend/qrenderpass.cpp b/src/render/frontend/qrenderpass.cpp
index ad5142533..7057103f5 100644
--- a/src/render/frontend/qrenderpass.cpp
+++ b/src/render/frontend/qrenderpass.cpp
@@ -61,6 +61,20 @@ QRenderPassPrivate::QRenderPassPrivate(QRenderPass *qq)
{
}
+void QRenderPassPrivate::copy(const QNodePrivate *ref)
+{
+ QNodePrivate::copy(ref);
+ const QRenderPassPrivate *other = static_cast<const QRenderPassPrivate*>(ref);
+ m_shader = qobject_cast<QShaderProgram *>(QNodePrivate::get(other->m_shader)->clone());
+
+ Q_FOREACH (QCriterion *crit, other->m_criteriaList)
+ q_func()->addCriterion(qobject_cast<QCriterion *>(QNodePrivate::get(crit)->clone()));
+ Q_FOREACH (QParameterMapper *binding, other->m_bindings)
+ q_func()->addBinding(qobject_cast<QParameterMapper *>(QNodePrivate::get(binding)->clone()));
+ Q_FOREACH (QRenderState *renderState, other->m_renderStates)
+ q_func()->addRenderState(qobject_cast<QRenderState *>(QNodePrivate::get(renderState)->clone()));
+}
+
QRenderPass::QRenderPass(QNode *parent)
: QNode(*new QRenderPassPrivate(this), parent)
{
@@ -71,24 +85,6 @@ QRenderPass::QRenderPass(QRenderPassPrivate &dd, QNode *parent)
{
}
-QRenderPass *QRenderPass::doClone() const
-{
- Q_D(const QRenderPass);
- QRenderPass *pass = new QRenderPass();
-
- pass->d_func()->copy(d_func());
-
- Q_FOREACH (QCriterion *crit, d->m_criteriaList)
- pass->addCriterion(qobject_cast<QCriterion *>(QNodePrivate::get(crit)->clone()));
- Q_FOREACH (QParameterMapper *binding, d->m_bindings)
- pass->addBinding(qobject_cast<QParameterMapper *>(QNodePrivate::get(binding)->clone()));
- Q_FOREACH (QRenderState *renderState, d->m_renderStates)
- pass->addRenderState(qobject_cast<QRenderState *>(QNodePrivate::get(renderState)->clone()));
- pass->d_func()->m_shader = qobject_cast<QShaderProgram *>(QNodePrivate::get(d->m_shader)->clone());
-
- return pass;
-}
-
ParameterList QRenderPass::attributes() const
{
Q_D(const QRenderPass);
diff --git a/src/render/frontend/qrenderpass.h b/src/render/frontend/qrenderpass.h
index 3ceb5ac71..f8116d831 100644
--- a/src/render/frontend/qrenderpass.h
+++ b/src/render/frontend/qrenderpass.h
@@ -104,7 +104,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QRenderPass)
- QRenderPass *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QRenderPass)
};
}
diff --git a/src/render/frontend/qrenderpass_p.h b/src/render/frontend/qrenderpass_p.h
index ec0e420d0..e4951726e 100644
--- a/src/render/frontend/qrenderpass_p.h
+++ b/src/render/frontend/qrenderpass_p.h
@@ -66,6 +66,7 @@ class QT3DRENDERERSHARED_EXPORT QRenderPassPrivate : public QNodePrivate
{
public:
QRenderPassPrivate(QRenderPass *qq);
+ void copy(const QNodePrivate *ref) Q_DECL_OVERRIDE;
Q_DECLARE_PUBLIC(QRenderPass)
ParameterList m_attributes;
diff --git a/src/render/frontend/qrendertarget.cpp b/src/render/frontend/qrendertarget.cpp
index 604335405..ecf51bb36 100644
--- a/src/render/frontend/qrendertarget.cpp
+++ b/src/render/frontend/qrendertarget.cpp
@@ -56,6 +56,9 @@ QRenderTargetPrivate::QRenderTargetPrivate(QRenderTarget *qq)
void QRenderTargetPrivate::copy(const QNodePrivate *ref)
{
QNodePrivate::copy(ref);
+ const QRenderTargetPrivate *other = static_cast<const QRenderTargetPrivate*>(ref);
+ Q_FOREACH (QRenderAttachment *attachment, other->m_attachments)
+ q_func()->addAttachment(qobject_cast<QRenderAttachment *>(QNodePrivate::get(attachment)->clone()));
}
QRenderTarget::QRenderTarget(QNode *parent)
@@ -105,19 +108,6 @@ QList<QRenderAttachment *> QRenderTarget::attachments() const
return d->m_attachments;
}
-QRenderTarget *QRenderTarget::doClone() const
-{
- Q_D(const QRenderTarget);
- QRenderTarget *clone = new QRenderTarget();
-
- clone->d_func()->copy(d_func());
-
- Q_FOREACH (QRenderAttachment *attachment, d->m_attachments)
- clone->addAttachment(qobject_cast<QRenderAttachment *>(QNodePrivate::get(attachment)->clone()));
-
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qrendertarget.h b/src/render/frontend/qrendertarget.h
index 095f9b732..758e54790 100644
--- a/src/render/frontend/qrendertarget.h
+++ b/src/render/frontend/qrendertarget.h
@@ -67,7 +67,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QRenderTarget)
- QRenderTarget *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QRenderTarget)
};
} // Qt3D
diff --git a/src/render/frontend/qsceneloader.cpp b/src/render/frontend/qsceneloader.cpp
index 7769f8671..c9fe5c1f7 100644
--- a/src/render/frontend/qsceneloader.cpp
+++ b/src/render/frontend/qsceneloader.cpp
@@ -84,13 +84,6 @@ void QSceneLoader::sceneChangeEvent(const QSceneChangePtr &change)
}
}
-QNode *QSceneLoader::doClone() const
-{
- QSceneLoader *clone = new QSceneLoader();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qsceneloader.h b/src/render/frontend/qsceneloader.h
index fa2181a83..2393365fd 100644
--- a/src/render/frontend/qsceneloader.h
+++ b/src/render/frontend/qsceneloader.h
@@ -56,7 +56,7 @@ public:
void sceneChangeEvent(const QSceneChangePtr &change) Q_DECL_OVERRIDE;
protected:
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QSceneLoader)
};
} // Qt3D
diff --git a/src/render/frontend/qscissortest.cpp b/src/render/frontend/qscissortest.cpp
index 05f5be83c..1631ba5ab 100644
--- a/src/render/frontend/qscissortest.cpp
+++ b/src/render/frontend/qscissortest.cpp
@@ -146,13 +146,6 @@ void QScissorTest::setHeight(int height)
}
}
-QNode *QScissorTest::doClone() const
-{
- QScissorTest *clone = new QScissorTest();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qscissortest.h b/src/render/frontend/qscissortest.h
index 7e43ae8cc..4caa7106b 100644
--- a/src/render/frontend/qscissortest.h
+++ b/src/render/frontend/qscissortest.h
@@ -82,7 +82,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QScissorTest)
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QScissorTest)
};
} // Qt3D
diff --git a/src/render/frontend/qshaderprogram.cpp b/src/render/frontend/qshaderprogram.cpp
index 06c1bfbb5..c3e83ccb8 100644
--- a/src/render/frontend/qshaderprogram.cpp
+++ b/src/render/frontend/qshaderprogram.cpp
@@ -83,13 +83,6 @@ QShaderProgram::QShaderProgram(QShaderProgramPrivate &dd, QNode *parent)
{
}
-QShaderProgram *QShaderProgram::doClone() const
-{
- QShaderProgram *clone = new QShaderProgram();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
void QShaderProgram::setVertexShaderSourceFile(const QString& vertexShaderSourceFile)
{
Q_D(QShaderProgram);
diff --git a/src/render/frontend/qshaderprogram.h b/src/render/frontend/qshaderprogram.h
index 6e3b0deeb..5106e136a 100644
--- a/src/render/frontend/qshaderprogram.h
+++ b/src/render/frontend/qshaderprogram.h
@@ -146,7 +146,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QShaderProgram)
- QShaderProgram *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QShaderProgram)
};
}
diff --git a/src/render/frontend/qspheremesh.cpp b/src/render/frontend/qspheremesh.cpp
index 24127c6d0..bdc356160 100644
--- a/src/render/frontend/qspheremesh.cpp
+++ b/src/render/frontend/qspheremesh.cpp
@@ -157,13 +157,6 @@ QAbstractMeshFunctorPtr QSphereMesh::meshFunctor() const
return QAbstractMeshFunctorPtr(new SphereMeshFunctor(d->m_rings, d->m_slices, d->m_radius, d->m_generateTangents));
}
-QSphereMesh *QSphereMesh::doClone() const
-{
- QSphereMesh *clone = new QSphereMesh();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
int QSphereMesh::rings() const
{
Q_D(const QSphereMesh);
diff --git a/src/render/frontend/qspheremesh.h b/src/render/frontend/qspheremesh.h
index a3c040a05..28eb224f1 100644
--- a/src/render/frontend/qspheremesh.h
+++ b/src/render/frontend/qspheremesh.h
@@ -84,7 +84,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QSphereMesh)
- QSphereMesh *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QSphereMesh)
};
} // Qt3D
diff --git a/src/render/frontend/qspotlight.cpp b/src/render/frontend/qspotlight.cpp
index 24a40121d..0a9a571ac 100644
--- a/src/render/frontend/qspotlight.cpp
+++ b/src/render/frontend/qspotlight.cpp
@@ -92,13 +92,6 @@ QSpotLight::QSpotLight(QSpotLightPrivate &dd, QNode *parent)
{
}
-QSpotLight *QSpotLight::doClone() const
-{
- QSpotLight *clone = new QSpotLight();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
QVector3D QSpotLight::direction() const
{
Q_D(const QSpotLight);
diff --git a/src/render/frontend/qspotlight.h b/src/render/frontend/qspotlight.h
index ece7ba70f..5bd0acdd4 100644
--- a/src/render/frontend/qspotlight.h
+++ b/src/render/frontend/qspotlight.h
@@ -78,7 +78,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QSpotLight)
- QSpotLight *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QSpotLight)
};
} // Qt3D
diff --git a/src/render/frontend/qstenciltest.cpp b/src/render/frontend/qstenciltest.cpp
index 65e9b2ac1..312e4ce8c 100644
--- a/src/render/frontend/qstenciltest.cpp
+++ b/src/render/frontend/qstenciltest.cpp
@@ -128,13 +128,6 @@ void QStencilTest::setFunc(QStencilTest::StencilFunc func)
}
}
-QNode *QStencilTest::doClone() const
-{
- QStencilTest *clone = new QStencilTest();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qstenciltest.h b/src/render/frontend/qstenciltest.h
index 4530295d8..a7ef9f4c0 100644
--- a/src/render/frontend/qstenciltest.h
+++ b/src/render/frontend/qstenciltest.h
@@ -98,7 +98,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QStencilTest)
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QStencilTest)
};
} // Qt3D
diff --git a/src/render/frontend/qtechnique.cpp b/src/render/frontend/qtechnique.cpp
index 4625efe47..1ea712902 100644
--- a/src/render/frontend/qtechnique.cpp
+++ b/src/render/frontend/qtechnique.cpp
@@ -73,6 +73,13 @@ void QTechniquePrivate::copy(const QNodePrivate *ref)
QNodePrivate::copy(ref);
const QTechniquePrivate *tech = static_cast<const QTechniquePrivate *>(ref);
m_openGLFilter->copy(tech->m_openGLFilter);
+
+ Q_FOREACH (QCriterion *criterion, tech->m_criteriaList)
+ q_func()->addCriterion(qobject_cast<QCriterion *>(QNodePrivate::get(criterion)->clone()));
+ Q_FOREACH (QRenderPass *pass, tech->m_renderPasses)
+ q_func()->addPass(qobject_cast<QRenderPass *>(QNodePrivate::get(pass)->clone()));
+ Q_FOREACH (QParameter *p, tech->m_parameters)
+ q_func()->addParameter(qobject_cast<QParameter *>(QNodePrivate::get(p)->clone()));
}
QTechnique::QTechnique(QTechniquePrivate &dd, QNode *parent)
@@ -82,23 +89,6 @@ QTechnique::QTechnique(QTechniquePrivate &dd, QNode *parent)
QObject::connect(d->m_openGLFilter, SIGNAL(openGLFilterChanged()), this, SLOT(openGLFilterChanged()));
}
-QTechnique *QTechnique::doClone() const
-{
- Q_D(const QTechnique);
- QTechnique *technique = new QTechnique();
-
- technique->d_func()->copy(d_func());
-
- Q_FOREACH (QCriterion *criterion, d->m_criteriaList)
- technique->addCriterion(qobject_cast<QCriterion *>(QNodePrivate::get(criterion)->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()));
-
- return technique;
-}
-
void QTechnique::openGLFilterChanged()
{
Q_D(QTechnique);
diff --git a/src/render/frontend/qtechnique.h b/src/render/frontend/qtechnique.h
index 90a65528f..67e3dbad7 100644
--- a/src/render/frontend/qtechnique.h
+++ b/src/render/frontend/qtechnique.h
@@ -90,7 +90,7 @@ protected Q_SLOTS:
private:
Q_DECLARE_PRIVATE(QTechnique)
- QTechnique *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QTechnique)
};
}
diff --git a/src/render/frontend/qtexture.cpp b/src/render/frontend/qtexture.cpp
index a613a63c9..c55b8bd67 100644
--- a/src/render/frontend/qtexture.cpp
+++ b/src/render/frontend/qtexture.cpp
@@ -101,6 +101,7 @@ void QTexturePrivate::copy(const QNodePrivate *ref)
m_minFilter = t->m_minFilter;
m_magFilter = t->m_magFilter;
m_autoMipMap = t->m_autoMipMap;
+ // TO DO: Copy TexImageDataPtr
}
QTexture::QTexture(QNode *parent)
@@ -203,14 +204,6 @@ void QTexture::setStatus(Status status)
}
}
-QNode *QTexture::doClone() const
-{
- // TO DO: Copy TexImageDataPtr
- QTexture *clone = new QTexture();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
QTexture::Status QTexture::status() const
{
Q_D(const QTexture);
diff --git a/src/render/frontend/qtexture.h b/src/render/frontend/qtexture.h
index 5934a322f..50784f2ff 100644
--- a/src/render/frontend/qtexture.h
+++ b/src/render/frontend/qtexture.h
@@ -295,7 +295,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QTexture)
- QNode *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QTexture)
};
} // namespace Qt3D
diff --git a/src/render/frontend/qtorusmesh.cpp b/src/render/frontend/qtorusmesh.cpp
index f317ff17e..fd76ecc7f 100644
--- a/src/render/frontend/qtorusmesh.cpp
+++ b/src/render/frontend/qtorusmesh.cpp
@@ -266,13 +266,6 @@ QAbstractMeshFunctorPtr QTorusMesh::meshFunctor() const
return QAbstractMeshFunctorPtr(new TorusMeshFunctor(d->m_rings, d->m_slices, d->m_radius, d->m_minorRadius));
}
-QTorusMesh *QTorusMesh::doClone() const
-{
- QTorusMesh *clone = new QTorusMesh();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
TorusMeshFunctor::TorusMeshFunctor(int rings, int slices, float radius, float minorRadius)
: QAbstractMeshFunctor()
, m_rings(rings)
diff --git a/src/render/frontend/qtorusmesh.h b/src/render/frontend/qtorusmesh.h
index 4dbd2fae6..27093c2dc 100644
--- a/src/render/frontend/qtorusmesh.h
+++ b/src/render/frontend/qtorusmesh.h
@@ -83,7 +83,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QTorusMesh)
- QTorusMesh *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(QTorusMesh)
};
} // Qt3D
diff --git a/src/render/io/gltfparser.cpp b/src/render/io/gltfparser.cpp
index 345c1ba9e..0888041bd 100644
--- a/src/render/io/gltfparser.cpp
+++ b/src/render/io/gltfparser.cpp
@@ -228,7 +228,7 @@ public:
QAbstractMeshFunctorPtr meshFunctor() const Q_DECL_OVERRIDE;
private:
- GLTFParserMesh *doClone() const Q_DECL_OVERRIDE;
+ QT3D_CLONEABLE(GLTFParserMesh)
Q_DECLARE_PRIVATE(GLTFParserMesh)
};
@@ -1033,13 +1033,6 @@ QAbstractMeshFunctorPtr GLTFParserMesh::meshFunctor() const
return QAbstractMeshFunctorPtr(new GLTFParserMeshFunctor(d->m_meshData));
}
-GLTFParserMesh *GLTFParserMesh::doClone() const
-{
- GLTFParserMesh *clone = new GLTFParserMesh();
- clone->d_func()->copy(d_func());
- return clone;
-}
-
GLTFParserMesh::GLTFParserMeshFunctor::GLTFParserMeshFunctor(QMeshDataPtr meshData)
: QAbstractMeshFunctor()
, m_meshData(meshData)