diff options
Diffstat (limited to 'src/core/core-components')
-rw-r--r-- | src/core/core-components/qabstracteffect.cpp | 8 | ||||
-rw-r--r-- | src/core/core-components/qabstractmaterial.cpp | 8 | ||||
-rw-r--r-- | src/core/core-components/qabstractmesh.cpp | 10 | ||||
-rw-r--r-- | src/core/core-components/qabstractmesh.h | 8 | ||||
-rw-r--r-- | src/core/core-components/qabstractmesh_p.h | 4 | ||||
-rw-r--r-- | src/core/core-components/qabstractrenderpass.cpp | 8 | ||||
-rw-r--r-- | src/core/core-components/qabstractrenderpass_p.h | 2 | ||||
-rw-r--r-- | src/core/core-components/qabstracttechnique.cpp | 8 | ||||
-rw-r--r-- | src/core/core-components/qcameralens.cpp | 60 | ||||
-rw-r--r-- | src/core/core-components/qcameralens.h | 8 | ||||
-rw-r--r-- | src/core/core-components/qcameralens_p.h | 4 |
11 files changed, 68 insertions, 60 deletions
diff --git a/src/core/core-components/qabstracteffect.cpp b/src/core/core-components/qabstracteffect.cpp index 0c722cc1e..5de20afd6 100644 --- a/src/core/core-components/qabstracteffect.cpp +++ b/src/core/core-components/qabstracteffect.cpp @@ -93,14 +93,14 @@ void QAbstractEffect::addTechnique(QAbstractTechnique *t) // Or not previously added as a child of the current node so that // 1) The backend gets notified about it's creation // 2) When the current node is destroyed, tit gets destroyed as well - if (!t->parent() || t->parent() == this) - QNode::addChild(t); + if (!t->parent()) + t->setParent(this); if (d->m_changeArbiter != Q_NULLPTR) { QScenePropertyChangePtr e(new QScenePropertyChange(NodeAdded, this)); e->setPropertyName(QByteArrayLiteral("technique")); e->setValue(QVariant::fromValue(t)); - notifyObservers(e); + d->notifyObservers(e); } } } @@ -117,7 +117,7 @@ void QAbstractEffect::removeTechnique(QAbstractTechnique *t) QScenePropertyChangePtr e(new QScenePropertyChange(NodeRemoved, this)); e->setPropertyName(QByteArrayLiteral("technique")); e->setValue(QVariant::fromValue(t->uuid())); - notifyObservers(e); + d->notifyObservers(e); } d->m_techniques.removeOne(t); } diff --git a/src/core/core-components/qabstractmaterial.cpp b/src/core/core-components/qabstractmaterial.cpp index 7ef03ba0b..b5c3aa5f4 100644 --- a/src/core/core-components/qabstractmaterial.cpp +++ b/src/core/core-components/qabstractmaterial.cpp @@ -92,7 +92,7 @@ void QAbstractMaterial::setEffect(QAbstractEffect *effect) QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, this)); change->setPropertyName(QByteArrayLiteral("effect")); change->setValue(QVariant::fromValue(d->m_effect)); - notifyObservers(change); + d->notifyObservers(change); } d->m_effect = effect; @@ -102,14 +102,14 @@ void QAbstractMaterial::setEffect(QAbstractEffect *effect) // Or not previously added as a child of the current node so that // 1) The backend gets notified about it's creation // 2) When the current node is destroyed, it gets destroyed as well - if (!effect->parent() || effect->parent() == this) - QNode::addChild(effect); + if (!effect->parent()) + effect->setParent(this); if (d->m_changeArbiter != Q_NULLPTR) { QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, this)); change->setPropertyName(QByteArrayLiteral("effect")); change->setValue(QVariant::fromValue(effect)); - notifyObservers(change); + d->notifyObservers(change); } } } diff --git a/src/core/core-components/qabstractmesh.cpp b/src/core/core-components/qabstractmesh.cpp index edb59c0b2..7cf960cb0 100644 --- a/src/core/core-components/qabstractmesh.cpp +++ b/src/core/core-components/qabstractmesh.cpp @@ -66,6 +66,14 @@ QAbstractMeshPrivate::QAbstractMeshPrivate(QAbstractMesh *qq) { } +void QAbstractMeshPrivate::copy(const QNodePrivate *ref) +{ + QNodePrivate::copy(ref); + const QAbstractMeshPrivate *abstractMesh = static_cast<const QAbstractMeshPrivate *>(ref); + m_uuid = abstractMesh->m_uuid; + m_dirty = abstractMesh->m_dirty; +} + QAbstractMesh::QAbstractMesh(QNode *parent) : QComponent(*new QAbstractMeshPrivate(this), parent) @@ -92,7 +100,7 @@ void QAbstractMesh::setDirty(bool dirty) QScenePropertyChangePtr change(new QScenePropertyChange(ComponentUpdated, this)); change->setPropertyName(QByteArrayLiteral("meshFunctor")); change->setValue(QVariant::fromValue(meshFunctor())); - notifyObservers(change); + d->notifyObservers(change); // TO DO see if we can clear the d->m_dirty on request. // This would allow to send a single notification for classes that have several property changes occur // over a single given frame or maybe that's the job of the QChangeArbiter diff --git a/src/core/core-components/qabstractmesh.h b/src/core/core-components/qabstractmesh.h index 68f160789..3a6725ccd 100644 --- a/src/core/core-components/qabstractmesh.h +++ b/src/core/core-components/qabstractmesh.h @@ -43,6 +43,7 @@ #define QT3D_QABSTRACTMESH_H #include <Qt3DCore/qcomponent.h> +#include <QSharedPointer> #include <QUuid> QT_BEGIN_NAMESPACE @@ -76,12 +77,11 @@ public: virtual QAbstractMeshFunctorPtr meshFunctor() const = 0; -Q_SIGNALS: - void sourceChanged(); - protected: - Q_DECLARE_PRIVATE(QAbstractMesh) QAbstractMesh(QAbstractMeshPrivate &dd, QNode *parent = 0); + +private: + Q_DECLARE_PRIVATE(QAbstractMesh) }; } // Qt3D diff --git a/src/core/core-components/qabstractmesh_p.h b/src/core/core-components/qabstractmesh_p.h index caf3249f2..3ef172bee 100644 --- a/src/core/core-components/qabstractmesh_p.h +++ b/src/core/core-components/qabstractmesh_p.h @@ -60,9 +60,11 @@ class QT3DCORESHARED_EXPORT QAbstractMeshPrivate : public QComponentPrivate public: QAbstractMeshPrivate(QAbstractMesh *qq); + virtual void copy(const QNodePrivate *ref) Q_DECL_OVERRIDE; + Q_DECLARE_PUBLIC(QAbstractMesh) - const QUuid m_uuid; + QUuid m_uuid; bool m_dirty; }; diff --git a/src/core/core-components/qabstractrenderpass.cpp b/src/core/core-components/qabstractrenderpass.cpp index 6b4c81f87..6484f1701 100644 --- a/src/core/core-components/qabstractrenderpass.cpp +++ b/src/core/core-components/qabstractrenderpass.cpp @@ -93,7 +93,7 @@ void QAbstractRenderPass::setShaderProgram(QAbstractShader *shaderProgram) QScenePropertyChangePtr e(new QScenePropertyChange(NodeRemoved, this)); e->setPropertyName(QByteArrayLiteral("shaderProgram")); e->setValue(QVariant::fromValue(d->m_shader->uuid())); - notifyObservers(e); + d->notifyObservers(e); } d->m_shader = shaderProgram; @@ -103,14 +103,14 @@ void QAbstractRenderPass::setShaderProgram(QAbstractShader *shaderProgram) // Or not previously added as a child of the current node so that // 1) The backend gets notified about it's creation // 2) When the current node is destroyed, it gets destroyed as well - if (!shaderProgram->parent() || shaderProgram->parent() == this) - QNode::addChild(shaderProgram); + if (!shaderProgram->parent()) + shaderProgram->setParent(this); if (d->m_changeArbiter != Q_NULLPTR) { QScenePropertyChangePtr e(new QScenePropertyChange(NodeAdded, this)); e->setPropertyName(QByteArrayLiteral("shaderProgram")); e->setValue(QVariant::fromValue(shaderProgram->uuid())); - notifyObservers(e); + d->notifyObservers(e); } } } diff --git a/src/core/core-components/qabstractrenderpass_p.h b/src/core/core-components/qabstractrenderpass_p.h index ffc1f75b4..13045de0f 100644 --- a/src/core/core-components/qabstractrenderpass_p.h +++ b/src/core/core-components/qabstractrenderpass_p.h @@ -43,12 +43,12 @@ #define QT3D_QABSTRACTRENDERPASS_P_H #include <private/qnode_p.h> +#include <Qt3DCore/qabstractrenderpass.h> QT_BEGIN_NAMESPACE namespace Qt3D { -class QAbstractRenderPass; class QAbstractShader; class QT3DCORESHARED_EXPORT QAbstractRenderPassPrivate : public QNodePrivate diff --git a/src/core/core-components/qabstracttechnique.cpp b/src/core/core-components/qabstracttechnique.cpp index 12bc2e7a0..d9c9f04b1 100644 --- a/src/core/core-components/qabstracttechnique.cpp +++ b/src/core/core-components/qabstracttechnique.cpp @@ -98,14 +98,14 @@ void QAbstractTechnique::addPass(QAbstractRenderPass *pass) // Or not previously added as a child of the current node so that // 1) The backend gets notified about it's creation // 2) When the current node is destroyed, it gets destroyed as well - if (!pass->parent() || pass->parent() == this) - QNode::addChild(pass); + if (!pass->parent()) + pass->setParent(this); if (d->m_changeArbiter != Q_NULLPTR) { QScenePropertyChangePtr e(new QScenePropertyChange(NodeAdded, this)); e->setPropertyName(QByteArrayLiteral("pass")); e->setValue(QVariant::fromValue(pass)); - notifyObservers(e); + d->notifyObservers(e); } } } @@ -122,7 +122,7 @@ void QAbstractTechnique::removePass(QAbstractRenderPass *pass) QScenePropertyChangePtr e(new QScenePropertyChange(NodeRemoved, this)); e->setPropertyName(QByteArrayLiteral("pass")); e->setValue(QVariant::fromValue(pass->uuid())); - notifyObservers(e); + d->notifyObservers(e); } d->m_renderPasses.removeOne(pass); } diff --git a/src/core/core-components/qcameralens.cpp b/src/core/core-components/qcameralens.cpp index 154ae13b5..aa06ee27d 100644 --- a/src/core/core-components/qcameralens.cpp +++ b/src/core/core-components/qcameralens.cpp @@ -47,16 +47,16 @@ QT_BEGIN_NAMESPACE namespace Qt3D { QCameraLensPrivate::QCameraLensPrivate(QCameraLens *qq) - : QComponentPrivate(qq) - , m_projectionType(QCameraLens::OrthogonalProjection) - , m_nearPlane(0.1f) - , m_farPlane(1024.0f) - , m_fieldOfView(25.0f) - , m_aspectRatio(1.0f) - , m_left(-0.5f) - , m_right(0.5f) - , m_bottom(-0.5f) - , m_top(0.5f) + : QComponentPrivate(qq) + , m_projectionType(QCameraLens::OrthogonalProjection) + , m_nearPlane(0.1f) + , m_farPlane(1024.0f) + , m_fieldOfView(25.0f) + , m_aspectRatio(1.0f) + , m_left(-0.5f) + , m_right(0.5f) + , m_bottom(-0.5f) + , m_top(0.5f) { } @@ -68,23 +68,20 @@ QCameraLens::QCameraLens(QNode *parent) d->updateProjectionMatrix(); } -void QCameraLens::copy(const QNode *ref) +void QCameraLensPrivate::copy(const QNodePrivate *ref) { - Q_D(QCameraLens); - QComponent::copy(ref); - const QCameraLens *lens = qobject_cast<const QCameraLens *>(ref); - if (lens != Q_NULLPTR) { - d->m_projectionType = lens->projectionType(); - d->m_nearPlane = lens->nearPlane(); - d->m_farPlane = lens->farPlane(); - d->m_fieldOfView = lens->fieldOfView(); - d->m_aspectRatio = lens->aspectRatio(); - d->m_left = lens->left(); - d->m_right = lens->right(); - d->m_bottom = lens->bottom(); - d->m_top = lens->top(); - d->updateProjectionMatrix(); - } + QComponentPrivate::copy(ref); + const QCameraLensPrivate *lens = static_cast<const QCameraLensPrivate *>(ref); + m_projectionType = lens->m_projectionType; + m_nearPlane = lens->m_nearPlane; + m_farPlane = lens->m_farPlane; + m_fieldOfView = lens->m_fieldOfView; + m_aspectRatio = lens->m_aspectRatio; + m_left = lens->m_left; + m_right = lens->m_right; + m_bottom = lens->m_bottom; + m_top = lens->m_top; + m_projectionMatrix = lens->m_projectionMatrix; } QCameraLens::QCameraLens(QCameraLensPrivate &dd, QNode *parent) @@ -94,11 +91,10 @@ QCameraLens::QCameraLens(QCameraLensPrivate &dd, QNode *parent) d->updateOrthogonalProjection(); } -QCameraLens *QCameraLens::doClone(bool isClone) const +QCameraLens *QCameraLens::doClone() const { QCameraLens *clone = new QCameraLens(); - clone->copy(this); - clone->d_func()->m_isClone = isClone; + clone->d_func()->copy(d_func()); return clone; } @@ -119,8 +115,8 @@ QCameraLens::ProjectionType QCameraLens::projectionType() const } void QCameraLens::setOrthographicProjection( float left, float right, - float bottom, float top, - float nearPlane, float farPlane ) + float bottom, float top, + float nearPlane, float farPlane ) { Q_D(QCameraLens); d->m_left = left; @@ -134,7 +130,7 @@ void QCameraLens::setOrthographicProjection( float left, float right, } void QCameraLens::setPerspectiveProjection( float fieldOfView, float aspectRatio, - float nearPlane, float farPlane ) + float nearPlane, float farPlane ) { Q_D(QCameraLens); d->m_fieldOfView = fieldOfView; diff --git a/src/core/core-components/qcameralens.h b/src/core/core-components/qcameralens.h index 25399c49f..f6a5e4f4c 100644 --- a/src/core/core-components/qcameralens.h +++ b/src/core/core-components/qcameralens.h @@ -74,8 +74,6 @@ class QT3DCORESHARED_EXPORT QCameraLens : public QComponent public: explicit QCameraLens(QNode *parent = 0); - void copy(const QNode *ref) Q_DECL_OVERRIDE; - enum ProjectionType { OrthogonalProjection, PerspectiveProjection @@ -131,9 +129,11 @@ Q_SIGNALS: void projectionMatrixChanged(); protected: - Q_DECLARE_PRIVATE(QCameraLens) QCameraLens(QCameraLensPrivate &dd, QNode *parent = 0); - QCameraLens *doClone(bool isClone = true) const Q_DECL_OVERRIDE; + +private: + Q_DECLARE_PRIVATE(QCameraLens) + QCameraLens *doClone() const Q_DECL_OVERRIDE; }; } // Qt3D diff --git a/src/core/core-components/qcameralens_p.h b/src/core/core-components/qcameralens_p.h index 9a3fa6f42..c92279445 100644 --- a/src/core/core-components/qcameralens_p.h +++ b/src/core/core-components/qcameralens_p.h @@ -58,6 +58,8 @@ class QT3DCORESHARED_EXPORT QCameraLensPrivate : public QComponentPrivate public: QCameraLensPrivate(QCameraLens *qq); + void copy(const QNodePrivate *ref) Q_DECL_OVERRIDE; + inline void updateProjectionMatrix() { switch (m_projectionType) { @@ -78,7 +80,7 @@ public: QScenePropertyChangePtr propertyChange(new QScenePropertyChange(ComponentUpdated, q)); propertyChange->setPropertyName(QByteArrayLiteral("projectionMatrix")); propertyChange->setValue(QVariant::fromValue(m_projectionMatrix)); - q->notifyObservers(propertyChange); + QNodePrivate::notifyObservers(propertyChange); } } |