diff options
Diffstat (limited to 'src/core')
127 files changed, 2367 insertions, 8719 deletions
diff --git a/src/core/aspects/qabstractaspect.cpp b/src/core/aspects/qabstractaspect.cpp index 824434ce6..3217d10b3 100644 --- a/src/core/aspects/qabstractaspect.cpp +++ b/src/core/aspects/qabstractaspect.cpp @@ -45,16 +45,10 @@ #include <Qt3DCore/qcomponent.h> #include <Qt3DCore/qentity.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/qpropertyvalueaddedchange.h> -#include <Qt3DCore/qpropertyvalueremovedchange.h> -#include <Qt3DCore/qcomponentaddedchange.h> -#include <Qt3DCore/qcomponentremovedchange.h> #include <Qt3DCore/private/corelogging_p.h> #include <Qt3DCore/private/qaspectjobmanager_p.h> #include <Qt3DCore/private/qaspectmanager_p.h> -#include <Qt3DCore/private/qchangearbiter_p.h> #include <Qt3DCore/private/qnodevisitor_p.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qscene_p.h> @@ -180,14 +174,7 @@ QNodeId QAbstractAspect::rootEntityId() const Q_DECL_NOEXCEPT void QAbstractAspect::registerBackendType(const QMetaObject &obj, const QBackendNodeMapperPtr &functor) { Q_D(QAbstractAspect); - d->m_backendCreatorFunctors.insert(&obj, {functor, QAbstractAspectPrivate::DefaultMapper}); -} - -void QAbstractAspect::registerBackendType(const QMetaObject &obj, const QBackendNodeMapperPtr &functor, bool supportsSyncing) -{ - Q_D(QAbstractAspect); - const auto f = supportsSyncing ? QAbstractAspectPrivate::SupportsSyncing : QAbstractAspectPrivate::DefaultMapper; - d->m_backendCreatorFunctors.insert(&obj, {functor, f}); + d->m_backendCreatorFunctors.insert(&obj, functor); } void QAbstractAspect::unregisterBackendType(const QMetaObject &obj) @@ -208,24 +195,23 @@ QVector<QAspectJobPtr> QAbstractAspect::jobsToExecute(qint64 time) return QVector<QAspectJobPtr>(); } -QAbstractAspectPrivate::BackendNodeMapperAndInfo QAbstractAspectPrivate::mapperForNode(const QMetaObject *metaObj) const +QBackendNodeMapperPtr QAbstractAspectPrivate::mapperForNode(const QMetaObject *metaObj) const { Q_ASSERT(metaObj); - BackendNodeMapperAndInfo info; + QBackendNodeMapperPtr mapper; - while (metaObj != nullptr && info.first.isNull()) { - info = m_backendCreatorFunctors.value(metaObj); + while (metaObj != nullptr && mapper.isNull()) { + mapper = m_backendCreatorFunctors.value(metaObj); metaObj = metaObj->superClass(); } - return info; + return mapper; } void QAbstractAspectPrivate::syncDirtyFrontEndNodes(const QVector<QNode *> &nodes) { for (auto node: qAsConst(nodes)) { const QMetaObject *metaObj = QNodePrivate::get(node)->m_typeInfo; - const BackendNodeMapperAndInfo backendNodeMapperInfo = mapperForNode(metaObj); - const QBackendNodeMapperPtr backendNodeMapper = backendNodeMapperInfo.first; + const QBackendNodeMapperPtr backendNodeMapper = mapperForNode(metaObj); if (!backendNodeMapper) continue; @@ -234,168 +220,53 @@ void QAbstractAspectPrivate::syncDirtyFrontEndNodes(const QVector<QNode *> &node if (!backend) continue; - const bool supportsSyncing = backendNodeMapperInfo.second & SupportsSyncing; - if (supportsSyncing) - syncDirtyFrontEndNode(node, backend, false); - else - sendPropertyMessages(node, backend); + syncDirtyFrontEndNode(node, backend, false); } } -void QAbstractAspectPrivate::syncDirtyFrontEndSubNodes(const QVector<NodeRelationshipChange> &nodes) +void QAbstractAspectPrivate::syncDirtyFrontEndNode(QNode *node, QBackendNode *backend, bool firstTime) const { - for (const auto &nodeChange: qAsConst(nodes)) { - auto getBackend = [this](QNode *node) -> std::tuple<QBackendNode *, bool> { - const QMetaObject *metaObj = QNodePrivate::get(node)->m_typeInfo; - const BackendNodeMapperAndInfo backendNodeMapperInfo = mapperForNode(metaObj); - const QBackendNodeMapperPtr backendNodeMapper = backendNodeMapperInfo.first; - - if (!backendNodeMapper) - return {}; + backend->syncFromFrontEnd(node, firstTime); +} - QBackendNode *backend = backendNodeMapper->get(node->id()); - if (!backend) - return {}; +void QAbstractAspectPrivate::syncDirtyEntityComponentNodes(const QVector<ComponentRelationshipChange> &changes) +{ + auto getBackend = [this] (QNode *node) -> QBackendNode* { + const QMetaObject *metaObj = QNodePrivate::get(node)->m_typeInfo; + const QBackendNodeMapperPtr backendNodeMapper = mapperForNode(metaObj); - const bool supportsSyncing = backendNodeMapperInfo.second & SupportsSyncing; + if (!backendNodeMapper) + return nullptr; - return std::tuple<QBackendNode *, bool>(backend, supportsSyncing); - }; + return backendNodeMapper->get(node->id()); + }; - auto nodeInfo = getBackend(nodeChange.node); - if (!std::get<0>(nodeInfo)) + for (const auto &change: qAsConst(changes)) { + auto entityBackend = getBackend(change.node); + if (!entityBackend) continue; - auto subNodeInfo = getBackend(nodeChange.subNode); - if (!std::get<0>(subNodeInfo)) + auto componentBackend = getBackend(change.subNode); + if (!componentBackend) continue; - switch (nodeChange.change) { - case PropertyValueAdded: { - if (std::get<1>(nodeInfo)) - break; // do nothing as the node will be dirty anyway - - QPropertyValueAddedChange change(nodeChange.node->id()); - change.setPropertyName(nodeChange.property); - change.setAddedValue(QVariant::fromValue(nodeChange.subNode->id())); - QPropertyValueAddedChangePtr pChange(&change, [](QPropertyValueAddedChange *) { }); - std::get<0>(nodeInfo)->sceneChangeEvent(pChange); - } - break; - case PropertyValueRemoved: { - if (std::get<1>(nodeInfo)) - break; // do nothing as the node will be dirty anyway - - QPropertyValueRemovedChange change(nodeChange.node->id()); - change.setPropertyName(nodeChange.property); - change.setRemovedValue(QVariant::fromValue(nodeChange.subNode->id())); - QPropertyValueRemovedChangePtr pChange(&change, [](QPropertyValueRemovedChange *) { }); - std::get<0>(nodeInfo)->sceneChangeEvent(pChange); - } - break; - case ComponentAdded: { - // let the entity know it has a new component - if (std::get<1>(nodeInfo)) { - QBackendNodePrivate::get(std::get<0>(nodeInfo))->componentAdded(nodeChange.subNode); - } else { - QComponentAddedChange change(qobject_cast<Qt3DCore::QComponent *>(nodeChange.subNode), qobject_cast<Qt3DCore::QEntity *>(nodeChange.node)); - QComponentAddedChangePtr pChange(&change, [](QComponentAddedChange *) { }); - std::get<0>(nodeInfo)->sceneChangeEvent(pChange); - } - - // let the component know it was added to an entity - if (std::get<1>(subNodeInfo)) { - QBackendNodePrivate::get(std::get<0>(subNodeInfo))->addedToEntity(nodeChange.node); - } else { - QComponentAddedChange change(qobject_cast<Qt3DCore::QComponent *>(nodeChange.subNode), qobject_cast<Qt3DCore::QEntity *>(nodeChange.node)); - QComponentAddedChangePtr pChange(&change, [](QComponentAddedChange *) { }); - std::get<0>(subNodeInfo)->sceneChangeEvent(pChange); - } - } - break; - case ComponentRemoved: { - // let the entity know a component was removed - if (std::get<1>(nodeInfo)) { - QBackendNodePrivate::get(std::get<0>(nodeInfo))->componentRemoved(nodeChange.subNode); - } else { - QComponentRemovedChange change(qobject_cast<Qt3DCore::QComponent *>(nodeChange.subNode), qobject_cast<Qt3DCore::QEntity *>(nodeChange.node)); - QComponentRemovedChangePtr pChange(&change, [](QComponentRemovedChange *) { }); - std::get<0>(nodeInfo)->sceneChangeEvent(pChange); - } - - // let the component know it was removed from an entity - if (std::get<1>(subNodeInfo)) { - QBackendNodePrivate::get(std::get<0>(subNodeInfo))->removedFromEntity(nodeChange.node); - } else { - QComponentRemovedChange change(qobject_cast<Qt3DCore::QEntity *>(nodeChange.node), qobject_cast<Qt3DCore::QComponent *>(nodeChange.subNode)); - QComponentRemovedChangePtr pChange(&change, [](QComponentRemovedChange *) { }); - std::get<0>(nodeInfo)->sceneChangeEvent(pChange); - } - } - break; - default: + switch (change.change) { + case ComponentRelationshipChange::Added: + QBackendNodePrivate::get(entityBackend)->componentAdded(change.subNode); + QBackendNodePrivate::get(componentBackend)->addedToEntity(change.node); + break; + case ComponentRelationshipChange::Removed: + QBackendNodePrivate::get(entityBackend)->componentRemoved(change.subNode); + QBackendNodePrivate::get(componentBackend)->removedFromEntity(change.node); break; } } } -void QAbstractAspectPrivate::syncDirtyFrontEndNode(QNode *node, QBackendNode *backend, bool firstTime) const -{ - Q_ASSERT(false); // overload in derived class - if (!firstTime) - sendPropertyMessages(node, backend); -} - -void QAbstractAspectPrivate::sendPropertyMessages(QNode *node, QBackendNode *backend) const -{ - const int offset = QNode::staticMetaObject.propertyOffset(); - const auto metaObj = node->metaObject(); - const int count = metaObj->propertyCount(); - - const auto toBackendValue = [](const QVariant &data) -> QVariant - { - if (data.canConvert<QNode*>()) { - QNode *node = data.value<QNode*>(); - - // Ensure the node and all ancestors have issued their node creation changes. - // We can end up here if a newly created node with a parent is immediately set - // as a property on another node. In this case the deferred call to - // _q_postConstructorInit() will not have happened yet as the event - // loop will still be blocked. We need to do this for all ancestors, - // since the subtree of this node otherwise can end up on the backend - // with a reference to a non-existent parent. - if (node) - QNodePrivate::get(node)->_q_ensureBackendNodeCreated(); - - const QNodeId id = node ? node->id() : QNodeId(); - return QVariant::fromValue(id); - } - - return data; - }; - - QPropertyUpdatedChange change(node->id()); - QPropertyUpdatedChangePtr pchange(&change, [](QPropertyUpdatedChange *) { }); - for (int index = offset; index < count; index++) { - const QMetaProperty pro = metaObj->property(index); - change.setPropertyName(pro.name()); - change.setValue(toBackendValue(pro.read(node))); - backend->sceneChangeEvent(pchange); - } - - auto const dynamicProperties = node->dynamicPropertyNames(); - for (const QByteArray &name: dynamicProperties) { - change.setPropertyName(name.data()); - change.setValue(toBackendValue(node->property(name.data()))); - backend->sceneChangeEvent(pchange); - } -} - QBackendNode *QAbstractAspectPrivate::createBackendNode(const NodeTreeChange &change) const { const QMetaObject *metaObj = change.metaObj; - const BackendNodeMapperAndInfo backendNodeMapperInfo = mapperForNode(metaObj); - const QBackendNodeMapperPtr backendNodeMapper = backendNodeMapperInfo.first; + const QBackendNodeMapperPtr backendNodeMapper = mapperForNode(metaObj); if (!backendNodeMapper) return nullptr; @@ -405,23 +276,14 @@ QBackendNode *QAbstractAspectPrivate::createBackendNode(const NodeTreeChange &ch return backend; QNode *node = change.node; - QNodeCreatedChangeBasePtr creationChange; - const bool supportsSyncing = backendNodeMapperInfo.second & SupportsSyncing; - if (supportsSyncing) { - // All objects modified to use syncing should only use the id in the creation functor - QNodeCreatedChangeBase changeObj(node); - creationChange = QNodeCreatedChangeBasePtr(&changeObj, [](QNodeCreatedChangeBase *) {}); - backend = backendNodeMapper->create(creationChange); - } else { - creationChange = node->createNodeCreationChange(); - backend = backendNodeMapper->create(creationChange); - } + QNodeId nodeId = qIdForNode(node); + backend = backendNodeMapper->create(nodeId); if (!backend) return nullptr; // TODO: Find some place else to do all of this function from the arbiter - backend->setPeerId(change.id); + backend->setPeerId(nodeId); // Backend could be null if the user decides that his functor should only // perform some action when encountering a given type of item but doesn't need to @@ -430,20 +292,7 @@ QBackendNode *QAbstractAspectPrivate::createBackendNode(const NodeTreeChange &ch QBackendNodePrivate *backendPriv = QBackendNodePrivate::get(backend); backendPriv->setEnabled(node->isEnabled()); - // TO DO: Find a way to specify the changes to observe - // Register backendNode with QChangeArbiter - if (m_arbiter != nullptr) { // Unit tests may not have the arbiter registered - qCDebug(Nodes) << q_func()->objectName() << "Creating backend node for node id" - << node->id() << "of type" << QNodePrivate::get(node)->m_typeInfo->className(); - m_arbiter->registerObserver(backendPriv, backend->peerId(), AllChanges); - if (backend->mode() == QBackendNode::ReadWrite) - m_arbiter->scene()->addObservable(backendPriv, backend->peerId()); - } - - if (supportsSyncing) - syncDirtyFrontEndNode(node, backend, true); - else - backend->initializeFromPeer(creationChange); + syncDirtyFrontEndNode(node, backend, true); return backend; } @@ -451,23 +300,12 @@ QBackendNode *QAbstractAspectPrivate::createBackendNode(const NodeTreeChange &ch void QAbstractAspectPrivate::clearBackendNode(const NodeTreeChange &change) const { const QMetaObject *metaObj = change.metaObj; - const BackendNodeMapperAndInfo backendNodeMapperInfo = mapperForNode(metaObj); - const QBackendNodeMapperPtr backendNodeMapper = backendNodeMapperInfo.first; + const QBackendNodeMapperPtr backendNodeMapper = mapperForNode(metaObj); if (!backendNodeMapper) return; - // Request the mapper to destroy the corresponding backend node - QBackendNode *backend = backendNodeMapper->get(change.id); - if (backend) { - qCDebug(Nodes) << "Deleting backend node for node id" - << change.id << "of type" << metaObj->className(); - QBackendNodePrivate *backendPriv = QBackendNodePrivate::get(backend); - m_arbiter->unregisterObserver(backendPriv, backend->peerId()); - if (backend->mode() == QBackendNode::ReadWrite) - m_arbiter->scene()->removeObservable(backendPriv, backend->peerId()); - backendNodeMapper->destroy(change.id); - } + backendNodeMapper->destroy(change.id); } void QAbstractAspectPrivate::setRootAndCreateNodes(QEntity *rootObject, const QVector<NodeTreeChange> &nodesChanges) @@ -555,6 +393,28 @@ void QAbstractAspect::onEngineShutdown() { } +/*! + * Called in the main thread once all the jobs have been executed. + * + * \note This is called after QAspectJob::postFrame is called on every jobs. + * + * \sa QAspectJob::postFrame + */ +void QAbstractAspect::jobsDone() +{ + Q_D(QAbstractAspect); + d->jobsDone(); +} + +/*! + * Called in the main thread when the frame processing is complete. + */ +void QAbstractAspect::frameDone() +{ + Q_D(QAbstractAspect); + d->frameDone(); +} + void QAbstractAspect::scheduleSingleShotJob(const Qt3DCore::QAspectJobPtr &job) { Q_D(QAbstractAspect); @@ -562,6 +422,11 @@ void QAbstractAspect::scheduleSingleShotJob(const Qt3DCore::QAspectJobPtr &job) d->m_singleShotJobs.push_back(job); } +QStringList QAbstractAspect::dependencies() const +{ + return {}; +} + namespace Debug { AsynchronousCommandReply::AsynchronousCommandReply(const QString &commandName, QObject *parent) diff --git a/src/core/aspects/qabstractaspect.h b/src/core/aspects/qabstractaspect.h index 3b2f31c50..144f267cf 100644 --- a/src/core/aspects/qabstractaspect.h +++ b/src/core/aspects/qabstractaspect.h @@ -42,7 +42,6 @@ #include <Qt3DCore/qt3dcore_global.h> #include <Qt3DCore/qnodeid.h> -#include <Qt3DCore/qscenechange.h> #include <QtCore/QObject> #include <QtCore/QSharedPointer> @@ -70,6 +69,7 @@ public: ~QAbstractAspect(); void scheduleSingleShotJob(const Qt3DCore::QAspectJobPtr &job); + virtual QStringList dependencies() const; protected: explicit QAbstractAspect(QAbstractAspectPrivate &dd, QObject *parent = nullptr); @@ -78,10 +78,7 @@ protected: template<class Frontend> void registerBackendType(const QBackendNodeMapperPtr &functor); - template<class Frontend, bool supportsSyncing> - void registerBackendType(const QBackendNodeMapperPtr &functor); void registerBackendType(const QMetaObject &obj, const QBackendNodeMapperPtr &functor); - void registerBackendType(const QMetaObject &obj, const QBackendNodeMapperPtr &functor, bool supportsSyncing); template<class Frontend> void unregisterBackendType(); void unregisterBackendType(const QMetaObject &); @@ -97,9 +94,13 @@ private: virtual void onEngineStartup(); virtual void onEngineShutdown(); + virtual void jobsDone(); + virtual void frameDone(); + Q_DECLARE_PRIVATE(QAbstractAspect) friend class QAspectEngine; friend class QAspectManager; + friend class QScheduler; }; template<class Frontend> @@ -108,12 +109,6 @@ void QAbstractAspect::registerBackendType(const QBackendNodeMapperPtr &functor) registerBackendType(Frontend::staticMetaObject, functor); } -template<class Frontend, bool supportsSyncing> -void QAbstractAspect::registerBackendType(const QBackendNodeMapperPtr &functor) -{ - registerBackendType(Frontend::staticMetaObject, functor, supportsSyncing); -} - template<class Frontend> void QAbstractAspect::unregisterBackendType() { @@ -128,7 +123,6 @@ QT_END_NAMESPACE QT_BEGIN_NAMESPACE \ namespace Qt3DCore { \ typedef QAbstractAspect *(*AspectCreateFunction)(QObject *); \ - QT_DEPRECATED Q_3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QString &, const QMetaObject *, AspectCreateFunction); \ Q_3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QLatin1String &, const QMetaObject *, AspectCreateFunction); \ } \ QT_END_NAMESPACE \ diff --git a/src/core/aspects/qabstractaspect_p.h b/src/core/aspects/qabstractaspect_p.h index dd13ac5bf..eed85433f 100644 --- a/src/core/aspects/qabstractaspect_p.h +++ b/src/core/aspects/qabstractaspect_p.h @@ -52,12 +52,11 @@ // #include <Qt3DCore/qabstractaspect.h> -#include <Qt3DCore/qnodedestroyedchange.h> #include <Qt3DCore/private/qaspectjobproviderinterface_p.h> #include <Qt3DCore/private/qbackendnode_p.h> #include <Qt3DCore/private/qt3dcore_global_p.h> -#include <Qt3DCore/private/qscenechange_p.h> +#include <Qt3DCore/private/qchangearbiter_p.h> #include <QtCore/private/qobject_p.h> #include <QMutex> @@ -72,7 +71,6 @@ class QBackendNode; class QEntity; class QAspectManager; class QAbstractAspectJobManager; -class QChangeArbiter; class QServiceLocator; namespace Debug { @@ -133,7 +131,7 @@ public: QBackendNode *createBackendNode(const NodeTreeChange &change) const; void clearBackendNode(const NodeTreeChange &change) const; void syncDirtyFrontEndNodes(const QVector<QNode *> &nodes); - void syncDirtyFrontEndSubNodes(const QVector<NodeRelationshipChange> &nodes); + void syncDirtyEntityComponentNodes(const QVector<ComponentRelationshipChange> &nodes); virtual void syncDirtyFrontEndNode(QNode *node, QBackendNode *backend, bool firstTime) const; void sendPropertyMessages(QNode *node, QBackendNode *backend) const; @@ -146,19 +144,14 @@ public: Q_DECLARE_PUBLIC(QAbstractAspect) - enum NodeMapperInfo { - DefaultMapper = 0, - SupportsSyncing = 1 << 0 - }; - using BackendNodeMapperAndInfo = QPair<QBackendNodeMapperPtr, NodeMapperInfo>; - BackendNodeMapperAndInfo mapperForNode(const QMetaObject *metaObj) const; + QBackendNodeMapperPtr mapperForNode(const QMetaObject *metaObj) const; QEntity *m_root; QNodeId m_rootId; QAspectManager *m_aspectManager; QAbstractAspectJobManager *m_jobManager; QChangeArbiter *m_arbiter; - QHash<const QMetaObject*, BackendNodeMapperAndInfo> m_backendCreatorFunctors; + QHash<const QMetaObject*, QBackendNodeMapperPtr> m_backendCreatorFunctors; QMutex m_singleShotMutex; QVector<QAspectJobPtr> m_singleShotJobs; diff --git a/src/core/aspects/qaspectengine.cpp b/src/core/aspects/qaspectengine.cpp index e52435eed..8ede0905d 100644 --- a/src/core/aspects/qaspectengine.cpp +++ b/src/core/aspects/qaspectengine.cpp @@ -52,7 +52,6 @@ #include <Qt3DCore/private/qeventfilterservice_p.h> #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qnodevisitor_p.h> -#include <Qt3DCore/private/qpostman_p.h> #include <Qt3DCore/private/qscene_p.h> #include <Qt3DCore/private/qservicelocator_p.h> #include <Qt3DCore/private/qsysteminformationservice_p.h> @@ -115,17 +114,14 @@ QAspectEnginePrivate *QAspectEnginePrivate::get(QAspectEngine *q) QAspectEnginePrivate::QAspectEnginePrivate() : QObjectPrivate() , m_aspectManager(nullptr) - , m_postman(nullptr) , m_scene(nullptr) , m_initialized(false) , m_runMode(QAspectEngine::Automatic) { qRegisterMetaType<Qt3DCore::QAbstractAspect *>(); - qRegisterMetaType<Qt3DCore::QObserverInterface *>(); qRegisterMetaType<Qt3DCore::QNode *>(); qRegisterMetaType<Qt3DCore::QEntity *>(); qRegisterMetaType<Qt3DCore::QScene *>(); - qRegisterMetaType<Qt3DCore::QAbstractPostman *>(); } QAspectEnginePrivate::~QAspectEnginePrivate() @@ -226,8 +222,6 @@ QAspectEngine::QAspectEngine(QObject *parent) qCDebug(Aspects) << Q_FUNC_INFO; Q_D(QAspectEngine); d->m_scene = new QScene(this); - d->m_postman = new QPostman(this); - d->m_postman->setScene(d->m_scene); d->m_aspectManager = new QAspectManager(this); } @@ -248,7 +242,6 @@ QAspectEngine::~QAspectEngine() for (auto aspect : aspects) unregisterAspect(aspect); - delete d->m_postman; delete d->m_scene; } @@ -265,8 +258,6 @@ void QAspectEnginePrivate::initialize() m_aspectManager->initialize(); QChangeArbiter *arbiter = m_aspectManager->changeArbiter(); m_scene->setArbiter(arbiter); - QChangeArbiter::createUnmanagedThreadLocalChangeQueue(arbiter); - arbiter->setPostman(m_postman); arbiter->setScene(m_scene); m_initialized = true; m_aspectManager->setPostConstructorInit(m_scene->postConstructorInit()); @@ -283,19 +274,12 @@ void QAspectEnginePrivate::shutdown() { qCDebug(Aspects) << Q_FUNC_INFO; - // Flush any change batch waiting in the postman that may contain node - // destruction changes that the aspects should process before we exit - // the simulation loop - m_postman->submitChangeBatch(); - // Exit the simulation loop. Waits for this to be completed on the aspect // thread before returning exitSimulationLoop(); // Cleanup the scene before quitting the backend m_scene->setArbiter(nullptr); - QChangeArbiter *arbiter = m_aspectManager->changeArbiter(); - QChangeArbiter::destroyUnmanagedThreadLocalChangeQueue(arbiter); m_initialized = false; } @@ -312,10 +296,13 @@ void QAspectEnginePrivate::exitSimulationLoop() void QAspectEngine::registerAspect(QAbstractAspect *aspect) { Q_D(QAspectEngine); - // The aspect is moved to the AspectThread - // AspectManager::registerAspect is called in the context - // of the AspectThread. This is turns call aspect->onInitialize - // still in the same AspectThread context + + const QStringList dependencies = aspect->dependencies(); + for (const auto &name: dependencies) { + if (!d->m_namedAspects.contains(name)) + registerAspect(name); + } + d->m_aspects << aspect; d->m_aspectManager->registerAspect(aspect); } @@ -394,6 +381,17 @@ QVector<QAbstractAspect *> QAspectEngine::aspects() const } /*! + * \return the asepect matching the \a name + * + * \note Required that the aspect was registered by name + */ +QAbstractAspect *QAspectEngine::aspect(const QString &name) const +{ + Q_D(const QAspectEngine); + return d->m_namedAspects.value(name, nullptr); +} + +/*! * Executes the given \a command on aspect engine. Valid commands are: * \list * \li "list aspects" @@ -441,6 +439,18 @@ void QAspectEngine::processFrame() d->m_aspectManager->processFrame(); } +QNode *QAspectEngine::lookupNode(QNodeId id) const +{ + Q_D(const QAspectEngine); + return d->m_scene ? d->m_scene->lookupNode(id) : nullptr; +} + +QVector<QNode *> QAspectEngine::lookupNodes(const QVector<QNodeId> &ids) const +{ + Q_D(const QAspectEngine); + return d->m_scene ? d->m_scene->lookupNodes(ids) : QVector<QNode *>{}; +} + /*! * Sets the \a root entity for the aspect engine. */ diff --git a/src/core/aspects/qaspectengine.h b/src/core/aspects/qaspectengine.h index 1d5d7e220..71662a27e 100644 --- a/src/core/aspects/qaspectengine.h +++ b/src/core/aspects/qaspectengine.h @@ -41,6 +41,7 @@ #define QT3DCORE_QASPECTENGINE_H #include <Qt3DCore/qt3dcore_global.h> +#include <Qt3DCore/qnodeid.h> #include <QtCore/QObject> #include <QtCore/QVector> @@ -81,11 +82,15 @@ public: void unregisterAspect(const QString &name); QVector<QAbstractAspect*> aspects() const; + QAbstractAspect *aspect(const QString &name) const; QVariant executeCommand(const QString &command); void processFrame(); + QNode *lookupNode(QNodeId id) const; + QVector<QNode *> lookupNodes(const QVector<QNodeId> &ids) const; + private: Q_DECLARE_PRIVATE(QAspectEngine) }; diff --git a/src/core/aspects/qaspectengine_p.h b/src/core/aspects/qaspectengine_p.h index 8f3abcd38..47a756511 100644 --- a/src/core/aspects/qaspectengine_p.h +++ b/src/core/aspects/qaspectengine_p.h @@ -52,7 +52,6 @@ // #include <Qt3DCore/private/qt3dcore_global_p.h> -#include <Qt3DCore/qnodecreatedchange.h> #include <QtCore/qsharedpointer.h> #include <Qt3DCore/private/qaspectfactory_p.h> @@ -66,7 +65,6 @@ namespace Qt3DCore { class QEntity; class QNode; class QAspectManager; -class QPostman; class QScene; class Q_3DCORE_PRIVATE_EXPORT QAspectEnginePrivate : public QObjectPrivate @@ -79,7 +77,6 @@ public: QAspectFactory m_factory; QAspectManager *m_aspectManager; - QPostman *m_postman; QScene *m_scene; QSharedPointer<QEntity> m_root; QVector<QAbstractAspect*> m_aspects; diff --git a/src/core/aspects/qaspectfactory.cpp b/src/core/aspects/qaspectfactory.cpp index 2f1530257..5528a9966 100644 --- a/src/core/aspects/qaspectfactory.cpp +++ b/src/core/aspects/qaspectfactory.cpp @@ -60,15 +60,6 @@ Q_3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QLatin1St defaultAspectNames->insert(metaObject, name); } -Q_3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QString &name, - const QMetaObject *metaObject, - QAspectFactory::CreateFunction factory) -{ - return qt3d_QAspectFactory_addDefaultFactory(QLatin1String(name.toLatin1()), - metaObject, - factory); -} - QAspectFactory::QAspectFactory() : m_factories(*defaultFactories), m_aspectNames(*defaultAspectNames) diff --git a/src/core/aspects/qaspectmanager.cpp b/src/core/aspects/qaspectmanager.cpp index 66475c615..a327ddaf8 100644 --- a/src/core/aspects/qaspectmanager.cpp +++ b/src/core/aspects/qaspectmanager.cpp @@ -51,6 +51,7 @@ #include <Qt3DCore/private/qabstractaspect_p.h> #include <Qt3DCore/private/qabstractaspectjobmanager_p.h> #include <Qt3DCore/private/qabstractframeadvanceservice_p.h> +#include <Qt3DCore/private/qaspectengine_p.h> // TODO Make the kind of job manager configurable (e.g. ThreadWeaver vs Intel TBB) #include <Qt3DCore/private/qaspectjobmanager_p.h> #include <Qt3DCore/private/qaspectjob_p.h> @@ -66,7 +67,9 @@ #include <Qt3DCore/private/qscene_p.h> #include <QtCore/QCoreApplication> +#if QT_CONFIG(animation) #include <QtCore/QAbstractAnimation> +#endif QT_BEGIN_NAMESPACE @@ -218,9 +221,6 @@ void QAspectManager::exitSimulationLoop() for (QAbstractAspect *aspect : qAsConst(m_aspects)) aspect->d_func()->onEngineAboutToShutdown(); - // Process any pending changes from the frontend before we shut the aspects down - m_changeArbiter->syncChanges(); - // Give aspects a chance to perform any shutdown actions. This may include unqueuing // any blocking work on the main thread that could potentially deadlock during shutdown. qCDebug(Aspects) << "Calling onEngineShutdown() for each aspect"; @@ -250,7 +250,6 @@ void QAspectManager::initialize() qCDebug(Aspects) << Q_FUNC_INFO; m_jobManager->initialize(); m_scheduler->setAspectManager(this); - m_changeArbiter->initialize(m_jobManager); } /*! @@ -397,6 +396,12 @@ const QVector<QAbstractAspect *> &QAspectManager::aspects() const return m_aspects; } +QAbstractAspect *QAspectManager::aspect(const QString &name) const +{ + auto dengine = QAspectEnginePrivate::get(m_engine); + return dengine->m_namedAspects.value(name, nullptr); +} + QAbstractAspectJobManager *QAspectManager::jobManager() const { return m_jobManager; @@ -523,21 +528,16 @@ void QAspectManager::processFrame() } // Sync node / subnode relationship changes - const auto dirtySubNodes = m_changeArbiter->takeDirtyFrontEndSubNodes(); + const auto dirtySubNodes = m_changeArbiter->takeDirtyEntityComponentNodes(); if (dirtySubNodes.size()) for (QAbstractAspect *aspect : qAsConst(m_aspects)) - QAbstractAspectPrivate::get(aspect)->syncDirtyFrontEndSubNodes(dirtySubNodes); + QAbstractAspectPrivate::get(aspect)->syncDirtyEntityComponentNodes(dirtySubNodes); // Sync property updates const auto dirtyFrontEndNodes = m_changeArbiter->takeDirtyFrontEndNodes(); if (dirtyFrontEndNodes.size()) for (QAbstractAspect *aspect : qAsConst(m_aspects)) QAbstractAspectPrivate::get(aspect)->syncDirtyFrontEndNodes(dirtyFrontEndNodes); - - // TO DO: Having this done in the main thread actually means aspects could just - // as simply read info out of the Frontend classes without risk of introducing - // races. This could therefore be removed for Qt 6. - m_changeArbiter->syncChanges(); } // For each Aspect @@ -548,7 +548,7 @@ void QAspectManager::processFrame() // Tell the aspect the frame is complete (except rendering) for (QAbstractAspect *aspect : qAsConst(m_aspects)) - QAbstractAspectPrivate::get(aspect)->frameDone(); + aspect->frameDone(); } } // namespace Qt3DCore diff --git a/src/core/aspects/qaspectmanager_p.h b/src/core/aspects/qaspectmanager_p.h index e3d978ee2..9633149f6 100644 --- a/src/core/aspects/qaspectmanager_p.h +++ b/src/core/aspects/qaspectmanager_p.h @@ -51,8 +51,8 @@ // We mean it. // -#include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/qaspectengine.h> +#include <Qt3DCore/qnodeid.h> #include <QtCore/QObject> #include <QtCore/QScopedPointer> #include <QtCore/QSemaphore> @@ -88,6 +88,9 @@ public: explicit QAspectManager(QAspectEngine *parent = nullptr); ~QAspectManager(); + QAspectEngine * engine() const { return m_engine; } + QScheduler *scheduler() const { return m_scheduler; } + void setRunMode(QAspectEngine::RunMode mode); void enterSimulationLoop(); void exitSimulationLoop(); @@ -107,6 +110,7 @@ public Q_SLOTS: public: const QVector<QAbstractAspect *> &aspects() const; + QAbstractAspect *aspect(const QString &name) const; QAbstractAspectJobManager *jobManager() const; QChangeArbiter *changeArbiter() const; QServiceLocator *serviceLocator() const; diff --git a/src/core/changes/changes.pri b/src/core/changes/changes.pri deleted file mode 100644 index 39c6a4022..000000000 --- a/src/core/changes/changes.pri +++ /dev/null @@ -1,63 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += \ - $$PWD/qscenechange.h \ - $$PWD/qscenechange_p.h \ - $$PWD/qnodecreatedchange_p.h \ - $$PWD/qnodecreatedchange.h \ - $$PWD/qcomponentaddedchange.h \ - $$PWD/qcomponentaddedchange_p.h \ - $$PWD/qcomponentremovedchange.h \ - $$PWD/qcomponentremovedchange_p.h \ - $$PWD/qnodedestroyedchange.h \ - $$PWD/qnodedestroyedchange_p.h \ - $$PWD/qpropertyvalueaddedchangebase.h \ - $$PWD/qpropertyvalueaddedchangebase_p.h \ - $$PWD/qpropertyvalueremovedchangebase.h \ - $$PWD/qpropertyvalueremovedchangebase_p.h \ - $$PWD/qpropertyupdatedchangebase.h \ - $$PWD/qpropertyupdatedchangebase_p.h \ - $$PWD/qdynamicpropertyupdatedchange_p.h \ - $$PWD/qdynamicpropertyupdatedchange.h \ - $$PWD/qstaticpropertyupdatedchangebase.h \ - $$PWD/qstaticpropertyupdatedchangebase_p.h \ - $$PWD/qpropertyupdatedchange.h \ - $$PWD/qpropertyupdatedchange_p.h \ - $$PWD/qtypedpropertyupdatechange_p.h \ - $$PWD/qstaticpropertyvalueaddedchangebase.h \ - $$PWD/qstaticpropertyvalueaddedchangebase_p.h \ - $$PWD/qstaticpropertyvalueremovedchangebase.h \ - $$PWD/qstaticpropertyvalueremovedchangebase_p.h \ - $$PWD/qpropertynodeaddedchange.h \ - $$PWD/qpropertynodeaddedchange_p.h \ - $$PWD/qpropertynoderemovedchange_p.h \ - $$PWD/qpropertynoderemovedchange.h \ - $$PWD/qpropertyvalueaddedchange.h \ - $$PWD/qpropertyvalueaddedchange_p.h \ - $$PWD/qpropertyvalueremovedchange.h \ - $$PWD/qpropertyvalueremovedchange_p.h \ - $$PWD/qnodecommand.h \ - $$PWD/qnodecommand_p.h \ - $$PWD/qskeletoncreatedchange_p.h \ - $$PWD/qskeletoncreatedchange_p_p.h - -SOURCES += \ - $$PWD/qscenechange.cpp \ - $$PWD/qnodecreatedchange.cpp \ - $$PWD/qnodedestroyedchange.cpp \ - $$PWD/qcomponentaddedchange.cpp \ - $$PWD/qcomponentremovedchange.cpp \ - $$PWD/qpropertyvalueaddedchangebase.cpp \ - $$PWD/qpropertyvalueremovedchangebase.cpp \ - $$PWD/qpropertyupdatedchangebase.cpp \ - $$PWD/qdynamicpropertyupdatedchange.cpp \ - $$PWD/qstaticpropertyupdatedchangebase.cpp \ - $$PWD/qpropertyupdatedchange.cpp \ - $$PWD/qstaticpropertyvalueaddedchangebase.cpp \ - $$PWD/qstaticpropertyvalueremovedchangebase.cpp \ - $$PWD/qpropertynodeaddedchange.cpp \ - $$PWD/qpropertynoderemovedchange.cpp \ - $$PWD/qpropertyvalueaddedchange.cpp \ - $$PWD/qpropertyvalueremovedchange.cpp \ - $$PWD/qnodecommand.cpp \ - $$PWD/qskeletoncreatedchange.cpp diff --git a/src/core/changes/qcomponentaddedchange.cpp b/src/core/changes/qcomponentaddedchange.cpp deleted file mode 100644 index 50d7fd237..000000000 --- a/src/core/changes/qcomponentaddedchange.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qcomponentaddedchange.h" -#include "qcomponentaddedchange_p.h" - -#include <Qt3DCore/qcomponent.h> -#include <Qt3DCore/qentity.h> - -#include <Qt3DCore/private/qnode_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QComponentAddedChangePrivate::QComponentAddedChangePrivate(const QEntity *entity, - const QComponent *component) - : QSceneChangePrivate() - , m_entityId(entity->id()) - , m_componentId(component->id()) - , m_componentMetaObject(QNodePrivate::findStaticMetaObject(component->metaObject())) -{ -} - -/*! - * \class Qt3DCore::QComponentAddedChange - * \inheaderfile Qt3DCore/QComponentAddedChange - * \inherits Qt3DCore::QSceneChange - * \inmodule Qt3DCore - * \brief The QComponentAddedChange class is used to notify when a component is added to an entity. - * - */ - -/*! - * \typedef Qt3DCore::QComponentAddedChangePtr - * \relates Qt3DCore::QComponentAddedChange - * - * A shared pointer for QComponentAddedChange. - */ - -/*! - * Constructs a new QComponentAddedChange which will notify \a entity that \a component was added - */ -QComponentAddedChange::QComponentAddedChange(const QEntity *entity, - const QComponent *component) - : QSceneChange(*new QComponentAddedChangePrivate(entity, component), - ComponentAdded, entity->id()) -{ -} - -/*! - * Constructs a new QComponentAddedChange which will notify \a component that it was added to \a entity - */ -QComponentAddedChange::QComponentAddedChange(const QComponent *component, - const QEntity *entity) - : QSceneChange(*new QComponentAddedChangePrivate(entity, component), - ComponentAdded, component->id()) -{ -} - -QComponentAddedChange::~QComponentAddedChange() -{ -} - -/*! - \return the id of the entity the component was added to. - */ -QNodeId QComponentAddedChange::entityId() const Q_DECL_NOTHROW -{ - Q_D(const QComponentAddedChange); - return d->m_entityId; -} - -/*! - \return the id of the component added. - */ -QNodeId QComponentAddedChange::componentId() const Q_DECL_NOTHROW -{ - Q_D(const QComponentAddedChange); - return d->m_componentId; -} - -/*! - * \return the metaobject. - */ -const QMetaObject *QComponentAddedChange::componentMetaObject() const Q_DECL_NOTHROW -{ - Q_D(const QComponentAddedChange); - return d->m_componentMetaObject; -} - -QT_END_NAMESPACE - -} // namespace Qt3DCore - diff --git a/src/core/changes/qcomponentaddedchange.h b/src/core/changes/qcomponentaddedchange.h deleted file mode 100644 index 9e1522024..000000000 --- a/src/core/changes/qcomponentaddedchange.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QCOMPONENTADDEDCHANGE_H -#define QT3DCORE_QCOMPONENTADDEDCHANGE_H - -#include <Qt3DCore/qscenechange.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QComponent; -class QEntity; -class QComponentAddedChangePrivate; - -class Q_3DCORESHARED_EXPORT QComponentAddedChange : public QSceneChange -{ -public: - Q3D_DECL_DEPRECATED explicit QComponentAddedChange(const QEntity *entity, - const QComponent *component); - Q3D_DECL_DEPRECATED explicit QComponentAddedChange(const QComponent *component, - const QEntity *entity); - ~QComponentAddedChange(); - - QNodeId entityId() const Q_DECL_NOTHROW; - QNodeId componentId() const Q_DECL_NOTHROW; - const QMetaObject *componentMetaObject() const Q_DECL_NOTHROW; - -private: - Q_DECLARE_PRIVATE(QComponentAddedChange) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer<QComponentAddedChange> QComponentAddedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QCOMPONENTADDEDCHANGE_H diff --git a/src/core/changes/qcomponentremovedchange.cpp b/src/core/changes/qcomponentremovedchange.cpp deleted file mode 100644 index f338f11af..000000000 --- a/src/core/changes/qcomponentremovedchange.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qcomponentremovedchange.h" -#include "qcomponentremovedchange_p.h" - -#include <Qt3DCore/qcomponent.h> -#include <Qt3DCore/qentity.h> - -#include <Qt3DCore/private/qnode_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QComponentRemovedChangePrivate::QComponentRemovedChangePrivate(const QEntity *entity, - const QComponent *component) - : QSceneChangePrivate() - , m_entityId(entity->id()) - , m_componentId(component->id()) - , m_componentMetaObject(QNodePrivate::findStaticMetaObject(component->metaObject())) -{ -} - -/*! - * \class Qt3DCore::QComponentRemovedChange - * \inheaderfile Qt3DCore/QComponentRemovedChange - * \inherits Qt3DCore::QSceneChange - * \inmodule Qt3DCore - * \brief The QComponentRemovedChange class is used to notify when a component is removed from an entity. - * - */ - -/*! - * \typedef Qt3DCore::QComponentRemovedChangePtr - * \relates Qt3DCore::QComponentRemovedChange - * - * A shared pointer for QComponentRemovedChange. - */ - -/*! - * Constructs a new QComponentRemovedChange which will notify \a entity that \a component was removed. - */ -QComponentRemovedChange::QComponentRemovedChange(const QEntity *entity, - const QComponent *component) - : QSceneChange(*new QComponentRemovedChangePrivate(entity, component), - ComponentRemoved, entity->id()) -{ -} - -/*! - * Constructs a new QComponentRemovedChange which will notify \a component that it was removed from \a entity - */ -QComponentRemovedChange::QComponentRemovedChange(const QComponent *component, - const QEntity *entity) - : QSceneChange(*new QComponentRemovedChangePrivate(entity, component), - ComponentRemoved, component->id()) -{ - -} - -QComponentRemovedChange::~QComponentRemovedChange() -{ -} - -/*! - \return the id of the entity the component was removed from. - */ -QNodeId QComponentRemovedChange::entityId() const Q_DECL_NOTHROW -{ - Q_D(const QComponentRemovedChange); - return d->m_entityId; -} - -/*! - \return the id of the component removed. - */ -QNodeId QComponentRemovedChange::componentId() const Q_DECL_NOTHROW -{ - Q_D(const QComponentRemovedChange); - return d->m_componentId; -} - -/*! - * \return the metaobject. - */ -const QMetaObject *QComponentRemovedChange::componentMetaObject() const Q_DECL_NOTHROW -{ - Q_D(const QComponentRemovedChange); - return d->m_componentMetaObject; -} - -QT_END_NAMESPACE - -} // namespace Qt3DCore - diff --git a/src/core/changes/qcomponentremovedchange.h b/src/core/changes/qcomponentremovedchange.h deleted file mode 100644 index e0b039780..000000000 --- a/src/core/changes/qcomponentremovedchange.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QCOMPONENTREMOVEDCHANGE_H -#define QT3DCORE_QCOMPONENTREMOVEDCHANGE_H - -#include <Qt3DCore/qscenechange.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QComponent; -class QEntity; -class QComponentRemovedChangePrivate; - -class Q_3DCORESHARED_EXPORT QComponentRemovedChange : public QSceneChange -{ -public: - Q3D_DECL_DEPRECATED explicit QComponentRemovedChange(const QEntity *entity, - const QComponent *component); - Q3D_DECL_DEPRECATED explicit QComponentRemovedChange(const QComponent *component, - const QEntity *entity); - ~QComponentRemovedChange(); - - QNodeId entityId() const Q_DECL_NOTHROW; - QNodeId componentId() const Q_DECL_NOTHROW; - const QMetaObject *componentMetaObject() const Q_DECL_NOTHROW; - -private: - Q_DECLARE_PRIVATE(QComponentRemovedChange) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer<QComponentRemovedChange> QComponentRemovedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QCOMPONENTREMOVEDCHANGE_H diff --git a/src/core/changes/qdynamicpropertyupdatedchange.cpp b/src/core/changes/qdynamicpropertyupdatedchange.cpp deleted file mode 100644 index 30e541a0d..000000000 --- a/src/core/changes/qdynamicpropertyupdatedchange.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdynamicpropertyupdatedchange.h" -#include "qdynamicpropertyupdatedchange_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QDynamicPropertyUpdatedChangePrivate::QDynamicPropertyUpdatedChangePrivate() - : QPropertyUpdatedChangeBasePrivate() -{ -} - -QDynamicPropertyUpdatedChangePrivate::~QDynamicPropertyUpdatedChangePrivate() -{ -} - -/*! - * \class Qt3DCore::QDynamicPropertyUpdatedChange - * \inheaderfile Qt3DCore/QDynamicPropertyUpdatedChange - * \inherits Qt3DCore::QPropertyUpdatedChangeBase - * \inmodule Qt3DCore - * \brief The QDynamicPropertyUpdatedChange class is used to notify when a dynamic property value is updated. - * - */ - -/*! - * \typedef Qt3DCore::QDynamicPropertyUpdatedChangePtr - * \relates Qt3DCore::QDynamicPropertyUpdatedChange - * - * A shared pointer for QDynamicPropertyUpdatedChange. - */ - -/*! - * Constructs a new QDynamicPropertyUpdatedChange with \a subjectId. - */ -QDynamicPropertyUpdatedChange::QDynamicPropertyUpdatedChange(QNodeId subjectId) - : QPropertyUpdatedChangeBase(*new QDynamicPropertyUpdatedChangePrivate, subjectId) -{ -} - -QDynamicPropertyUpdatedChange::QDynamicPropertyUpdatedChange(QDynamicPropertyUpdatedChangePrivate &dd, - QNodeId subjectId) - : QPropertyUpdatedChangeBase(dd, subjectId) -{ -} - -QDynamicPropertyUpdatedChange::~QDynamicPropertyUpdatedChange() -{ -} - -/*! - * \return name of the property. - */ -QByteArray QDynamicPropertyUpdatedChange::propertyName() const -{ - Q_D(const QDynamicPropertyUpdatedChange); - return d->m_propertyName; -} - -/*! - * Sets the property change \a name. - */ -void QDynamicPropertyUpdatedChange::setPropertyName(const QByteArray &name) -{ - Q_D(QDynamicPropertyUpdatedChange); - d->m_propertyName = name; -} - -/*! - * \return property value. - */ -QVariant QDynamicPropertyUpdatedChange::value() const -{ - Q_D(const QDynamicPropertyUpdatedChange); - return d->m_value; -} - -/*! - * Set the property change \a value. - */ -void QDynamicPropertyUpdatedChange::setValue(const QVariant &value) -{ - Q_D(QDynamicPropertyUpdatedChange); - d->m_value = value; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qdynamicpropertyupdatedchange.h b/src/core/changes/qdynamicpropertyupdatedchange.h deleted file mode 100644 index 7009e1fe7..000000000 --- a/src/core/changes/qdynamicpropertyupdatedchange.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_H -#define QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_H - -#include <Qt3DCore/qpropertyupdatedchangebase.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QDynamicPropertyUpdatedChangePrivate; - -class Q_3DCORESHARED_EXPORT QDynamicPropertyUpdatedChange : public QPropertyUpdatedChangeBase -{ -public: - Q3D_DECL_DEPRECATED explicit QDynamicPropertyUpdatedChange(QNodeId subjectId); - ~QDynamicPropertyUpdatedChange(); - - QByteArray propertyName() const; - void setPropertyName(const QByteArray &name); - - QVariant value() const; - void setValue(const QVariant &value); - -protected: - Q_DECLARE_PRIVATE(QDynamicPropertyUpdatedChange) - QDynamicPropertyUpdatedChange(QDynamicPropertyUpdatedChangePrivate &dd, QNodeId subjectId); -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer<QDynamicPropertyUpdatedChange> QDynamicPropertyUpdatedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODEDYNAMICPROPERTYUPDATEDCHANGE_H diff --git a/src/core/changes/qdynamicpropertyupdatedchange_p.h b/src/core/changes/qdynamicpropertyupdatedchange_p.h deleted file mode 100644 index 233d55c8e..000000000 --- a/src/core/changes/qdynamicpropertyupdatedchange_p.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_P_H -#define QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/qbytearray.h> -#include <QtCore/qvariant.h> - -#include <Qt3DCore/private/qpropertyupdatedchangebase_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChange; -class QFrameAllocator; - -class Q_3DCORE_PRIVATE_EXPORT QDynamicPropertyUpdatedChangePrivate : public QPropertyUpdatedChangeBasePrivate -{ -public: - QDynamicPropertyUpdatedChangePrivate(); - virtual ~QDynamicPropertyUpdatedChangePrivate(); - - Q_DECLARE_PUBLIC(QDynamicPropertyUpdatedChange) - - QByteArray m_propertyName; - QVariant m_value; -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_P_H - diff --git a/src/core/changes/qnodecommand.cpp b/src/core/changes/qnodecommand.cpp deleted file mode 100644 index 0836da6e7..000000000 --- a/src/core/changes/qnodecommand.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnodecommand.h" -#include "qnodecommand_p.h" -#include <Qt3DCore/qnode.h> -#include <Qt3DCore/private/qnode_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QNodeCommandPrivate::QNodeCommandPrivate() - : QSceneChangePrivate() - , m_commandId(createId()) - , m_replyToCommandId() -{ -} - -QNodeCommandPrivate::~QNodeCommandPrivate() -{ -} - -QNodeCommand::CommandId QNodeCommandPrivate::createId() -{ - static QBasicAtomicInteger<QNodeCommand::CommandId> next = Q_BASIC_ATOMIC_INITIALIZER(0); - return next.fetchAndAddRelaxed(1) + 1; -} - -/*! - * \class Qt3DCore::QNodeCommand - * \inheaderfile Qt3DCore/QNodeCommand - * \inherits Qt3DCore::QSceneChange - * \inmodule Qt3DCore - * \since 5.10 - * \brief The QNodeCommand class is the base class for all CommandRequested QSceneChange events. - * - * The QNodeCommand class is the base class for all QSceneChange events that - * have the changeType() CommandRequested. - * - * You can subclass this to create your own node update types for communication between - * your QNode and QBackendNode subclasses when writing your own aspects. - */ - -/*! - * \typedef Qt3DCore::QNodeCommandPtr - * \relates Qt3DCore::QNodeCommand - * - * A shared pointer for QNodeCommand. - */ - -/*! - * \typedef QNodeCommand::CommandId - * - * Type of the command id, defined either as quint64 or quint32 - * depending on the platform support. - */ - -/*! - * Constructs a new QNodeCommand with \a id. - */ -QNodeCommand::QNodeCommand(QNodeId id) - : QSceneChange(*new QNodeCommandPrivate(), CommandRequested, id) -{ -} - -QNodeCommand::QNodeCommand(QNodeCommandPrivate &dd, QNodeId id) - : QSceneChange(dd, CommandRequested, id) -{ -} - -QNodeCommand::~QNodeCommand() -{ -} - -/*! - * \return commandId. - */ -QNodeCommand::CommandId QNodeCommand::commandId() const -{ - Q_D(const QNodeCommand); - return d->m_commandId; -} - -/*! - * \return name. - */ -QString QNodeCommand::name() const -{ - Q_D(const QNodeCommand); - return d->m_name; -} - -void QNodeCommand::setName(const QString &name) -{ - Q_D(QNodeCommand); - d->m_name = name; -} - -/*! - * \return data. - */ -QVariant QNodeCommand::data() const -{ - Q_D(const QNodeCommand); - return d->m_data; -} - -void QNodeCommand::setData(const QVariant &data) -{ - Q_D(QNodeCommand); - d->m_data = data; -} - -QNodeCommand::CommandId QNodeCommand::inReplyTo() const -{ - Q_D(const QNodeCommand); - return d->m_replyToCommandId; -} - -void QNodeCommand::setReplyToCommandId(QNodeCommand::CommandId id) -{ - Q_D(QNodeCommand); - d->m_replyToCommandId = id; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qnodecommand.h b/src/core/changes/qnodecommand.h deleted file mode 100644 index a31af1d6d..000000000 --- a/src/core/changes/qnodecommand.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODECOMMAND_H -#define QT3DCORE_QNODECOMMAND_H - -#include <Qt3DCore/qt3dcore_global.h> -#include <Qt3DCore/qscenechange.h> - -#include <QtCore/qsharedpointer.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QNodeCommandPrivate; - -class Q_3DCORESHARED_EXPORT QNodeCommand : public QSceneChange -{ -public: -#if defined(Q_ATOMIC_INT64_IS_SUPPORTED) - typedef quint64 CommandId; -#else - typedef quint32 CommandId; -#endif - - Q3D_DECL_DEPRECATED explicit QNodeCommand(QNodeId id); - ~QNodeCommand(); - - CommandId commandId() const; - - QString name() const; - void setName(const QString &name); - QVariant data() const; - void setData(const QVariant &data); - CommandId inReplyTo() const; - void setReplyToCommandId(CommandId id); - -protected: - explicit QNodeCommand(QNodeCommandPrivate &dd, QNodeId id); - -private: - Q_DECLARE_PRIVATE(QNodeCommand) -}; - -typedef QSharedPointer<QNodeCommand> QNodeCommandPtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODECOMMAND_H diff --git a/src/core/changes/qnodecommand_p.h b/src/core/changes/qnodecommand_p.h deleted file mode 100644 index e89dbe1a9..000000000 --- a/src/core/changes/qnodecommand_p.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODECOMMAND_P_H -#define QT3DCORE_QNODECOMMAND_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <private/qt3dcore_global_p.h> -#include <private/qscenechange_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class Q_3DCORE_PRIVATE_EXPORT QNodeCommandPrivate : public QSceneChangePrivate -{ -public: - QNodeCommandPrivate(); - ~QNodeCommandPrivate(); - - static QNodeCommand::CommandId createId(); - - QNodeCommand::CommandId m_commandId; - QNodeCommand::CommandId m_replyToCommandId; - QString m_name; - QVariant m_data; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODECOMMAND_P_H diff --git a/src/core/changes/qnodecreatedchange.cpp b/src/core/changes/qnodecreatedchange.cpp deleted file mode 100644 index a14e8b7fd..000000000 --- a/src/core/changes/qnodecreatedchange.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnodecreatedchange.h" -#include "qnodecreatedchange_p.h" - -#include <Qt3DCore/qnode.h> - -#include <Qt3DCore/private/qnode_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QNodeCreatedChangeBasePrivate::QNodeCreatedChangeBasePrivate(const QNode *node) - : QSceneChangePrivate() - , m_parentId(node->parentNode() ? node->parentNode()->id() : QNodeId()) - , m_metaObject(QNodePrivate::findStaticMetaObject(node->metaObject())) - , m_nodeEnabled(node->isEnabled()) -{ -} - -/*! - * \class Qt3DCore::QNodeCreatedChangeBase - * \inheaderfile Qt3DCore/QNodeCreatedChangeBase - * \inherits Qt3DCore::QSceneChange - * \inmodule Qt3DCore - * \brief The QNodeCreatedChangeBase class is the base class for all NodeCreated QSceneChange events. - * - * The QNodeCreatedChangeBase class is the base class for all QSceneChange events that - * have the changeType() NodeCreated. You should not need to instantiate this class. - * Usually you should be using one of its subclasses such as QNodeCreatedChange. - * - * You can subclass this to create your own node update types for communication between - * your QNode and QBackendNode subclasses when writing your own aspects. - */ - -/*! - * \typedef Qt3DCore::QNodeCreatedChangeBasePtr - * \relates Qt3DCore::QNodeCreatedChangeBase - * - * A shared pointer for QNodeCreatedChangeBase. - */ - -/*! - * Constructs a new QNodeCreatedChangeBase with \a node. - */ -QNodeCreatedChangeBase::QNodeCreatedChangeBase(const QNode *node) - : QSceneChange(*new QNodeCreatedChangeBasePrivate(node), NodeCreated, node->id()) -{ -} - -QNodeCreatedChangeBase::QNodeCreatedChangeBase(QNodeCreatedChangeBasePrivate &dd, const QNode *node) - : QSceneChange(dd, NodeCreated, node->id()) -{ -} - -QNodeCreatedChangeBase::~QNodeCreatedChangeBase() -{ -} - -/*! - * \return parent id. - */ -QNodeId QNodeCreatedChangeBase::parentId() const Q_DECL_NOTHROW -{ - Q_D(const QNodeCreatedChangeBase); - return d->m_parentId; -} - -/*! - * \return metaobject. - */ -const QMetaObject *QNodeCreatedChangeBase::metaObject() const Q_DECL_NOTHROW -{ - Q_D(const QNodeCreatedChangeBase); - return d->m_metaObject; -} - -/*! - * \return node enabled. - */ -bool QNodeCreatedChangeBase::isNodeEnabled() const Q_DECL_NOTHROW -{ - Q_D(const QNodeCreatedChangeBase); - return d->m_nodeEnabled; -} - -} // namespace Qt3DCore - -/*! - * \class Qt3DCore::QNodeCreatedChange - * \inheaderfile Qt3DCore/QNodeCreatedChange - * \inherits Qt3DCore::QNodeCreatedChangeBase - * \since 5.7 - * \inmodule Qt3DCore - * \brief Used to notify when a node is created. - */ - -QT_END_NAMESPACE diff --git a/src/core/changes/qnodecreatedchange.h b/src/core/changes/qnodecreatedchange.h deleted file mode 100644 index 31d00f3ac..000000000 --- a/src/core/changes/qnodecreatedchange.h +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODECREATEDCHANGE_H -#define QT3DCORE_QNODECREATEDCHANGE_H - -#include <Qt3DCore/qscenechange.h> -#include <Qt3DCore/qt3dcore_global.h> -#include <QtCore/qsharedpointer.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QNode; -class QNodeCreatedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QNodeCreatedChangeBase : public QSceneChange -{ -public: - Q3D_DECL_DEPRECATED explicit QNodeCreatedChangeBase(const QNode *node); - ~QNodeCreatedChangeBase(); - - QNodeId parentId() const Q_DECL_NOTHROW; - const QMetaObject *metaObject() const Q_DECL_NOTHROW; - bool isNodeEnabled() const Q_DECL_NOTHROW; - -protected: - QNodeCreatedChangeBase(QNodeCreatedChangeBasePrivate &dd, const QNode *node); - -private: - Q_DECLARE_PRIVATE(QNodeCreatedChangeBase) -}; - -typedef QSharedPointer<QNodeCreatedChangeBase> QNodeCreatedChangeBasePtr; - -template<typename T> -class QNodeCreatedChange : public QNodeCreatedChangeBase -{ -public: - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - explicit QNodeCreatedChange(const QNode *_node) - : QNodeCreatedChangeBase(_node) - , data() - { - } - QT_WARNING_POP - - T data; -}; - -template<typename T> -using QNodeCreatedChangePtr = QSharedPointer<QNodeCreatedChange<T>>; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODECREATEDCHANGE_H diff --git a/src/core/changes/qnodecreatedchange_p.h b/src/core/changes/qnodecreatedchange_p.h deleted file mode 100644 index 153ccc0e8..000000000 --- a/src/core/changes/qnodecreatedchange_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODECREATEDCHANGE_P_H -#define QT3DCORE_QNODECREATEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/qnodeid.h> - -#include <Qt3DCore/private/qscenechange_p.h> -#include <Qt3DCore/private/qt3dcore_global_p.h> - -QT_BEGIN_NAMESPACE - -struct QMetaObject; - -namespace Qt3DCore { - -class QNode; - -class Q_3DCORE_PRIVATE_EXPORT QNodeCreatedChangeBasePrivate : public QSceneChangePrivate -{ -public: - QNodeCreatedChangeBasePrivate(const QNode *node); - - QNodeId m_parentId; - const QMetaObject *m_metaObject; - bool m_nodeEnabled; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODECREATEDCHANGE_P_H diff --git a/src/core/changes/qnodedestroyedchange.cpp b/src/core/changes/qnodedestroyedchange.cpp deleted file mode 100644 index 2d304dcbc..000000000 --- a/src/core/changes/qnodedestroyedchange.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnodedestroyedchange.h" -#include "qnodedestroyedchange_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -/*! - * \class Qt3DCore::QNodeDestroyedChange - * \inheaderfile Qt3DCore/QNodeDestroyedChange - * \inherits Qt3DCore::QSceneChange - * \since 5.7 - * \inmodule Qt3DCore - * \brief Used to notify when a node is destroyed. - */ - -/*! - * \typedef Qt3DCore::QNodeDestroyedChangePtr - * \relates Qt3DCore::QNodeDestroyedChange - * - * A shared pointer for QNodeDestroyedChange. - */ - -/*! - * Constructs a new QNodeDestroyedChange with \a node and its \a subtreeIdsAndTypes. - */ -QNodeDestroyedChange::QNodeDestroyedChange(const QNode *node, const QVector<QNodeIdTypePair> &subtreeIdsAndTypes) - : QSceneChange(*new QNodeDestroyedChangePrivate, NodeDeleted, node->id()) -{ - Q_D(QNodeDestroyedChange); - d->m_subtreeIdsAndTypes = subtreeIdsAndTypes; -} - -QNodeDestroyedChange::~QNodeDestroyedChange() -{ -} - -/*! - \return a vector of subtree node id type pairs - */ -QVector<QNodeIdTypePair> QNodeDestroyedChange::subtreeIdsAndTypes() const -{ - Q_D(const QNodeDestroyedChange); - return d->m_subtreeIdsAndTypes; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qnodedestroyedchange.h b/src/core/changes/qnodedestroyedchange.h deleted file mode 100644 index dce6da59e..000000000 --- a/src/core/changes/qnodedestroyedchange.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODEDESTROYEDCHANGE_H -#define QT3DCORE_QNODEDESTROYEDCHANGE_H - -#include <Qt3DCore/qnode.h> -#include <Qt3DCore/qscenechange.h> -#include <QtCore/qsharedpointer.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QNodeDestroyedChangePrivate; - -class Q_3DCORESHARED_EXPORT QNodeDestroyedChange : public QSceneChange -{ -public: - Q3D_DECL_DEPRECATED explicit QNodeDestroyedChange(const QNode *node, const QVector<QNodeIdTypePair> &subtreeIdsAndTypes); - ~QNodeDestroyedChange(); - - QVector<QNodeIdTypePair> subtreeIdsAndTypes() const; - -private: - Q_DECLARE_PRIVATE(QNodeDestroyedChange) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer<QNodeDestroyedChange> QNodeDestroyedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODEDESTROYEDCHANGE_H diff --git a/src/core/changes/qnodedestroyedchange_p.h b/src/core/changes/qnodedestroyedchange_p.h deleted file mode 100644 index 081ca858f..000000000 --- a/src/core/changes/qnodedestroyedchange_p.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODEDESTROYEDCHANGE_P_H -#define QT3DCORE_QNODEDESTROYEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/qnode.h> - -#include <Qt3DCore/private/qscenechange_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QNodeDestroyedChange; - -class QNodeDestroyedChangePrivate : public QSceneChangePrivate -{ -public: - QVector<QNodeIdTypePair> m_subtreeIdsAndTypes; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODEDESTROYEDCHANGE_P_H diff --git a/src/core/changes/qpropertynodeaddedchange.cpp b/src/core/changes/qpropertynodeaddedchange.cpp deleted file mode 100644 index 347d7f188..000000000 --- a/src/core/changes/qpropertynodeaddedchange.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertynodeaddedchange.h" -#include "qpropertynodeaddedchange_p.h" - -#include <Qt3DCore/private/qnode_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyNodeAddedChangePrivate::QPropertyNodeAddedChangePrivate() - : QStaticPropertyValueAddedChangeBasePrivate() - , m_addedNodeIdTypePair() -{ -} - -/*! - * \class Qt3DCore::QPropertyNodeAddedChange - * \inheaderfile Qt3DCore/QPropertyNodeAddedChange - * \inherits Qt3DCore::QStaticPropertyValueAddedChangeBase - * \inmodule Qt3DCore - * \brief Used to notify when a node is added to a property. - * - */ - -/*! - * \typedef Qt3DCore::QPropertyNodeAddedChangePtr - * \relates Qt3DCore::QPropertyNodeAddedChange - * - * A shared pointer for QPropertyNodeAddedChange. - */ - -/*! - * Constructs a new QPropertyNodeAddedChange with \a subjectId, \a node. - */ -QPropertyNodeAddedChange::QPropertyNodeAddedChange(QNodeId subjectId, QNode *node) - : QStaticPropertyValueAddedChangeBase(*new QPropertyNodeAddedChangePrivate, subjectId) -{ - Q_D(QPropertyNodeAddedChange); - Q_ASSERT(node); - d->m_addedNodeIdTypePair = QNodeIdTypePair(node->id(), QNodePrivate::findStaticMetaObject(node->metaObject())); - - // Ensure the node has issued a node creation change. We can end - // up here if a newly created node with a parent is immediately set - // as a property on another node. In this case the deferred call to - // _q_postConstructorInit() will not have happened yet as the event - // loop will still be blocked. So force it here and we catch this - // eventuality in the _q_postConstructorInit() function so that we - // do not repeat the creation and new child scene change events. - QNodePrivate::get(node)->_q_ensureBackendNodeCreated(); -} - -/*! \internal */ -QPropertyNodeAddedChange::~QPropertyNodeAddedChange() -{ -} - -/*! - * \return the id of the node added to the property. - */ -QNodeId QPropertyNodeAddedChange::addedNodeId() const -{ - Q_D(const QPropertyNodeAddedChange); - return d->m_addedNodeIdTypePair.id; -} - -/*! - * \return the meta object of the node added to the property. - */ -const QMetaObject *QPropertyNodeAddedChange::metaObject() const -{ - Q_D(const QPropertyNodeAddedChange); - return d->m_addedNodeIdTypePair.type; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertynodeaddedchange.h b/src/core/changes/qpropertynodeaddedchange.h deleted file mode 100644 index 062244f88..000000000 --- a/src/core/changes/qpropertynodeaddedchange.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYNODEADDEDCHANGE_H -#define QT3DCORE_QPROPERTYNODEADDEDCHANGE_H - -#include <Qt3DCore/qstaticpropertyvalueaddedchangebase.h> -#include <Qt3DCore/qnode.h> -#include <QtCore/qsharedpointer.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyNodeAddedChangePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyNodeAddedChange : public QStaticPropertyValueAddedChangeBase -{ -public: - Q3D_DECL_DEPRECATED explicit QPropertyNodeAddedChange(QNodeId subjectId, QNode *node); - ~QPropertyNodeAddedChange(); - - QNodeId addedNodeId() const; - const QMetaObject *metaObject() const; - -private: - Q_DECLARE_PRIVATE(QPropertyNodeAddedChange) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyNodeAddedChange> QPropertyNodeAddedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYNODEADDEDCHANGE_H diff --git a/src/core/changes/qpropertynodeaddedchange_p.h b/src/core/changes/qpropertynodeaddedchange_p.h deleted file mode 100644 index 2930867ea..000000000 --- a/src/core/changes/qpropertynodeaddedchange_p.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYNODEADDEDCHANGE_P_H -#define QT3DCORE_QPROPERTYNODEADDEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/qnode.h> - -#include <Qt3DCore/private/qstaticpropertyvalueaddedchangebase_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChange; -class QFrameAllocator; - -class QPropertyNodeAddedChangePrivate : public QStaticPropertyValueAddedChangeBasePrivate -{ -public: - QPropertyNodeAddedChangePrivate(); - - Q_DECLARE_PUBLIC(QPropertyNodeAddedChange) - - QNodeIdTypePair m_addedNodeIdTypePair; -}; - -} // Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYNODEADDEDCHANGE_P_H diff --git a/src/core/changes/qpropertynoderemovedchange.cpp b/src/core/changes/qpropertynoderemovedchange.cpp deleted file mode 100644 index d19629c37..000000000 --- a/src/core/changes/qpropertynoderemovedchange.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertynoderemovedchange.h" -#include "qpropertynoderemovedchange_p.h" - -#include <Qt3DCore/private/qnode_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyNodeRemovedChangePrivate::QPropertyNodeRemovedChangePrivate() - : QStaticPropertyValueRemovedChangeBasePrivate() - , m_propertyName(nullptr) - , m_removedNodeIdTypePair() -{ -} - -/*! - * \class Qt3DCore::QPropertyNodeRemovedChange - * \inheaderfile Qt3DCore/QPropertyNodeRemovedChange - * \inherits Qt3DCore::QStaticPropertyValueRemovedChangeBase - * \inmodule Qt3DCore - * \brief The QPropertyNodeRemovedChange class is used to notify when a node is removed from a property. - * - */ - - -/*! - * \typedef Qt3DCore::QPropertyNodeRemovedChangePtr - * \relates Qt3DCore::QPropertyNodeRemovedChange - * - * A shared pointer for QPropertyNodeRemovedChange. - */ - -/*! - * Constructs a new QPropertyNodeRemovedChange with \a subjectId, \a node. - */ -QPropertyNodeRemovedChange::QPropertyNodeRemovedChange(QNodeId subjectId, QNode *node) - : QStaticPropertyValueRemovedChangeBase(*new QPropertyNodeRemovedChangePrivate, subjectId) -{ - Q_D(QPropertyNodeRemovedChange); - d->m_removedNodeIdTypePair = QNodeIdTypePair(node->id(), QNodePrivate::get(node)->m_typeInfo); -} - -/*! \internal */ -QPropertyNodeRemovedChange::~QPropertyNodeRemovedChange() -{ -} - -/*! - * \return the id of the node removed to the property. - */ -QNodeId QPropertyNodeRemovedChange::removedNodeId() const -{ - Q_D(const QPropertyNodeRemovedChange); - return d->m_removedNodeIdTypePair.id; -} - -/*! - * \return the metaObject of the node removed to the property. - */ -const QMetaObject *QPropertyNodeRemovedChange::metaObject() const -{ - Q_D(const QPropertyNodeRemovedChange); - return d->m_removedNodeIdTypePair.type; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertynoderemovedchange.h b/src/core/changes/qpropertynoderemovedchange.h deleted file mode 100644 index a8ea9d6c4..000000000 --- a/src/core/changes/qpropertynoderemovedchange.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_H -#define QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_H - -#include <Qt3DCore/qstaticpropertyvalueremovedchangebase.h> -#include <Qt3DCore/qnode.h> -#include <QtCore/qsharedpointer.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyNodeRemovedChangePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyNodeRemovedChange : public QStaticPropertyValueRemovedChangeBase -{ -public: - Q3D_DECL_DEPRECATED explicit QPropertyNodeRemovedChange(QNodeId subjectId, QNode *node); - ~QPropertyNodeRemovedChange(); - - QNodeId removedNodeId() const; - const QMetaObject *metaObject() const; - -private: - Q_DECLARE_PRIVATE(QPropertyNodeRemovedChange) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyNodeRemovedChange> QPropertyNodeRemovedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_H diff --git a/src/core/changes/qpropertynoderemovedchange_p.h b/src/core/changes/qpropertynoderemovedchange_p.h deleted file mode 100644 index 0145cc507..000000000 --- a/src/core/changes/qpropertynoderemovedchange_p.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_P_H -#define QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/qnode.h> - -#include <Qt3DCore/private/qstaticpropertyvalueremovedchangebase_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChange; -class QFrameAllocator; - -class QPropertyNodeRemovedChangePrivate : public QStaticPropertyValueRemovedChangeBasePrivate -{ -public: - QPropertyNodeRemovedChangePrivate(); - - Q_DECLARE_PUBLIC(QPropertyNodeRemovedChange) - - const char *m_propertyName; - QNodeIdTypePair m_removedNodeIdTypePair; -}; - -} // Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_P_H diff --git a/src/core/changes/qpropertyupdatedchange.h b/src/core/changes/qpropertyupdatedchange.h deleted file mode 100644 index aa0dd9364..000000000 --- a/src/core/changes/qpropertyupdatedchange.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYUPDATEDCHANGE_H -#define QT3DCORE_QPROPERTYUPDATEDCHANGE_H - -#include <Qt3DCore/qstaticpropertyupdatedchangebase.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChangePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyUpdatedChange : public QStaticPropertyUpdatedChangeBase -{ -public: - Q3D_DECL_DEPRECATED explicit QPropertyUpdatedChange(QNodeId subjectId); - virtual ~QPropertyUpdatedChange(); - - QVariant value() const; - void setValue(const QVariant &value); - -protected: - Q_DECLARE_PRIVATE(QPropertyUpdatedChange) - QPropertyUpdatedChange(QPropertyUpdatedChangePrivate &dd, QNodeId subjectId); -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyUpdatedChange> QPropertyUpdatedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYUPDATEDCHANGE_H diff --git a/src/core/changes/qpropertyupdatedchange_p.h b/src/core/changes/qpropertyupdatedchange_p.h deleted file mode 100644 index ad908a8c4..000000000 --- a/src/core/changes/qpropertyupdatedchange_p.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYUPDATEDCHANGE_P_H -#define QT3DCORE_QPROPERTYUPDATEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/QVariant> - -#include <Qt3DCore/private/qstaticpropertyupdatedchangebase_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChange; - -class QPropertyUpdatedChangePrivate : public QStaticPropertyUpdatedChangeBasePrivate -{ -public: - QPropertyUpdatedChangePrivate(); - virtual ~QPropertyUpdatedChangePrivate(); - - Q_DECLARE_PUBLIC(QPropertyUpdatedChange) - - QVariant m_value; -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYUPDATEDCHANGE_P_H diff --git a/src/core/changes/qpropertyupdatedchangebase.cpp b/src/core/changes/qpropertyupdatedchangebase.cpp deleted file mode 100644 index 3080fb647..000000000 --- a/src/core/changes/qpropertyupdatedchangebase.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertyupdatedchangebase.h" -#include "qpropertyupdatedchangebase_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyUpdatedChangeBasePrivate::QPropertyUpdatedChangeBasePrivate() - : QSceneChangePrivate() - , m_isIntermediate(false) -{ -} - -QPropertyUpdatedChangeBasePrivate::~QPropertyUpdatedChangeBasePrivate() -{ -} - -QPropertyUpdatedChangeBasePrivate *QPropertyUpdatedChangeBasePrivate::get(QPropertyUpdatedChangeBase *q) -{ - return q->d_func(); -} - -/*! - * \class Qt3DCore::QPropertyUpdatedChangeBase - * \inheaderfile Qt3DCore/QPropertyUpdatedChangeBase - * \inmodule Qt3DCore - * \brief The QPropertyUpdatedChangeBase class is the base class for all PropertyUpdated QSceneChange events. - * - * The QPropertyUpdatedChangeBase class is the base class for all QSceneChange events that - * have the changeType() PropertyUpdated. You should not need to instantiate this class. - * Usually you should be using one of its subclasses such as QPropertyUpdatedChange or - * QTypedPropertyUpdatedChange. - * - * You can subclass this to create your own node update types for communication between - * your QNode and QBackendNode subclasses when writing your own aspects. - */ - -/*! - * \typedef Qt3DCore::QPropertyUpdatedChangeBasePtr - * \relates Qt3DCore::QPropertyUpdatedChangeBase - * - * A shared pointer for QPropertyUpdatedChangeBase. - */ - -/*! - * Constructs a new QPropertyUpdatedChangeBase with \a subjectId - */ -QPropertyUpdatedChangeBase::QPropertyUpdatedChangeBase(QNodeId subjectId) - : QSceneChange(*new QPropertyUpdatedChangeBasePrivate, PropertyUpdated, subjectId) -{ -} - -QPropertyUpdatedChangeBase::QPropertyUpdatedChangeBase(QPropertyUpdatedChangeBasePrivate &dd, QNodeId subjectId) - : QSceneChange(dd, PropertyUpdated, subjectId) -{ -} - -QPropertyUpdatedChangeBase::~QPropertyUpdatedChangeBase() -{ -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertyupdatedchangebase.h b/src/core/changes/qpropertyupdatedchangebase.h deleted file mode 100644 index 5a0f6c87f..000000000 --- a/src/core/changes/qpropertyupdatedchangebase.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_H -#define QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_H - -#include <Qt3DCore/qscenechange.h> -#include <Qt3DCore/qt3dcore_global.h> -#include <QtCore/qsharedpointer.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyUpdatedChangeBase : public QSceneChange -{ -public: - ~QPropertyUpdatedChangeBase(); - -protected: - Q3D_DECL_DEPRECATED explicit QPropertyUpdatedChangeBase(QNodeId subjectId); - QPropertyUpdatedChangeBase(QPropertyUpdatedChangeBasePrivate &dd, QNodeId subjectId); - Q_DECLARE_PRIVATE(QPropertyUpdatedChangeBase) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyUpdatedChangeBase> QPropertyUpdatedChangeBasePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_H diff --git a/src/core/changes/qpropertyupdatedchangebase_p.h b/src/core/changes/qpropertyupdatedchangebase_p.h deleted file mode 100644 index 6dd7186f2..000000000 --- a/src/core/changes/qpropertyupdatedchangebase_p.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_P_H -#define QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/private/qscenechange_p.h> -#include <Qt3DCore/private/qt3dcore_global_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChangeBase; - -class Q_3DCORE_PRIVATE_EXPORT QPropertyUpdatedChangeBasePrivate : public QSceneChangePrivate -{ -public: - QPropertyUpdatedChangeBasePrivate(); - virtual ~QPropertyUpdatedChangeBasePrivate(); - - static QPropertyUpdatedChangeBasePrivate *get(QPropertyUpdatedChangeBase *q); - - Q_DECLARE_PUBLIC(QPropertyUpdatedChangeBase) - - // Frontend nodes should not receive intermediate animated property - // updated by default. Only if they subscribe. The animation aspect - // will set this to true for animating properties apart from the final - // frame's update. - bool m_isIntermediate; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_P_H - diff --git a/src/core/changes/qpropertyvalueaddedchange.cpp b/src/core/changes/qpropertyvalueaddedchange.cpp deleted file mode 100644 index 28d912632..000000000 --- a/src/core/changes/qpropertyvalueaddedchange.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertyvalueaddedchange.h" -#include "qpropertyvalueaddedchange_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyValueAddedChangePrivate::QPropertyValueAddedChangePrivate() - : QStaticPropertyValueAddedChangeBasePrivate() -{ -} - - -/*! - * \class Qt3DCore::QPropertyValueAddedChange - * \inheaderfile Qt3DCore/QPropertyValueAddedChange - * \inherits Qt3DCore::QStaticPropertyValueAddedChangeBase - * \inmodule Qt3DCore - * \brief Used to notify when a value is added to a property. - * - */ - -/*! - * \typedef Qt3DCore::QPropertyValueAddedChangePtr - * \relates Qt3DCore::QPropertyValueAddedChange - * - * A shared pointer for QPropertyValueAddedChange. - */ - -/*! - * Constructs a new QPropertyValueAddedChange with \a subjectId. - */ -QPropertyValueAddedChange::QPropertyValueAddedChange(QNodeId subjectId) - : QStaticPropertyValueAddedChangeBase(*new QPropertyValueAddedChangePrivate, subjectId) -{ -} - -QPropertyValueAddedChange::~QPropertyValueAddedChange() -{ -} - -/*! - * Sets the value added to the property to \a value. - */ -void QPropertyValueAddedChange::setAddedValue(const QVariant &value) -{ - Q_D(QPropertyValueAddedChange); - d->m_addedValue = value; -} - -/*! - * \return the value added to the property. - */ -QVariant QPropertyValueAddedChange::addedValue() const -{ - Q_D(const QPropertyValueAddedChange); - return d->m_addedValue; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertyvalueaddedchange.h b/src/core/changes/qpropertyvalueaddedchange.h deleted file mode 100644 index e70d78b7e..000000000 --- a/src/core/changes/qpropertyvalueaddedchange.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEADDEDCHANGE_H -#define QT3DCORE_QPROPERTYVALUEADDEDCHANGE_H - -#include <Qt3DCore/qstaticpropertyvalueaddedchangebase.h> -#include <Qt3DCore/qt3dcore_global.h> -#include <QtCore/qsharedpointer.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueAddedChangePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyValueAddedChange : public QStaticPropertyValueAddedChangeBase -{ -public: - Q3D_DECL_DEPRECATED explicit QPropertyValueAddedChange(QNodeId subjectId); - ~QPropertyValueAddedChange(); - - void setAddedValue(const QVariant &value); - QVariant addedValue() const; - -private: - Q_DECLARE_PRIVATE(QPropertyValueAddedChange) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyValueAddedChange> QPropertyValueAddedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEADDEDCHANGE_H diff --git a/src/core/changes/qpropertyvalueaddedchange_p.h b/src/core/changes/qpropertyvalueaddedchange_p.h deleted file mode 100644 index 3f7ea33fe..000000000 --- a/src/core/changes/qpropertyvalueaddedchange_p.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEADDEDCHANGE_P_H -#define QT3DCORE_QPROPERTYVALUEADDEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/qvariant.h> - -#include <Qt3DCore/private/qstaticpropertyvalueaddedchangebase_p.h> -#include <Qt3DCore/private/qt3dcore_global_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueAddedChange; - -class Q_3DCORE_PRIVATE_EXPORT QPropertyValueAddedChangePrivate : public QStaticPropertyValueAddedChangeBasePrivate -{ -public: - QPropertyValueAddedChangePrivate(); - - Q_DECLARE_PUBLIC(QPropertyValueAddedChange) - - QVariant m_addedValue; -}; - -} // Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEADDEDCHANGE_P_H - diff --git a/src/core/changes/qpropertyvalueaddedchangebase.cpp b/src/core/changes/qpropertyvalueaddedchangebase.cpp deleted file mode 100644 index aea5e1fd4..000000000 --- a/src/core/changes/qpropertyvalueaddedchangebase.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertyvalueaddedchangebase.h" - -#include "qpropertyvalueaddedchangebase_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyValueAddedChangeBasePrivate::QPropertyValueAddedChangeBasePrivate() - : QSceneChangePrivate() -{ -} - -QPropertyValueAddedChangeBasePrivate::~QPropertyValueAddedChangeBasePrivate() -{ -} - -/*! - * \class Qt3DCore::QPropertyValueAddedChangeBase - * \inheaderfile Qt3DCore/QPropertyValueAddedChangeBase - * \inmodule Qt3DCore - * \brief The QPropertyValueAddedChangeBase class is the base class for all PropertyValueAdded QSceneChange events. - * - * The QPropertyValueAddedChangeBase class is the base class for all QSceneChange events that - * have the changeType() PropertyValueAdded. You should not need to instantiate this class. - * Usually you should be using one of its subclasses such as QPropertyNodeAddedChange. - * - * You can subclass this to create your own node added types for communication between - * your QNode and QBackendNode subclasses when writing your own aspects. - */ - -/*! - * \typedef Qt3DCore::QPropertyValueAddedChangeBasePtr - * \relates Qt3DCore::QPropertyValueAddedChangeBase - * - * A shared pointer for QPropertyValueAddedChangeBase. - */ - -/*! - * Constructs a new QPropertyValueAddedChangeBase with \a subjectId - */ -QPropertyValueAddedChangeBase::QPropertyValueAddedChangeBase(QNodeId subjectId) - : QSceneChange(*new QPropertyValueAddedChangeBasePrivate, PropertyValueAdded, subjectId) -{ -} - -/*! \internal */ -QPropertyValueAddedChangeBase::QPropertyValueAddedChangeBase(QPropertyValueAddedChangeBasePrivate &dd, - QNodeId subjectId) - : QSceneChange(dd, PropertyValueAdded, subjectId) -{ -} - -QPropertyValueAddedChangeBase::~QPropertyValueAddedChangeBase() -{ -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertyvalueaddedchangebase.h b/src/core/changes/qpropertyvalueaddedchangebase.h deleted file mode 100644 index 148411de8..000000000 --- a/src/core/changes/qpropertyvalueaddedchangebase.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_H -#define QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_H - -#include <Qt3DCore/qscenechange.h> -#include <Qt3DCore/qt3dcore_global.h> -#include <QtCore/qsharedpointer.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueAddedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyValueAddedChangeBase : public QSceneChange -{ -public: - ~QPropertyValueAddedChangeBase(); - -protected: - Q3D_DECL_DEPRECATED explicit QPropertyValueAddedChangeBase(QNodeId subjectId); - Q3D_DECL_DEPRECATED explicit QPropertyValueAddedChangeBase(QPropertyValueAddedChangeBasePrivate &dd, QNodeId subjectId); - Q_DECLARE_PRIVATE(QPropertyValueAddedChangeBase) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyValueAddedChangeBase> QPropertyValueAddedChangeBasePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_H diff --git a/src/core/changes/qpropertyvalueaddedchangebase_p.h b/src/core/changes/qpropertyvalueaddedchangebase_p.h deleted file mode 100644 index 57d97e4c0..000000000 --- a/src/core/changes/qpropertyvalueaddedchangebase_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_P_H -#define QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/private/qscenechange_p.h> -#include <Qt3DCore/private/qt3dcore_global_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueAddedChangeBase; - -class Q_3DCORE_PRIVATE_EXPORT QPropertyValueAddedChangeBasePrivate : public QSceneChangePrivate -{ -public: - QPropertyValueAddedChangeBasePrivate(); - virtual ~QPropertyValueAddedChangeBasePrivate(); - - Q_DECLARE_PUBLIC(QPropertyValueAddedChangeBase) -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_P_H - diff --git a/src/core/changes/qpropertyvalueremovedchange.cpp b/src/core/changes/qpropertyvalueremovedchange.cpp deleted file mode 100644 index 89cf5620f..000000000 --- a/src/core/changes/qpropertyvalueremovedchange.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertyvalueremovedchange.h" - -#include "qpropertyvalueremovedchange_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyValueRemovedChangePrivate::QPropertyValueRemovedChangePrivate() - : QStaticPropertyValueRemovedChangeBasePrivate() -{ -} - - -/*! - * \class Qt3DCore::QPropertyValueRemovedChange - * \inheaderfile Qt3DCore/QPropertyValueRemovedChange - * \inherits Qt3DCore::QStaticPropertyValueRemovedChangeBase - * \inmodule Qt3DCore - * \brief Used to notify when a value is added to a property. - * - */ - -/*! - * \typedef Qt3DCore::QPropertyValueRemovedChangePtr - * \relates Qt3DCore::QPropertyValueRemovedChange - * - * A shared pointer for QPropertyValueRemovedChange. - */ - -/*! - * Constructs a new QPropertyValueRemovedChange with \a subjectId. - */ -QPropertyValueRemovedChange::QPropertyValueRemovedChange(QNodeId subjectId) - : QStaticPropertyValueRemovedChangeBase(*new QPropertyValueRemovedChangePrivate, subjectId) -{ -} - -QPropertyValueRemovedChange::~QPropertyValueRemovedChange() -{ -} - -/*! - * Sets the value removed from the property to \a value. - */ -void QPropertyValueRemovedChange::setRemovedValue(const QVariant &value) -{ - Q_D(QPropertyValueRemovedChange); - d->m_RemovedValue = value; -} - -/*! - * \return the value removed from the property. - */ -QVariant QPropertyValueRemovedChange::removedValue() const -{ - Q_D(const QPropertyValueRemovedChange); - return d->m_RemovedValue; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertyvalueremovedchange.h b/src/core/changes/qpropertyvalueremovedchange.h deleted file mode 100644 index 70eb42db4..000000000 --- a/src/core/changes/qpropertyvalueremovedchange.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_H -#define QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_H - -#include <Qt3DCore/qstaticpropertyvalueremovedchangebase.h> -#include <Qt3DCore/qt3dcore_global.h> -#include <QtCore/qsharedpointer.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueRemovedChangePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyValueRemovedChange : public QStaticPropertyValueRemovedChangeBase -{ -public: - Q3D_DECL_DEPRECATED explicit QPropertyValueRemovedChange(QNodeId subjectId); - ~QPropertyValueRemovedChange(); - - void setRemovedValue(const QVariant &value); - QVariant removedValue() const; - -private: - Q_DECLARE_PRIVATE(QPropertyValueRemovedChange) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyValueRemovedChange> QPropertyValueRemovedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_H diff --git a/src/core/changes/qpropertyvalueremovedchange_p.h b/src/core/changes/qpropertyvalueremovedchange_p.h deleted file mode 100644 index 119dabefc..000000000 --- a/src/core/changes/qpropertyvalueremovedchange_p.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_P_H -#define QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/qvariant.h> - -#include <Qt3DCore/private/qstaticpropertyvalueremovedchangebase_p.h> -#include <Qt3DCore/private/qt3dcore_global_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueRemovedChange; - -class Q_3DCORE_PRIVATE_EXPORT QPropertyValueRemovedChangePrivate : public QStaticPropertyValueRemovedChangeBasePrivate -{ -public: - QPropertyValueRemovedChangePrivate(); - - Q_DECLARE_PUBLIC(QPropertyValueRemovedChange) - - QVariant m_RemovedValue; -}; - -} // Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_P_H - diff --git a/src/core/changes/qpropertyvalueremovedchangebase.cpp b/src/core/changes/qpropertyvalueremovedchangebase.cpp deleted file mode 100644 index 16d3c5946..000000000 --- a/src/core/changes/qpropertyvalueremovedchangebase.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertyvalueremovedchangebase.h" - -#include "qpropertyvalueremovedchangebase_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyValueRemovedChangeBasePrivate::QPropertyValueRemovedChangeBasePrivate() - : QSceneChangePrivate() -{ -} - -QPropertyValueRemovedChangeBasePrivate::~QPropertyValueRemovedChangeBasePrivate() -{ -} - -/*! - * \class Qt3DCore::QPropertyValueRemovedChangeBase - * \inheaderfile Qt3DCore/QPropertyValueRemovedChangeBase - * \inmodule Qt3DCore - * \brief The QPropertyValueRemovedChangeBase class is the base class for all PropertyValueRemoved QSceneChange events. - * - * The QPropertyValueRemovedChangeBase class is the base class for all QSceneChange events that - * have the changeType() PropertyValueRemoved. You should not need to instantiate this class. - * Usually you should be using one of its subclasses such as QPropertyNodeRemovedChange. - * - * You can subclass this to create your own node Removed types for communication between - * your QNode and QBackendNode subclasses when writing your own aspects. - */ - -/*! - * \typedef Qt3DCore::QPropertyValueRemovedChangeBasePtr - * \relates Qt3DCore::QPropertyValueRemovedChangeBase - * - * A shared pointer for QPropertyValueRemovedChangeBase. - */ - -/*! - * Constructs a new QPropertyValueRemovedChangeBase with \a subjectId - */ -QPropertyValueRemovedChangeBase::QPropertyValueRemovedChangeBase(QNodeId subjectId) - : QSceneChange(*new QPropertyValueRemovedChangeBasePrivate, PropertyValueRemoved, subjectId) -{ -} - -/*! \internal */ -QPropertyValueRemovedChangeBase::QPropertyValueRemovedChangeBase(QPropertyValueRemovedChangeBasePrivate &dd, - QNodeId subjectId) - : QSceneChange(dd, PropertyValueRemoved, subjectId) -{ -} - -QPropertyValueRemovedChangeBase::~QPropertyValueRemovedChangeBase() -{ -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertyvalueremovedchangebase_p.h b/src/core/changes/qpropertyvalueremovedchangebase_p.h deleted file mode 100644 index f62f7f24d..000000000 --- a/src/core/changes/qpropertyvalueremovedchangebase_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_P_H -#define QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/private/qscenechange_p.h> -#include <Qt3DCore/private/qt3dcore_global_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueRemovedChangeBase; - -class Q_3DCORE_PRIVATE_EXPORT QPropertyValueRemovedChangeBasePrivate : public QSceneChangePrivate -{ -public: - QPropertyValueRemovedChangeBasePrivate(); - virtual ~QPropertyValueRemovedChangeBasePrivate(); - - Q_DECLARE_PUBLIC(QPropertyValueRemovedChangeBase) -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_P_H - diff --git a/src/core/changes/qscenechange.cpp b/src/core/changes/qscenechange.cpp deleted file mode 100644 index 822451b5f..000000000 --- a/src/core/changes/qscenechange.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qscenechange.h" - -#include "qscenechange_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -/*! - * \enum Qt3DCore::ChangeFlag - * \relates Qt3DCore::QSceneChange - * \obsolete - * - * The types of change that can be sent and received by Qt3D's change notification system. - * - * \value NodeCreated A new instance of a QNode subclass has been created. - * \value NodeDeleted A QNode has been deleted. - * \value PropertyUpdated A QNode property has been updated. - * \value PropertyValueAdded A QNode has been added to the scene. - * \value PropertyValueRemoved A QNode has been removed from the scene. - * \value CommandRequested A QNodeCommand has been sent between a node and its backend. - * \value ComponentAdded A QComponent has been added to a QEntity. - * \value ComponentRemoved A QComponent has been removed from a QEntity. - * \value CallbackTriggered A QNode triggered a callback. - * \value AllChanges Allows an observer to monitor for any of the above changes. - */ - -QSceneChangePrivate::QSceneChangePrivate() - : q_ptr(nullptr) - , m_subjectId() - , m_deliveryFlags(QSceneChange::BackendNodes) - , m_type(AllChanges) -{ -} - -QSceneChangePrivate::~QSceneChangePrivate() -{ -} - -/*! - * \class Qt3DCore::QSceneChange - * \inheaderfile Qt3DCore/QSceneChange - * \inmodule Qt3DCore - * \brief The base class for changes that can be sent and received by Qt3D's change notification system. - */ - -/*! - * \typedef Qt3DCore::QSceneChangePtr - * \relates Qt3DCore::QSceneChange - * - * A shared pointer for QSceneChange. - */ - -/*! - * \enum QSceneChange::DeliveryFlag - * - * The types of change that can be sent and received by Qt3D's change notification system. - * - * \value BackendNodes - * \value Nodes - * \value DeliverToAll - */ - -/*! - * Constructs a new QSceneChange with \a type and \a subjectId. - */ -QSceneChange::QSceneChange(ChangeFlag type, QNodeId subjectId) - : d_ptr(new QSceneChangePrivate) -{ - d_ptr->q_ptr = this; - Q_D(QSceneChange); - d->m_type = type; - d->m_subjectId = subjectId; -} - -/*! \internal */ -QSceneChange::QSceneChange(QSceneChangePrivate &dd, - ChangeFlag type, QNodeId subjectId) - : d_ptr(&dd) -{ - d_ptr->q_ptr = this; - Q_D(QSceneChange); - d->m_type = type; - d->m_subjectId = subjectId; -} - -QSceneChange::~QSceneChange() -{ - delete d_ptr; -} - -/*! - * Returns the scene change type. - */ -ChangeFlag QSceneChange::type() const Q_DECL_NOTHROW -{ - Q_D(const QSceneChange); - return d->m_type; -} - -/*! - Sets the delivery flags of the change to \a flags. - */ -void QSceneChange::setDeliveryFlags(DeliveryFlags flags) Q_DECL_NOTHROW -{ - Q_D(QSceneChange); - d->m_deliveryFlags = flags; -} - -/*! - Returns the set delivery flags. - */ -QSceneChange::DeliveryFlags QSceneChange::deliveryFlags() const Q_DECL_NOTHROW -{ - Q_D(const QSceneChange); - return d->m_deliveryFlags; -} - -/*! - * \return scene change subject id. - */ -QNodeId QSceneChange::subjectId() const Q_DECL_NOTHROW -{ - Q_D(const QSceneChange); - return d->m_subjectId; -} - -} // Qt3D - -QT_END_NAMESPACE diff --git a/src/core/changes/qscenechange_p.h b/src/core/changes/qscenechange_p.h deleted file mode 100644 index 4e112fe93..000000000 --- a/src/core/changes/qscenechange_p.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSCENECHANGE_P_H -#define QT3DCORE_QSCENECHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/qscenechange.h> -#include <QtCore/QtGlobal> - -#include <Qt3DCore/private/qt3dcore_global_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QSceneChange; -class QNodeId; - -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED -struct NodeRelationshipChange { - QNode *node; - QNode *subNode; - ChangeFlag change; - const char *property; -}; -QT_WARNING_POP - -class Q_3DCORE_PRIVATE_EXPORT QSceneChangePrivate -{ -public : - QSceneChangePrivate(); - virtual ~QSceneChangePrivate(); - - Q_DECLARE_PUBLIC(QSceneChange) - - QSceneChange *q_ptr; - - QNodeId m_subjectId; - QSceneChange::DeliveryFlags m_deliveryFlags; - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - ChangeFlag m_type; - QT_WARNING_POP -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSCENECHANGE_P_H diff --git a/src/core/changes/qskeletoncreatedchange.cpp b/src/core/changes/qskeletoncreatedchange.cpp deleted file mode 100644 index 80895c394..000000000 --- a/src/core/changes/qskeletoncreatedchange.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qskeletoncreatedchange_p.h" -#include "qskeletoncreatedchange_p_p.h" -#include <Qt3DCore/private/qabstractskeleton_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QSkeletonCreatedChangeBasePrivate::QSkeletonCreatedChangeBasePrivate(const QAbstractSkeleton *skeleton) - : Qt3DCore::QNodeCreatedChangeBasePrivate(skeleton) - , m_type(QAbstractSkeletonPrivate::get(skeleton)->m_type) -{ - -} - -/* - \internal - \class Qt3DCore::QSkeletonCreatedChangeBase - \inmodule Qt3DCore - \brief Base class for handling creation changes for QAbstractSkeleton sub-classes. -*/ -QSkeletonCreatedChangeBase::QSkeletonCreatedChangeBase(const QAbstractSkeleton *skeleton) - : Qt3DCore::QNodeCreatedChangeBase(*new QSkeletonCreatedChangeBasePrivate(skeleton), skeleton) -{ -} - -/*! \internal */ -QSkeletonCreatedChangeBase::~QSkeletonCreatedChangeBase() -{ -} - -/*! \internal */ -QSkeletonCreatedChangeBase::SkeletonType QSkeletonCreatedChangeBase::type() const -{ - Q_D(const QSkeletonCreatedChangeBase); - return d->m_type; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qskeletoncreatedchange_p.h b/src/core/changes/qskeletoncreatedchange_p.h deleted file mode 100644 index 9f0c361da..000000000 --- a/src/core/changes/qskeletoncreatedchange_p.h +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSKELETONCREATEDCHANGE_P_H -#define QT3DCORE_QSKELETONCREATEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/qnodecreatedchange.h> -#include <Qt3DCore/qabstractskeleton.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QSkeletonCreatedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QSkeletonCreatedChangeBase : public QNodeCreatedChangeBase -{ -public: - Q3D_DECL_DEPRECATED explicit QSkeletonCreatedChangeBase(const QAbstractSkeleton *skeleton); - ~QSkeletonCreatedChangeBase(); - - enum SkeletonType { - Skeleton = 0, - SkeletonLoader - }; - - SkeletonType type() const; - -private: - Q_DECLARE_PRIVATE(QSkeletonCreatedChangeBase) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer<QSkeletonCreatedChangeBase> QSkeletonCreatedChangeBasePtr; - -template<typename T> -class QSkeletonCreatedChange : public QSkeletonCreatedChangeBase -{ -public: - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - explicit QSkeletonCreatedChange(const QAbstractSkeleton *_skeleton) - : QSkeletonCreatedChangeBase(_skeleton) - , data() - { - } - QT_WARNING_POP - - T data; -}; - -template<typename T> -using QSkeletonCreatedChangePtr = QSharedPointer<QSkeletonCreatedChange<T>>; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSKELETONCREATEDCHANGE_P_H diff --git a/src/core/changes/qskeletoncreatedchange_p_p.h b/src/core/changes/qskeletoncreatedchange_p_p.h deleted file mode 100644 index 961458ab6..000000000 --- a/src/core/changes/qskeletoncreatedchange_p_p.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSKELETONCREATEDCHANGE_P_P_H -#define QT3DCORE_QSKELETONCREATEDCHANGE_P_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/private/qnodecreatedchange_p.h> -#include <Qt3DCore/private/qskeletoncreatedchange_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QAbstractSkeleton; - -class QSkeletonCreatedChangeBasePrivate : public Qt3DCore::QNodeCreatedChangeBasePrivate -{ -public: - QSkeletonCreatedChangeBasePrivate(const QAbstractSkeleton *skeleton); - - QSkeletonCreatedChangeBase::SkeletonType m_type; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSKELETONCREATEDCHANGE_P_P_H diff --git a/src/core/changes/qstaticpropertyupdatedchangebase.cpp b/src/core/changes/qstaticpropertyupdatedchangebase.cpp deleted file mode 100644 index 6aed5a822..000000000 --- a/src/core/changes/qstaticpropertyupdatedchangebase.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qstaticpropertyupdatedchangebase.h" - -#include "qstaticpropertyupdatedchangebase_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QStaticPropertyUpdatedChangeBasePrivate::QStaticPropertyUpdatedChangeBasePrivate() - : QPropertyUpdatedChangeBasePrivate(), - m_propertyName(nullptr) -{ -} - -QStaticPropertyUpdatedChangeBasePrivate::~QStaticPropertyUpdatedChangeBasePrivate() -{ -} - - -/*! - * \class Qt3DCore::QStaticPropertyUpdatedChangeBase - * \inheaderfile Qt3DCore/QStaticPropertyUpdatedChangeBase - * \inmodule Qt3DCore - * \since 5.7 - * \brief The QStaticPropertyUpdatedChangeBase class is the base class for all static PropertyUpdated QSceneChange events. - * - */ - -/*! - * \typedef Qt3DCore::QStaticPropertyUpdatedChangeBasePtr - * \relates Qt3DCore::QStaticPropertyUpdatedChangeBase - * - * A shared pointer for QStaticPropertyUpdatedChangeBase. - */ - -/*! - * Constructs a new QStaticPropertyUpdatedChangeBase with \a subjectId - */ -QStaticPropertyUpdatedChangeBase::QStaticPropertyUpdatedChangeBase(QNodeId subjectId) - : QPropertyUpdatedChangeBase(*new QStaticPropertyUpdatedChangeBasePrivate, subjectId) -{ -} - -/*! \internal */ -QStaticPropertyUpdatedChangeBase::QStaticPropertyUpdatedChangeBase(QStaticPropertyUpdatedChangeBasePrivate &dd, - QNodeId subjectId) - : QPropertyUpdatedChangeBase(dd, subjectId) -{ -} - -QStaticPropertyUpdatedChangeBase::~QStaticPropertyUpdatedChangeBase() -{ -} - -/*! - * \return name of the property. - */ -const char *QStaticPropertyUpdatedChangeBase::propertyName() const -{ - Q_D(const QStaticPropertyUpdatedChangeBase); - return d->m_propertyName; -} - -/*! - * Sets the property change \a name. - */ -void QStaticPropertyUpdatedChangeBase::setPropertyName(const char *name) -{ - Q_D(QStaticPropertyUpdatedChangeBase); - d->m_propertyName = name; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qstaticpropertyupdatedchangebase.h b/src/core/changes/qstaticpropertyupdatedchangebase.h deleted file mode 100644 index c59a87a20..000000000 --- a/src/core/changes/qstaticpropertyupdatedchangebase.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_H -#define QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_H - -#include <Qt3DCore/qpropertyupdatedchangebase.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QStaticPropertyUpdatedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QStaticPropertyUpdatedChangeBase : public QPropertyUpdatedChangeBase -{ -public: - ~QStaticPropertyUpdatedChangeBase(); - - const char *propertyName() const; - void setPropertyName(const char *name); - -protected: - Q3D_DECL_DEPRECATED explicit QStaticPropertyUpdatedChangeBase(QNodeId subjectId); - Q3D_DECL_DEPRECATED explicit QStaticPropertyUpdatedChangeBase(QStaticPropertyUpdatedChangeBasePrivate &dd, QNodeId subjectId); - Q_DECLARE_PRIVATE(QStaticPropertyUpdatedChangeBase) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer<QStaticPropertyUpdatedChangeBase> QStaticPropertyUpdatedChangeBasePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_H diff --git a/src/core/changes/qstaticpropertyupdatedchangebase_p.h b/src/core/changes/qstaticpropertyupdatedchangebase_p.h deleted file mode 100644 index 3f76e2f56..000000000 --- a/src/core/changes/qstaticpropertyupdatedchangebase_p.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_P_H -#define QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/private/qpropertyupdatedchangebase_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChange; -class QFrameAllocator; - -class QStaticPropertyUpdatedChangeBasePrivate : public QPropertyUpdatedChangeBasePrivate -{ -public: - QStaticPropertyUpdatedChangeBasePrivate(); - virtual ~QStaticPropertyUpdatedChangeBasePrivate(); - - Q_DECLARE_PUBLIC(QStaticPropertyUpdatedChangeBase) - - /// FIXME: use QMetaProperty here once the NodeDeleted etc. change events - /// get refactored to their own QSceneChange subclass - const char *m_propertyName; -}; - -} // Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_P_H - diff --git a/src/core/changes/qstaticpropertyvalueaddedchangebase.cpp b/src/core/changes/qstaticpropertyvalueaddedchangebase.cpp deleted file mode 100644 index ad2afc699..000000000 --- a/src/core/changes/qstaticpropertyvalueaddedchangebase.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qstaticpropertyvalueaddedchangebase.h" - -#include "qstaticpropertyvalueaddedchangebase_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QStaticPropertyValueAddedChangeBasePrivate::QStaticPropertyValueAddedChangeBasePrivate() - : QPropertyValueAddedChangeBasePrivate(), - m_propertyName(nullptr) -{ -} - -/*! - * \class Qt3DCore::QStaticPropertyValueAddedChangeBase - * \inheaderfile Qt3DCore/QStaticPropertyValueAddedChangeBase - * \inmodule Qt3DCore - * \since 5.7 - * \brief The QStaticPropertyValueAddedChangeBase class is the base class for all static PropertyValueAdded QSceneChange events. - * - */ - -/*! - * Constructs a new QStaticPropertyValueAddedChangeBase with \a subjectId - */ -QStaticPropertyValueAddedChangeBase::QStaticPropertyValueAddedChangeBase(QNodeId subjectId) - : QPropertyValueAddedChangeBase(*new QStaticPropertyValueAddedChangeBasePrivate, subjectId) -{ -} - -QStaticPropertyValueAddedChangeBase::QStaticPropertyValueAddedChangeBase(QStaticPropertyValueAddedChangeBasePrivate &dd, - QNodeId subjectId) - : QPropertyValueAddedChangeBase(dd, subjectId) -{ -} - -QStaticPropertyValueAddedChangeBase::~QStaticPropertyValueAddedChangeBase() -{ -} - -/*! - * \return name of the property. - */ -const char *QStaticPropertyValueAddedChangeBase::propertyName() const -{ - Q_D(const QStaticPropertyValueAddedChangeBase); - return d->m_propertyName; -} - -/*! - * Sets the property change \a name. - */ -void QStaticPropertyValueAddedChangeBase::setPropertyName(const char *name) -{ - Q_D(QStaticPropertyValueAddedChangeBase); - d->m_propertyName = name; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qstaticpropertyvalueaddedchangebase.h b/src/core/changes/qstaticpropertyvalueaddedchangebase.h deleted file mode 100644 index 7e6807764..000000000 --- a/src/core/changes/qstaticpropertyvalueaddedchangebase.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_H -#define QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_H - -#include <Qt3DCore/qpropertyvalueaddedchangebase.h> -#include <Qt3DCore/qt3dcore_global.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QStaticPropertyValueAddedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QStaticPropertyValueAddedChangeBase : public QPropertyValueAddedChangeBase -{ -public: - ~QStaticPropertyValueAddedChangeBase(); - - const char *propertyName() const; - void setPropertyName(const char *name); - -protected: - Q_DECLARE_PRIVATE(QStaticPropertyValueAddedChangeBase) - Q3D_DECL_DEPRECATED explicit QStaticPropertyValueAddedChangeBase(QNodeId subjectId); - QStaticPropertyValueAddedChangeBase(QStaticPropertyValueAddedChangeBasePrivate &dd, - QNodeId subjectId); -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_H diff --git a/src/core/changes/qstaticpropertyvalueaddedchangebase_p.h b/src/core/changes/qstaticpropertyvalueaddedchangebase_p.h deleted file mode 100644 index 3c7d62840..000000000 --- a/src/core/changes/qstaticpropertyvalueaddedchangebase_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_P_H -#define QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/private/qpropertyvalueaddedchangebase_p.h> -#include <Qt3DCore/private/qt3dcore_global_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QStaticPropertyValueAddedChangeBase; - -class Q_3DCORE_PRIVATE_EXPORT QStaticPropertyValueAddedChangeBasePrivate : public QPropertyValueAddedChangeBasePrivate -{ -public: - QStaticPropertyValueAddedChangeBasePrivate(); - - Q_DECLARE_PUBLIC(QStaticPropertyValueAddedChangeBase) - - const char *m_propertyName; -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_P_H - diff --git a/src/core/changes/qstaticpropertyvalueremovedchangebase.cpp b/src/core/changes/qstaticpropertyvalueremovedchangebase.cpp deleted file mode 100644 index 2094d5aa2..000000000 --- a/src/core/changes/qstaticpropertyvalueremovedchangebase.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qstaticpropertyvalueremovedchangebase.h" -#include "qstaticpropertyvalueremovedchangebase_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QStaticPropertyValueRemovedChangeBasePrivate::QStaticPropertyValueRemovedChangeBasePrivate() - : QPropertyValueRemovedChangeBasePrivate(), - m_propertyName(nullptr) -{ -} - -/*! - * \class Qt3DCore::QStaticPropertyValueRemovedChangeBase - * \inheaderfile Qt3DCore/QStaticPropertyValueRemovedChangeBase - * \inmodule Qt3DCore - * \since 5.7 - * \brief The QStaticPropertyValueRemovedChangeBase class is the base class for all static PropertyValueRemoved QSceneChange events. - * - */ - -/*! - * Constructs a new QStaticPropertyValueRemovedChangeBase with \a subjectId - */ -QStaticPropertyValueRemovedChangeBase::QStaticPropertyValueRemovedChangeBase(QNodeId subjectId) - : QPropertyValueRemovedChangeBase(*new QStaticPropertyValueRemovedChangeBasePrivate, subjectId) -{ -} - -QStaticPropertyValueRemovedChangeBase::QStaticPropertyValueRemovedChangeBase(QStaticPropertyValueRemovedChangeBasePrivate &dd, - QNodeId subjectId) - : QPropertyValueRemovedChangeBase(dd, subjectId) -{ -} - -QStaticPropertyValueRemovedChangeBase::~QStaticPropertyValueRemovedChangeBase() -{ -} - -/*! - * \return name of the property. - */ -const char *QStaticPropertyValueRemovedChangeBase::propertyName() const -{ - Q_D(const QStaticPropertyValueRemovedChangeBase); - return d->m_propertyName; -} - -/*! - * Sets the property change \a name. - */ -void QStaticPropertyValueRemovedChangeBase::setPropertyName(const char *name) -{ - Q_D(QStaticPropertyValueRemovedChangeBase); - d->m_propertyName = name; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qstaticpropertyvalueremovedchangebase.h b/src/core/changes/qstaticpropertyvalueremovedchangebase.h deleted file mode 100644 index d1b96f83e..000000000 --- a/src/core/changes/qstaticpropertyvalueremovedchangebase.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_H -#define QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_H - -#include <Qt3DCore/qpropertyvalueremovedchangebase.h> -#include <Qt3DCore/qt3dcore_global.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QStaticPropertyValueRemovedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QStaticPropertyValueRemovedChangeBase : public QPropertyValueRemovedChangeBase -{ -public: - ~QStaticPropertyValueRemovedChangeBase(); - - const char *propertyName() const; - void setPropertyName(const char *name); - -protected: - Q_DECLARE_PRIVATE(QStaticPropertyValueRemovedChangeBase) - Q3D_DECL_DEPRECATED explicit QStaticPropertyValueRemovedChangeBase(QNodeId subjectId); - QStaticPropertyValueRemovedChangeBase(QStaticPropertyValueRemovedChangeBasePrivate &dd, - QNodeId subjectId); -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_H diff --git a/src/core/changes/qstaticpropertyvalueremovedchangebase_p.h b/src/core/changes/qstaticpropertyvalueremovedchangebase_p.h deleted file mode 100644 index 1c26efa6c..000000000 --- a/src/core/changes/qstaticpropertyvalueremovedchangebase_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_P_H -#define QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/private/qpropertyvalueremovedchangebase_p.h> -#include <Qt3DCore/private/qt3dcore_global_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QStaticPropertyValueRemovedChangeBase; - -class Q_3DCORE_PRIVATE_EXPORT QStaticPropertyValueRemovedChangeBasePrivate : public QPropertyValueRemovedChangeBasePrivate -{ -public: - QStaticPropertyValueRemovedChangeBasePrivate(); - - Q_DECLARE_PUBLIC(QStaticPropertyValueRemovedChangeBase) - - const char *m_propertyName; -}; - -} // Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_P_H - diff --git a/src/core/changes/qtypedpropertyupdatechange_p.h b/src/core/changes/qtypedpropertyupdatechange_p.h deleted file mode 100644 index 6793144ca..000000000 --- a/src/core/changes/qtypedpropertyupdatechange_p.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QTYPEDPROPERTYUPDATECHANGE_P_H -#define QT3DCORE_QTYPEDPROPERTYUPDATECHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/qstaticpropertyupdatedchangebase.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -template<typename T> -class QTypedPropertyUpdatedChange : public QStaticPropertyUpdatedChangeBase -{ -public: - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - explicit QTypedPropertyUpdatedChange(QNodeId _subjectId) - : QStaticPropertyUpdatedChangeBase(_subjectId) - , data() - { - } - QT_WARNING_POP - - T data; -}; - -template<typename T> -using QTypedPropertyUpdatedChangePtr = QSharedPointer<QTypedPropertyUpdatedChange<T>>; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QTYPEDPROPERTYUPDATECHANGE_P_H - diff --git a/src/core/core.pri b/src/core/core.pri index ea95ab10d..5bc6e38d9 100644 --- a/src/core/core.pri +++ b/src/core/core.pri @@ -5,22 +5,15 @@ HEADERS += \ $$PWD/qtickclock_p.h \ $$PWD/qscheduler_p.h \ $$PWD/corelogging_p.h \ - $$PWD/qpostman_p.h \ - $$PWD/qobservableinterface_p.h \ - $$PWD/qobserverinterface_p.h \ - $$PWD/qlockableobserverinterface_p.h \ $$PWD/qchangearbiter_p.h \ $$PWD/qt3dcore_global_p.h \ - $$PWD/qscene_p.h \ - $$PWD/qpostman_p_p.h + $$PWD/qurlhelper_p.h \ + $$PWD/qscene_p.h SOURCES += \ $$PWD/qtickclock.cpp \ $$PWD/qscheduler.cpp \ $$PWD/qchangearbiter.cpp \ $$PWD/corelogging.cpp \ - $$PWD/qobservableinterface.cpp \ - $$PWD/qobserverinterface.cpp \ - $$PWD/qlockableobserverinterface.cpp \ - $$PWD/qpostman.cpp \ + $$PWD/qurlhelper.cpp \ $$PWD/qscene.cpp diff --git a/src/core/core.pro b/src/core/core.pro index b76198e35..9b74780ff 100644 --- a/src/core/core.pro +++ b/src/core/core.pro @@ -2,7 +2,6 @@ TARGET = Qt3DCore MODULE = 3dcore QT = core-private gui-private network -DEFINES += BUILD_QT3D_MODULE gcov { QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage @@ -11,7 +10,7 @@ gcov { include(core.pri) include(aspects/aspects.pri) -include(changes/changes.pri) +include(geometry/geometry.pri) include(jobs/jobs.pri) include(nodes/nodes.pri) include(transforms/transforms.pri) diff --git a/src/core/geometry/geometry.pri b/src/core/geometry/geometry.pri new file mode 100644 index 000000000..3425be857 --- /dev/null +++ b/src/core/geometry/geometry.pri @@ -0,0 +1,21 @@ +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/qabstractfunctor.h \ + $$PWD/qattribute.h \ + $$PWD/qattribute_p.h \ + $$PWD/qbuffer.h \ + $$PWD/qbuffer_p.h \ + $$PWD/qgeometry_p.h \ + $$PWD/qgeometry.h \ + $$PWD/qgeometryfactory_p.h \ + $$PWD/qgeometryview_p.h \ + $$PWD/qgeometryview.h + +SOURCES += \ + $$PWD/qabstractfunctor.cpp \ + $$PWD/qattribute.cpp \ + $$PWD/qbuffer.cpp \ + $$PWD/qgeometry.cpp \ + $$PWD/qgeometryview.cpp + diff --git a/src/core/changes/qpropertyupdatedchange.cpp b/src/core/geometry/qabstractfunctor.cpp index 6b9352dfa..3bd774a4f 100644 --- a/src/core/changes/qpropertyupdatedchange.cpp +++ b/src/core/geometry/qabstractfunctor.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -37,77 +37,61 @@ ** ****************************************************************************/ -#include "qpropertyupdatedchange.h" -#include "qpropertyupdatedchange_p.h" +#include "qabstractfunctor.h" QT_BEGIN_NAMESPACE namespace Qt3DCore { -QPropertyUpdatedChangePrivate::QPropertyUpdatedChangePrivate() - : QStaticPropertyUpdatedChangeBasePrivate() -{ -} +/*! + \class Qt3DCore::QAbstractFunctor + \inmodule Qt3DCore + \since 5.7 + \brief QAbstractFunctor is an abstract base class for all functors. -QPropertyUpdatedChangePrivate::~QPropertyUpdatedChangePrivate() -{ -} + The QAbstractFunctor is used as a base class for all functors and data + generators in Qt3DCore module. -/*! - * \class Qt3DCore::QPropertyUpdatedChange - * \inheaderfile Qt3DCore/QPropertyUpdatedChange - * \inherits Qt3DCore::QStaticPropertyUpdatedChangeBase - * \inmodule Qt3DCore - * \brief The QPropertyUpdatedChange class is used to notify when a property value is updated. - * + When user defines a new functor or generator, they need to implement the + \l QAbstractFunctor::id() method, which should be done using the \c {QT3D_FUNCTOR} + macro in the class definition. */ - /*! - * \typedef Qt3DCore::QPropertyUpdatedChangePtr - * \relates Qt3DCore::QPropertyUpdatedChange - * - * A shared pointer for QPropertyUpdatedChange. + \fn qintptr Qt3DCore::QAbstractFunctor::id() const + + Returns a pointer to the id of the functor. */ +/*! + \fn qintptr Qt3DCore::functorTypeId() + Returns a pointer to the type id of the functor. +*/ /*! - * Constructs a new QPropertyUpdatedChange with \a subjectId. + \macro QT3D_FUNCTOR(Class) + \relates Qt3DCore::QAbstractFunctor + + This macro assigns functor id to the \a Class, which is used by QAbstractFunctor::functor_cast + to determine if the cast can be done. */ -QPropertyUpdatedChange::QPropertyUpdatedChange(QNodeId subjectId) - : QStaticPropertyUpdatedChangeBase(*new QPropertyUpdatedChangePrivate, subjectId) -{ -} /*! - * \internal - */ -QPropertyUpdatedChange::QPropertyUpdatedChange(QPropertyUpdatedChangePrivate &dd, - QNodeId subjectId) - : QStaticPropertyUpdatedChangeBase(dd, subjectId) -{ -} + \fn template<class T> const T * Qt3DCore::QAbstractFunctor::functor_cast(const QAbstractFunctor *other) const -QPropertyUpdatedChange::~QPropertyUpdatedChange() -{ -} + This method is used to cast functor \a other to type T if the other is of + type T (or of subclass); otherwise returns 0. This method works similarly + to \l [QtCore] {qobject_cast(const QObject *object)}{qobject_cast()}, + except with functors derived from QAbstractFunctor. -/*! - * \return property value. - */ -QVariant QPropertyUpdatedChange::value() const -{ - Q_D(const QPropertyUpdatedChange); - return d->m_value; -} + \warning If T was not declared with \l QT3D_FUNCTOR macro, then the results are undefined. + */ -/*! - * Set the property change \a value. - */ -void QPropertyUpdatedChange::setValue(const QVariant &value) +/*! Desctructor */ +QAbstractFunctor::~QAbstractFunctor() { - Q_D(QPropertyUpdatedChange); - d->m_value = value; + } } // Qt3D QT_END_NAMESPACE + diff --git a/src/core/resources/qframeallocator_p.h b/src/core/geometry/qabstractfunctor.h index 4c2b5a961..9bd6e670b 100644 --- a/src/core/resources/qframeallocator_p.h +++ b/src/core/geometry/qabstractfunctor.h @@ -37,76 +37,71 @@ ** ****************************************************************************/ -#ifndef QT3DCORE_QFRAMEALLOCATOR_P_H -#define QT3DCORE_QFRAMEALLOCATOR_P_H +#ifndef QT3DCORE_QABSTRACTFUNCTOR_H +#define QT3DCORE_QABSTRACTFUNCTOR_H -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifdef QFRAMEALLOCATOR_DEBUG -#include <valgrind/valgrind.h> -#include <valgrind/memcheck.h> -#endif - -#include <QtCore/QDebug> -#include <QtCore/QScopedPointer> -#include <QtCore/QVector> - -#include <Qt3DCore/private/qt3dcore_global_p.h> +#include <Qt3DCore/qt3dcore_global.h> QT_BEGIN_NAMESPACE namespace Qt3DCore { -class QFrameAllocatorPrivate; - -class Q_3DCORE_PRIVATE_EXPORT QFrameAllocator +// This will generate a unique id() function per type +// <=> 1 unique function address per type +template<class T> +struct FunctorType { -public: - explicit QFrameAllocator(uint maxObjectSize, uint alignment = 16, uint pageSize = 128); - ~QFrameAllocator(); - - template<typename T> - T* allocate() + static qintptr id() { - void* ptr = allocateRawMemory(sizeof(T)); - new (ptr) T(); // Don't forget to call the constructor of the object using the placement new operator - return static_cast<T*>(ptr); + // The MSVC linker can under some cases optimize all the template + // functions into a single function. The code below is there to ensure + // that the linker won't collapse all these distincts functions into one + static T *t = nullptr; + return reinterpret_cast<qintptr>(t); } +}; - template<typename T> - void deallocate(T *ptr) - { - ptr->~T(); // Call destructor - deallocateRawMemory(ptr, sizeof(T)); - } +template<class T> +qintptr functorTypeId() +{ + return reinterpret_cast<qintptr>(&FunctorType<T>::id); +} - void* allocateRawMemory(size_t size); +#define QT3D_FUNCTOR(Class) \ + qintptr id() const override { \ + return Qt3DCore::functorTypeId<Class>(); \ + } - void deallocateRawMemory(void *ptr, size_t size); - void clear(); - void trim(); - uint maxObjectSize() const; - uint totalChunkCount() const; - int allocatorPoolSize() const; - bool isEmpty() const; +class Q_3DCORESHARED_EXPORT QAbstractFunctor +{ +public: + QAbstractFunctor() = default; + virtual ~QAbstractFunctor(); + virtual qintptr id() const = 0; + // TODO: Remove when moving a copy of this to Qt3DCore + template<class T> + const T *functor_cast(const QAbstractFunctor *other) const + { + if (other->id() == functorTypeId<T>()) + return static_cast<const T *>(other); + return nullptr; + } private: - Q_DECLARE_PRIVATE(QFrameAllocator) - const QScopedPointer<QFrameAllocatorPrivate> d_ptr; + Q_DISABLE_COPY(QAbstractFunctor) }; -} // Qt3D +template<class T> +const T *functor_cast(const QAbstractFunctor *other) +{ + if (other->id() == functorTypeId<T>()) + return static_cast<const T *>(other); + return nullptr; +} + +} // Qt3DCore QT_END_NAMESPACE -#endif // QFRAMEALLOCATOR_P_H +#endif // QT3DCORE_QABSTRACTFUNCTOR_H diff --git a/src/core/geometry/qattribute.cpp b/src/core/geometry/qattribute.cpp new file mode 100644 index 000000000..6be9c0203 --- /dev/null +++ b/src/core/geometry/qattribute.cpp @@ -0,0 +1,492 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qattribute.h" +#include "qattribute_p.h" +#include <Qt3DCore/qbuffer.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DCore { + +QAttributePrivate::QAttributePrivate() + : QNodePrivate() + , m_buffer(nullptr) + , m_name() + , m_vertexBaseType(QAttribute::Float) + , m_vertexSize(1) + , m_count(0) + , m_byteStride(0) + , m_byteOffset(0) + , m_divisor(0) + , m_attributeType(QAttribute::VertexAttribute) +{ +} + +/*! + * \qmltype Attribute + * \instantiates Qt3DCore::QAttribute + * \inqmlmodule Qt3D.Core + * \brief Defines an attribute and how data should be read from a Buffer. + * + * There are 3 types of attributes. + * \list + * \li VertexAttribute: used to define data to be read on a per vertex basis + * \li IndexAttribute: used to define vertex indices when indexed draw calls are + * to be used + *\li DrawIndirectAttribute: used to specify the DrawIndirect buffer to be used + * when indirect draw calls are to be used + * \endlist + * + * \note when an attribute is of type DrawIndirectAttribute, only count, stride + * and offset are relevant. + * + * When providing your own attributes, it may make sense to name your attribute + * using helpers such as QAttribute::defaultPositionAttributeName() as that + * will ensure your geometry will be compatible with picking and the various + * materials provided in the Qt3DExtras module. + */ + +/*! + * \class Qt3DCore::QAttribute + * \inheaderfile Qt3DCore/QAttribute + * \inmodule Qt3DCore + * + * \inherits Qt3DCore::QNode + * + * \brief Defines an attribute and how data should be read from a QBuffer. + * + * There are 3 types of attributes. + * \list + * \li VertexAttribute: used to define data to be read on a per vertex basis + * \li IndexAttribute: used to define vertex indices when indexed draw calls are + * to be used + *\li DrawIndirectAttribute: used to specify the DrawIndirect buffer to be used + * when indirect draw calls are to be used + * \endlist + * + * \note when an attribute is of type DrawIndirectAttribute, only count, stride + * and offset are relevant. + * + * When providing your own attributes, it may make sense to name your attribute + * using helpers such as QAttribute::defaultPositionAttributeName() as that + * will ensure your geometry will be compatible with picking and the various + * materials provided in the Qt3DExtras module. + * + * \sa QBuffer + */ + +/*! + * \typedef Qt3DCore::QBufferPtr + * \relates Qt3DCore::QAttribute + */ + +/*! + * \enum QAttribute::AttributeType + * + * The type of the attribute. + * + * \value VertexAttribute + * \value IndexAttribute + * \value DrawIndirectAttribute + */ + +/*! + * \enum QAttribute::VertexBaseType + * + * The type of the data. + * + * \value Byte + * \value UnsignedByte + * \value Short + * \value UnsignedShort + * \value Int + * \value UnsignedInt + * \value HalfFloat + * \value Float + * \value Double + */ + +/*! + * Constructs a new QAttribute with \a parent. + */ +QAttribute::QAttribute(QNode *parent) + : QNode(*new QAttributePrivate(), parent) +{ +} + +/*! + * Constructs a new QAttribute from \a buf of \a type, \a dataSize, \a count, \a offset, + * and \a stride with \a parent. + */ +QAttribute::QAttribute(QBuffer *buf, VertexBaseType type, uint dataSize, uint count, uint offset, uint stride, QNode *parent) + : QAttribute(parent) +{ + Q_D(QAttribute); + setBuffer(buf); + d->m_count = count; + d->m_byteOffset = offset; + d->m_vertexBaseType = type; + d->m_vertexSize = dataSize; + d->m_byteStride = stride; +} + + +/*! + * Constructs a new QAttribute named \a name from \a buf of \a type, \a + * dataSize, \a count, \a offset, and \a stride with \a parent. + */ +QAttribute::QAttribute(QBuffer *buf, const QString &name, VertexBaseType type, uint dataSize, uint count, uint offset, uint stride, QNode *parent) + : QAttribute(parent) +{ + Q_D(QAttribute); + setBuffer(buf); + d->m_name = name; + d->m_count = count; + d->m_byteOffset = offset; + d->m_vertexBaseType = type; + d->m_vertexSize = dataSize; + d->m_byteStride = stride; +} + +/*! \internal */ +QAttribute::~QAttribute() +{ +} + +/*! + * \property QAttribute::buffer + * + * Holds the buffer. + */ +QBuffer *QAttribute::buffer() const +{ + Q_D(const QAttribute); + return d->m_buffer; +} + +/*! + * \property QAttribute::name + * + * Holds the name. + */ +QString QAttribute::name() const +{ + Q_D(const QAttribute); + return d->m_name; +} + +/*! + * \property QAttribute::vertexSize + * + * Holds the data size, it can only be 1 to 4 units (scalars and vectors), + * 9 units (3x3 matrices) or 16 units (4x4 matrices). + */ +uint QAttribute::vertexSize() const +{ + Q_D(const QAttribute); + return d->m_vertexSize; +} + +/*! + * \property QAttribute::vertexBaseType + * + * Holds the data type. + */ +QAttribute::VertexBaseType QAttribute::vertexBaseType() const +{ + Q_D(const QAttribute); + return d->m_vertexBaseType; +} + +/*! + * \property QAttribute::count + * + * Holds the count. + */ +uint QAttribute::count() const +{ + Q_D(const QAttribute); + return d->m_count; +} + +/*! + * \property QAttribute::byteStride + * + * Holds the byte stride. + */ +uint QAttribute::byteStride() const +{ + Q_D(const QAttribute); + return d->m_byteStride; +} + +/*! + * \property QAttribute::byteOffset + * + * Holds the byte offset. + */ +uint QAttribute::byteOffset() const +{ + Q_D(const QAttribute); + return d->m_byteOffset; +} + +/*! + * \property QAttribute::divisor + * + * Holds the divisor. + */ +uint QAttribute::divisor() const +{ + Q_D(const QAttribute); + return d->m_divisor; +} + +/*! + * \property QAttribute::attributeType + * + * Holds the attribute type. + */ +QAttribute::AttributeType QAttribute::attributeType() const +{ + Q_D(const QAttribute); + return d->m_attributeType; +} + +void QAttribute::setBuffer(QBuffer *buffer) +{ + Q_D(QAttribute); + if (d->m_buffer == buffer) + return; + + if (d->m_buffer) + d->unregisterDestructionHelper(d->m_buffer); + + // We need to add it as a child of the current node if it has been declared inline + // Or not previously added as a child of the current node so that + // 1) The backend gets notified about it's creation + // 2) When the current node is destroyed, it gets destroyed as well + if (buffer && !buffer->parent()) + buffer->setParent(this); + + d->m_buffer = buffer; + + // Ensures proper bookkeeping + if (d->m_buffer) + d->registerDestructionHelper(d->m_buffer, &QAttribute::setBuffer, d->m_buffer); + + emit bufferChanged(buffer); +} + +void QAttribute::setName(const QString &name) +{ + Q_D(QAttribute); + if (d->m_name == name) + return; + + d->m_name = name; + emit nameChanged(name); +} + +void QAttribute::setVertexBaseType(VertexBaseType type) +{ + Q_D(QAttribute); + + if (d->m_vertexBaseType == type) + return; + + d->m_vertexBaseType = type; + emit vertexBaseTypeChanged(type); + emit dataTypeChanged(type); +} + +void QAttribute::setVertexSize(uint size) +{ + Q_D(QAttribute); + if (d->m_vertexSize == size) + return; + Q_ASSERT((size >= 1 && size <= 4) || (size == 9) || (size == 16)); + d->m_vertexSize = size; + emit vertexSizeChanged(size); + emit dataSizeChanged(size); +} + +void QAttribute::setCount(uint count) +{ + Q_D(QAttribute); + if (d->m_count == count) + return; + + d->m_count = count; + emit countChanged(count); +} + +void QAttribute::setByteStride(uint byteStride) +{ + Q_D(QAttribute); + if (d->m_byteStride == byteStride) + return; + + d->m_byteStride = byteStride; + emit byteStrideChanged(byteStride); +} + +void QAttribute::setByteOffset(uint byteOffset) +{ + Q_D(QAttribute); + if (d->m_byteOffset == byteOffset) + return; + + d->m_byteOffset = byteOffset; + emit byteOffsetChanged(byteOffset); +} + +void QAttribute::setDivisor(uint divisor) +{ + Q_D(QAttribute); + if (d->m_divisor == divisor) + return; + + d->m_divisor = divisor; + emit divisorChanged(divisor); +} + +void QAttribute::setAttributeType(AttributeType attributeType) +{ + Q_D(QAttribute); + if (d->m_attributeType == attributeType) + return; + + d->m_attributeType = attributeType; + emit attributeTypeChanged(attributeType); +} +/*! + * \brief QAttribute::defaultPositionAttributeName + * \return the name of the default position attribute + */ +QString QAttribute::defaultPositionAttributeName() +{ + return QStringLiteral("vertexPosition"); +} +/*! + * \brief QAttribute::defaultNormalAttributeName + * \return the name of the default normal attribute + */ +QString QAttribute::defaultNormalAttributeName() +{ + return QStringLiteral("vertexNormal"); +} +/*! + * \brief QAttribute::defaultColorAttributeName + * \return the name of the default color attribute + */ +QString QAttribute::defaultColorAttributeName() +{ + return QStringLiteral("vertexColor"); +} +/*! + * \brief QAttribute::defaultTextureCoordinateAttributeName + * \return the name of the default texture coordinate attribute + */ +QString QAttribute::defaultTextureCoordinateAttributeName() +{ + return QStringLiteral("vertexTexCoord"); +} +/*! + * \brief QAttribute::defaultTangentAttributeName + * \return the name of the default tangent attribute + */ +QString QAttribute::defaultTangentAttributeName() +{ + return QStringLiteral("vertexTangent"); +} + +/*! + * \brief QAttribute::defaultJointIndicesAttributeName + * \return the name of the default joint indices attribute + */ +QString QAttribute::defaultJointIndicesAttributeName() +{ + return QStringLiteral("vertexJointIndices"); +} + +/*! + * \brief QAttribute::defaultJointIndicesAttributeName + * \return the name of the default joint weights attribute + */ +QString QAttribute::defaultJointWeightsAttributeName() +{ + return QStringLiteral("vertexJointWeights"); +} + +/*! + * \brief QAttribute::defaultTextureCoordinate1AttributeName + * \return the name of the default attribute for the second layer of texture + * coordinates + */ +QString QAttribute::defaultTextureCoordinate1AttributeName() +{ + return QStringLiteral("vertexTexCoord1"); +} + +/*! + * \brief QAttribute::defaultTextureCoordinate2AttributeName + * \return the name of the default attribute for the third layer of texture + * coordinates + */ +QString QAttribute::defaultTextureCoordinate2AttributeName() +{ + return QStringLiteral("vertexTexCoord2"); +} + +/*! +\fn Qt3DCore::QAttribute::dataSizeChanged(uint vertexSize) + +The signal is emitted with \a vertexSize when the dataSize changes. +*/ +/*! +\fn Qt3DCore::QAttribute::dataTypeChanged(Qt3DCore::QAttribute::VertexBaseType vertexBaseType) + +The signal is emitted with \a vertexBaseType when the dataType changed. +*/ + +} // Qt3DCore + +QT_END_NAMESPACE diff --git a/src/core/geometry/qattribute.h b/src/core/geometry/qattribute.h new file mode 100644 index 000000000..aa0e5ce8b --- /dev/null +++ b/src/core/geometry/qattribute.h @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3DCORE_QATTRIBUTE_H +#define QT3DCORE_QATTRIBUTE_H + +#include <Qt3DCore/qt3dcore_global.h> +#include <Qt3DCore/qnode.h> +#include <QtCore/QSharedPointer> + +QT_BEGIN_NAMESPACE + +namespace Qt3DCore { + +class QBuffer; +class QAttributePrivate; + +typedef QSharedPointer<QBuffer> QBufferPtr; + +class Q_3DCORESHARED_EXPORT QAttribute : public QNode +{ + Q_OBJECT + Q_PROPERTY(Qt3DCore::QBuffer *buffer READ buffer WRITE setBuffer NOTIFY bufferChanged) + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + Q_PROPERTY(VertexBaseType vertexBaseType READ vertexBaseType WRITE setVertexBaseType NOTIFY vertexBaseTypeChanged) + Q_PROPERTY(uint vertexSize READ vertexSize WRITE setVertexSize NOTIFY vertexSizeChanged) + Q_PROPERTY(uint count READ count WRITE setCount NOTIFY countChanged) + Q_PROPERTY(uint byteStride READ byteStride WRITE setByteStride NOTIFY byteStrideChanged) + Q_PROPERTY(uint byteOffset READ byteOffset WRITE setByteOffset NOTIFY byteOffsetChanged) + Q_PROPERTY(uint divisor READ divisor WRITE setDivisor NOTIFY divisorChanged) + Q_PROPERTY(AttributeType attributeType READ attributeType WRITE setAttributeType NOTIFY attributeTypeChanged) + Q_PROPERTY(QString defaultPositionAttributeName READ defaultPositionAttributeName CONSTANT) + Q_PROPERTY(QString defaultNormalAttributeName READ defaultNormalAttributeName CONSTANT) + Q_PROPERTY(QString defaultColorAttributeName READ defaultColorAttributeName CONSTANT) + Q_PROPERTY(QString defaultTextureCoordinateAttributeName READ defaultTextureCoordinateAttributeName CONSTANT) + Q_PROPERTY(QString defaultTextureCoordinate1AttributeName READ defaultTextureCoordinate1AttributeName CONSTANT REVISION 11) + Q_PROPERTY(QString defaultTextureCoordinate2AttributeName READ defaultTextureCoordinate2AttributeName CONSTANT REVISION 11) + Q_PROPERTY(QString defaultTangentAttributeName READ defaultTangentAttributeName CONSTANT) + Q_PROPERTY(QString defaultJointIndicesAttributeName READ defaultJointIndicesAttributeName CONSTANT REVISION 10) + Q_PROPERTY(QString defaultJointWeightsAttributeName READ defaultJointWeightsAttributeName CONSTANT REVISION 10) + +public: + enum AttributeType { + VertexAttribute, + IndexAttribute, + DrawIndirectAttribute + }; + + Q_ENUM(AttributeType) // LCOV_EXCL_LINE + + enum VertexBaseType { + Byte = 0, + UnsignedByte, + Short, + UnsignedShort, + Int, + UnsignedInt, + HalfFloat, + Float, + Double + }; + Q_ENUM(VertexBaseType) // LCOV_EXCL_LINE + + explicit QAttribute(QNode *parent = nullptr); + explicit QAttribute(QBuffer *buf, VertexBaseType vertexBaseType, uint vertexSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = nullptr); + explicit QAttribute(QBuffer *buf, const QString &name, VertexBaseType vertexBaseType, uint vertexSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = nullptr); + ~QAttribute(); + + QBuffer *buffer() const; + QString name() const; + VertexBaseType vertexBaseType() const; + uint vertexSize() const; + uint count() const; + uint byteStride() const; + uint byteOffset() const; + uint divisor() const; + AttributeType attributeType() const; + + Q_INVOKABLE static QString defaultPositionAttributeName(); + Q_INVOKABLE static QString defaultNormalAttributeName(); + Q_INVOKABLE static QString defaultColorAttributeName(); + Q_INVOKABLE static QString defaultTextureCoordinateAttributeName(); + Q_INVOKABLE static QString defaultTangentAttributeName(); + static QString defaultJointIndicesAttributeName(); + static QString defaultJointWeightsAttributeName(); + static QString defaultTextureCoordinate1AttributeName(); + static QString defaultTextureCoordinate2AttributeName(); + +public Q_SLOTS: + void setBuffer(QBuffer *buffer); + void setName(const QString &name); + void setVertexBaseType(VertexBaseType type); + void setVertexSize(uint size); + void setCount(uint count); + void setByteStride(uint byteStride); + void setByteOffset(uint byteOffset); + void setDivisor(uint divisor); + void setAttributeType(AttributeType attributeType); + +Q_SIGNALS: + void bufferChanged(QBuffer *buffer); + void nameChanged(const QString &name); + void vertexBaseTypeChanged(VertexBaseType vertexBaseType); + void vertexSizeChanged(uint vertexSize); + void dataTypeChanged(VertexBaseType vertexBaseType); + void dataSizeChanged(uint vertexSize); + void countChanged(uint count); + void byteStrideChanged(uint byteStride); + void byteOffsetChanged(uint byteOffset); + void divisorChanged(uint divisor); + void attributeTypeChanged(AttributeType attributeType); + +private: + Q_DECLARE_PRIVATE(QAttribute) +}; + +} // Qt3DCore + +QT_END_NAMESPACE + +#endif // QT3DCORE_QATTRIBUTE_H diff --git a/src/core/qpostman_p_p.h b/src/core/geometry/qattribute_p.h index 0a34c2e02..755a62207 100644 --- a/src/core/qpostman_p_p.h +++ b/src/core/geometry/qattribute_p.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QT3DCORE_QPOSTMAN_P_P_H -#define QT3DCORE_QPOSTMAN_P_P_H +#ifndef QT3DCORE_QATTRIBUTE_P_H +#define QT3DCORE_QATTRIBUTE_P_H // // W A R N I N G @@ -51,35 +51,37 @@ // We mean it. // -#include <Qt3DCore/qscenechange.h> -#include <private/qobject_p.h> -#include <Qt3DCore/private/qt3dcore_global_p.h> +#include <Qt3DCore/QAttribute> +#include <Qt3DCore/QBuffer> +#include <private/qnode_p.h> +#include <private/qt3dcore_global_p.h> QT_BEGIN_NAMESPACE namespace Qt3DCore { -class QScene; -class QPostman; +class QAttribute; -class Q_3DCORE_PRIVATE_EXPORT QPostmanPrivate : public QObjectPrivate +class Q_3DCORE_PRIVATE_EXPORT QAttributePrivate : public Qt3DCore::QNodePrivate { public: - QPostmanPrivate() - : QObjectPrivate() - , m_scene(nullptr) - { - } + Q_DECLARE_PUBLIC(QAttribute) - static QPostmanPrivate *get(QPostman *q); + QAttributePrivate(); - Q_DECLARE_PUBLIC(QPostman) - QScene *m_scene; - std::vector<QSceneChangePtr> m_batch; + QBuffer *m_buffer; + QString m_name; + QAttribute::VertexBaseType m_vertexBaseType; + uint m_vertexSize; + uint m_count; + uint m_byteStride; + uint m_byteOffset; + uint m_divisor; + QAttribute::AttributeType m_attributeType; }; } // Qt3DCore QT_END_NAMESPACE -#endif // QT3DCORE_QPOSTMAN_P_P_H +#endif // QT3DCORE_QATTRIBUTE_P_H diff --git a/src/core/geometry/qbuffer.cpp b/src/core/geometry/qbuffer.cpp new file mode 100644 index 000000000..a6a13f52e --- /dev/null +++ b/src/core/geometry/qbuffer.cpp @@ -0,0 +1,279 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qbuffer.h" +#include "qbuffer_p.h" +#include <Qt3DCore/private/corelogging_p.h> + +QT_BEGIN_NAMESPACE + +using namespace Qt3DCore; + +namespace Qt3DCore { + +QBufferPrivate::QBufferPrivate() + : QNodePrivate() + , m_usage(QBuffer::StaticDraw) + , m_access(QBuffer::Write) +{ +} + +void QBufferPrivate::setData(const QByteArray &data) +{ + Q_Q(QBuffer); + const bool blocked = q->blockNotifications(true); + m_data = data; + emit q->dataChanged(data); + q->blockNotifications(blocked); +} + +/*! + * \qmltype Buffer + * \instantiates Qt3DCore::QBuffer + * \inqmlmodule Qt3D.Render + * + * \brief Provides a data store for raw data to later be used as vertices or + * uniforms. + */ + +/*! + * \qmlproperty QBuffer::UsageType Buffer::usage + * + * Holds the buffer usage. + */ + +/*! + * \qmlproperty QBuffer::BufferType Buffer::type + * + * Holds the buffer type. + * + * \deprecated + */ + +/*! + * \class Qt3DCore::QBuffer + * \inheaderfile Qt3DCore/QBuffer + * \inmodule Qt3DCore + * + * \inherits Qt3DCore::QNode + * + * \brief Provides a data store for raw data to later be used as vertices or + * uniforms. + * + * Data can be provided directly using QBuffer::setData(). + */ + +/*! + * \fn void Qt3DCore::QBuffer::dataChanged(const QByteArray &bytes) + * + * This signal is emitted with \a bytes when data changes. + */ + +/*! + * \fn void Qt3DCore::QBuffer::dataAvailable() + * + * This signal is emitted when data becomes available. + */ + +/*! + * \enum QBuffer::BufferType + * + * The type of the buffer. + * + * \value VertexBuffer + * GL_ARRAY_BUFFER + * \value IndexBuffer + * GL_ELEMENT_ARRAY_BUFFER + * \value PixelPackBuffer + * GL_PIXEL_PACK_BUFFER + * \value PixelUnpackBuffer + * GL_PIXEL_UNPACK_BUFFER + * \value UniformBuffer + * GL_UNIFORM_BUFFER + * \value ShaderStorageBuffer + * GL_SHADER_STORAGE_BUFFER + * \value DrawIndirectBuffer + * GL_DRAW_INDIRECT_BUFFER + * + * \deprecated + */ + +/*! + * \enum QBuffer::UsageType + * + * The type of the usage. + * + * \value StreamDraw + * GL_STREAM_DRAW + * \value StreamRead + * GL_STREAM_READ + * \value StreamCopy + * GL_STREAM_COPY + * \value StaticDraw + * GL_STATIC_DRAW + * \value StaticRead + * GL_STATIC_READ + * \value StaticCopy + * GL_STATIC_COPY + * \value DynamicDraw + * GL_DYNAMIC_DRAW + * \value DynamicRead + * GL_DYNAMIC_READ + * \value DynamicCopy + * GL_DYNAMIC_COPY + */ + +/*! + * \enum QBuffer::AccessType + * + * \value Write + * Write access + * \value Read + * Read access + * \value ReadWrite + * Write|Read + */ + +/*! + * \typedef Qt3DCore::QBufferDataGeneratorPtr + * \relates Qt3DCore::QBuffer + */ + +/*! + * Constructs a new QBuffer with \a parent. + */ +QBuffer::QBuffer(QNode *parent) + : QNode(*new QBufferPrivate(), parent) +{ +} + +/*! + * \internal + */ +QBuffer::~QBuffer() +{ +} + +/*! + * Sets \a bytes as data. + */ +void QBuffer::setData(const QByteArray &bytes) +{ + Q_D(QBuffer); + if (bytes != d->m_data) { + d->setData(bytes); + d->update(); + } +} + +/*! + * Updates the data by replacing it with \a bytes at \a offset. + */ +void QBuffer::updateData(int offset, const QByteArray &bytes) +{ + Q_D(QBuffer); + Q_ASSERT(offset >= 0 && (offset + bytes.size()) <= d->m_data.size()); + + // Update data + d->m_data.replace(offset, bytes.size(), bytes); + const bool blocked = blockNotifications(true); + emit dataChanged(d->m_data); + blockNotifications(blocked); + + QBufferUpdate updateData; + updateData.offset = offset; + updateData.data = bytes; + setProperty("QT3D_updateData", QVariant::fromValue(updateData)); + d->update(); +} + +/*! + * \return the data. + */ +QByteArray QBuffer::data() const +{ + Q_D(const QBuffer); + return d->m_data; +} + +/*! + * \property QBuffer::usage + * + * Holds the buffer usage. + */ +QBuffer::UsageType QBuffer::usage() const +{ + Q_D(const QBuffer); + return d->m_usage; +} + +void QBuffer::setUsage(QBuffer::UsageType usage) +{ + Q_D(QBuffer); + if (usage != d->m_usage) { + d->m_usage = usage; + emit usageChanged(usage); + } +} + +void QBuffer::setAccessType(QBuffer::AccessType access) +{ + Q_D(QBuffer); + if (d->m_access != access) { + d->m_access = access; + Q_EMIT accessTypeChanged(access); + } +} + +/*! + * \property Qt3DCore::QBuffer::accessType + * + * Returns the \l {QBuffer::}{AccessType} of the buffer. + * + * \sa QBuffer::AccessType + */ +QBuffer::AccessType QBuffer::accessType() const +{ + Q_D(const QBuffer); + return d->m_access; +} + +} // namespace Qt3DCore + +QT_END_NAMESPACE diff --git a/src/core/changes/qscenechange.h b/src/core/geometry/qbuffer.h index 3fc896aca..341ac019d 100644 --- a/src/core/changes/qscenechange.h +++ b/src/core/geometry/qbuffer.h @@ -37,81 +37,75 @@ ** ****************************************************************************/ -#ifndef QT3DCORE_QSCENECHANGE_H -#define QT3DCORE_QSCENECHANGE_H +#ifndef QT3DCORE_QBUFFER_H +#define QT3DCORE_QBUFFER_H -#include <Qt3DCore/qnodeid.h> +#include <Qt3DCore/qnode.h> #include <Qt3DCore/qt3dcore_global.h> #include <QtCore/QSharedPointer> + QT_BEGIN_NAMESPACE namespace Qt3DCore { -enum Q3D_DECL_DEPRECATED ChangeFlag { - NodeCreated = 1 << 0, - NodeDeleted = 1 << 1, - PropertyUpdated = 1 << 2, - PropertyValueAdded = 1 << 3, - PropertyValueRemoved = 1 << 4, - ComponentAdded = 1 << 5, - ComponentRemoved = 1 << 6, - CommandRequested = 1 << 7, - CallbackTriggered = 1 << 8, - AllChanges = 0xFFFFFFFF -}; - -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED -Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag) -Q_DECLARE_OPERATORS_FOR_FLAGS(ChangeFlags) -QT_WARNING_POP +class QBufferPrivate; -class QNode; -class QSceneChangePrivate; - -class Q_3DCORESHARED_EXPORT QSceneChange +class Q_3DCORESHARED_EXPORT QBuffer : public Qt3DCore::QNode { + Q_OBJECT + Q_PROPERTY(UsageType usage READ usage WRITE setUsage NOTIFY usageChanged) + Q_PROPERTY(AccessType accessType READ accessType WRITE setAccessType NOTIFY accessTypeChanged REVISION 9) + public: - enum DeliveryFlag { - BackendNodes = 0x0001, - Nodes = 0x0010, - DeliverToAll = BackendNodes | Nodes + enum UsageType + { + StreamDraw = 0x88E0, // GL_STREAM_DRAW + StreamRead = 0x88E1, // GL_STREAM_READ + StreamCopy = 0x88E2, // GL_STREAM_COPY + StaticDraw = 0x88E4, // GL_STATIC_DRAW + StaticRead = 0x88E5, // GL_STATIC_READ + StaticCopy = 0x88E6, // GL_STATIC_COPY + DynamicDraw = 0x88E8, // GL_DYNAMIC_DRAW + DynamicRead = 0x88E9, // GL_DYNAMIC_READ + DynamicCopy = 0x88EA // GL_DYNAMIC_COPY }; - Q_DECLARE_FLAGS(DeliveryFlags, DeliveryFlag) + Q_ENUM(UsageType) // LCOV_EXCL_LINE - virtual ~QSceneChange(); + enum AccessType { + Write = 0x1, + Read = 0x2, + ReadWrite = Write|Read + }; + Q_ENUM(AccessType) // LCOV_EXCL_LINE - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - ChangeFlag type() const Q_DECL_NOTHROW; - QT_WARNING_POP + explicit QBuffer(Qt3DCore::QNode *parent = nullptr); + ~QBuffer(); - void setDeliveryFlags(DeliveryFlags flags) Q_DECL_NOTHROW; - DeliveryFlags deliveryFlags() const Q_DECL_NOTHROW; + UsageType usage() const; + AccessType accessType() const; - QNodeId subjectId() const Q_DECL_NOTHROW; + void setData(const QByteArray &bytes); + QByteArray data() const; -protected: - Q_DECLARE_PRIVATE(QSceneChange) - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - Q3D_DECL_DEPRECATED explicit QSceneChange(ChangeFlag type, QNodeId subjectId); - Q3D_DECL_DEPRECATED explicit QSceneChange(QSceneChangePrivate &dd, - ChangeFlag type, QNodeId subjectId); - QT_WARNING_POP - QSceneChangePrivate *d_ptr; + Q_INVOKABLE void updateData(int offset, const QByteArray &bytes); -private: - Q_DISABLE_COPY(QSceneChange) -}; +public Q_SLOTS: + void setUsage(UsageType usage); + void setAccessType(AccessType access); -Q_DECLARE_OPERATORS_FOR_FLAGS(QSceneChange::DeliveryFlags) +Q_SIGNALS: + void dataChanged(const QByteArray &bytes); + void usageChanged(UsageType usage); + void accessTypeChanged(AccessType access); + void dataAvailable(); -typedef QSharedPointer<QSceneChange> QSceneChangePtr; +private: + Q_DECLARE_PRIVATE(QBuffer) +}; } // namespace Qt3DCore QT_END_NAMESPACE -#endif // QT3DCORE_QSCENECHANGE_H +#endif // QT3DCORE_QBUFFER_H diff --git a/src/core/qobservableinterface_p.h b/src/core/geometry/qbuffer_p.h index e4d343d63..8baffc13e 100644 --- a/src/core/qobservableinterface_p.h +++ b/src/core/geometry/qbuffer_p.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QT3DCORE_QOBSERVABLEINTERFACE_P_H -#define QT3DCORE_QOBSERVABLEINTERFACE_P_H +#ifndef QT3DCORE_QBUFFER_P_H +#define QT3DCORE_QBUFFER_P_H // // W A R N I N G @@ -51,29 +51,39 @@ // We mean it. // -#include <Qt3DCore/qscenechange.h> - -#include <Qt3DCore/private/qt3dcore_global_p.h> +#include <Qt3DCore/private/qnode_p.h> +#include <Qt3DCore/qbuffer.h> +#include <Qt3DCore/qt3dcore_global.h> +#include <private/qnode_p.h> +#include <QByteArray> QT_BEGIN_NAMESPACE namespace Qt3DCore { -class QLockableObserverInterface; - -class Q_3DCORE_PRIVATE_EXPORT QObservableInterface +class Q_3DCORESHARED_EXPORT QBufferPrivate : public Qt3DCore::QNodePrivate { public: - virtual ~QObservableInterface(); + Q_DECLARE_PUBLIC(QBuffer) + + QBufferPrivate(); - virtual void setArbiter(QLockableObserverInterface *arbiter) = 0; + QByteArray m_data; + QBuffer::UsageType m_usage; + QBuffer::AccessType m_access; -protected: - virtual void notifyObservers(const QSceneChangePtr &e) = 0; + void setData(const QByteArray &data); +}; + +struct QBufferUpdate +{ + int offset; + QByteArray data; }; } // namespace Qt3DCore QT_END_NAMESPACE +Q_DECLARE_METATYPE(Qt3DCore::QBufferUpdate) // LCOV_EXCL_LINE -#endif // QT3DCORE_QOBSERVABLEINTERFACE_P_H +#endif // QT3DCORE_QBUFFER_P_H diff --git a/src/core/geometry/qgeometry.cpp b/src/core/geometry/qgeometry.cpp new file mode 100644 index 000000000..008ad4b3d --- /dev/null +++ b/src/core/geometry/qgeometry.cpp @@ -0,0 +1,264 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgeometry.h" +#include "qgeometryfactory_p.h" +#include "qgeometry_p.h" +#include <private/qnode_p.h> +#include <Qt3DCore/qattribute.h> + +QT_BEGIN_NAMESPACE + +using namespace Qt3DCore; + +QGeometryFactory::~QGeometryFactory() +{ +} + +QGeometryPrivate::QGeometryPrivate() + : QNodePrivate(), + m_boundingVolumePositionAttribute(nullptr) +{ +} + +QGeometryPrivate::~QGeometryPrivate() +{ +} + +void QGeometryPrivate::setExtent(const QVector3D &minExtent, const QVector3D &maxExtent) +{ + Q_Q(QGeometry); + if (m_minExtent != minExtent) { + m_minExtent = minExtent; + emit q->minExtentChanged(minExtent); + } + + if (m_maxExtent != maxExtent) { + m_maxExtent = maxExtent; + emit q->maxExtentChanged(maxExtent); + } +} + +/*! + \qmltype Geometry + \instantiates Qt3DCore::QGeometry + \inqmlmodule Qt3D.Core + \inherits Node + \since 5.7 + \brief Encapsulates geometry. + + A Geometry type is used to group a list of Attribute objects together + to form a geometric shape Qt3D is able to render using GeometryRenderer. + Special attribute can be set in order to calculate bounding volume of the shape. + */ + +/*! + \class Qt3DCore::QGeometry + \inmodule Qt3DCore + \since 5.7 + \brief Encapsulates geometry. + + A Qt3DCore::QGeometry class is used to group a list of Qt3DCore::QAttribute + objects together to form a geometric shape Qt3D is able to render using + Qt3DCore::QGeometryRenderer. Special attribute can be set in order to calculate + bounding volume of the shape. + */ + +/*! + \qmlproperty Attribute Geometry::boundingVolumePositionAttribute + + Holds the attribute used to compute the bounding volume. The bounding volume is used internally + for picking and view frustum culling. + + If unspecified, the system will look for the attribute using the name returned by + QAttribute::defaultPositionAttributeName. + + \sa Attribute + */ +/*! + \qmlproperty list<Attribute> Geometry::attributes + + Holds the list of attributes the geometry comprises of. + */ + +/*! + \property QGeometry::boundingVolumePositionAttribute + + Holds the attribute used to compute the bounding volume. The bounding volume is used internally + for picking and view frustum culling. + + If unspecified, the system will look for the attribute using the name returned by + QAttribute::defaultPositionAttributeName. + + \sa Qt3DCore::QAttribute + */ + + +/*! + Constructs a new QGeometry with \a parent. + */ +QGeometry::QGeometry(QNode *parent) + : QGeometry(*new QGeometryPrivate(), parent) {} + +/*! + \fn Qt3DCore::QGeometryFactory::operator()() + + Returns the generated geometry. +*/ +/*! + \fn bool Qt3DCore::QGeometryFactory::operator==(const QGeometryFactory &other) const = 0 + + Compares the factory with the factory specified in \a other. + Returns true if they are equal. +*/ +/*! + \internal + */ +QGeometry::~QGeometry() +{ +} + +/*! + \internal + */ +QGeometry::QGeometry(QGeometryPrivate &dd, QNode *parent) + : QNode(dd, parent) +{ +} + +/*! + \fn void Qt3DCore::QGeometry::addAttribute(Qt3DCore::QAttribute *attribute) + Adds an \a attribute to this geometry. + */ +void QGeometry::addAttribute(QAttribute *attribute) +{ + Q_ASSERT(attribute); + Q_D(QGeometry); + if (!d->m_attributes.contains(attribute)) { + d->m_attributes.append(attribute); + + // Ensures proper bookkeeping + d->registerDestructionHelper(attribute, &QGeometry::removeAttribute, d->m_attributes); + + // We need to add it as a child of the current node if it has been declared inline + // Or not previously added as a child of the current node so that + // 1) The backend gets notified about it's creation + // 2) When the current node is destroyed, it gets destroyed as well + if (!attribute->parent()) + attribute->setParent(this); + + d->update(); + } +} + +/*! + \fn void Qt3DCore::QGeometry::removeAttribute(Qt3DCore::QAttribute *attribute) + Removes the given \a attribute from this geometry. + */ +void QGeometry::removeAttribute(QAttribute *attribute) +{ + Q_ASSERT(attribute); + Q_D(QGeometry); + d->m_attributes.removeOne(attribute); + // Remove bookkeeping connection + d->unregisterDestructionHelper(attribute); + d->update(); +} + +void QGeometry::setBoundingVolumePositionAttribute(QAttribute *boundingVolumePositionAttribute) +{ + Q_D(QGeometry); + if (d->m_boundingVolumePositionAttribute != boundingVolumePositionAttribute) { + d->m_boundingVolumePositionAttribute = boundingVolumePositionAttribute; + emit boundingVolumePositionAttributeChanged(boundingVolumePositionAttribute); + } +} + +QAttribute *QGeometry::boundingVolumePositionAttribute() const +{ + Q_D(const QGeometry); + return d->m_boundingVolumePositionAttribute; +} + +/*! + \qmlproperty vector3d Geometry::minExtent + + Holds the vertex with the lowest x, y, z position values. + */ + +/*! + \property QGeometry::minExtent + + Holds the vertex with the lowest x, y, z position values. + */ +QVector3D QGeometry::minExtent() const +{ + Q_D(const QGeometry); + return d->m_minExtent; +} + +/*! + \qmlproperty vector3d Geometry::maxExtent + + Holds the vertex with the highest x, y, z position values. + */ + +/*! + \property QGeometry::maxExtent + + Holds the vertex with the highest x, y, z position values. + */ +QVector3D QGeometry::maxExtent() const +{ + Q_D(const QGeometry); + return d->m_maxExtent; +} + +/*! + Returns the list of attributes in this geometry. + */ +QVector<QAttribute *> QGeometry::attributes() const +{ + Q_D(const QGeometry); + return d->m_attributes; +} + +QT_END_NAMESPACE + +#include "moc_qgeometry.cpp" diff --git a/src/core/changes/qpropertyvalueremovedchangebase.h b/src/core/geometry/qgeometry.h index b5ead7d22..a619884a0 100644 --- a/src/core/changes/qpropertyvalueremovedchangebase.h +++ b/src/core/geometry/qgeometry.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -37,34 +37,53 @@ ** ****************************************************************************/ -#ifndef QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_H -#define QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_H +#ifndef QT3DCORE_QGEOMETRY_H +#define QT3DCORE_QGEOMETRY_H -#include <Qt3DCore/qscenechange.h> +#include <Qt3DCore/qnode.h> #include <Qt3DCore/qt3dcore_global.h> -#include <QtCore/qsharedpointer.h> QT_BEGIN_NAMESPACE namespace Qt3DCore { -class QPropertyValueRemovedChangeBasePrivate; +class QAttribute; +class QGeometryPrivate; -class Q_3DCORESHARED_EXPORT QPropertyValueRemovedChangeBase : public QSceneChange +class Q_3DCORESHARED_EXPORT QGeometry : public Qt3DCore::QNode { + Q_OBJECT + Q_PROPERTY(Qt3DCore::QAttribute *boundingVolumePositionAttribute READ boundingVolumePositionAttribute WRITE setBoundingVolumePositionAttribute NOTIFY boundingVolumePositionAttributeChanged) + Q_PROPERTY(QVector3D minExtent READ minExtent NOTIFY minExtentChanged REVISION 13) + Q_PROPERTY(QVector3D maxExtent READ maxExtent NOTIFY maxExtentChanged REVISION 13) public: - ~QPropertyValueRemovedChangeBase(); + explicit QGeometry(Qt3DCore::QNode *parent = nullptr); + ~QGeometry(); + QVector<QAttribute *> attributes() const; + Q_INVOKABLE void addAttribute(Qt3DCore::QAttribute *attribute); + Q_INVOKABLE void removeAttribute(Qt3DCore::QAttribute *attribute); + + QAttribute *boundingVolumePositionAttribute() const; + QVector3D minExtent() const; + QVector3D maxExtent() const; + +public Q_SLOTS: + void setBoundingVolumePositionAttribute(QAttribute *boundingVolumePositionAttribute); + +Q_SIGNALS: + void boundingVolumePositionAttributeChanged(QAttribute *boundingVolumePositionAttribute); + Q_REVISION(13) void minExtentChanged(const QVector3D &minExtent); + Q_REVISION(13) void maxExtentChanged(const QVector3D &maxExtent); protected: - Q_DECLARE_PRIVATE(QPropertyValueRemovedChangeBase) - Q3D_DECL_DEPRECATED explicit QPropertyValueRemovedChangeBase(QNodeId subjectId); - Q3D_DECL_DEPRECATED explicit QPropertyValueRemovedChangeBase(QPropertyValueRemovedChangeBasePrivate &dd, QNodeId subjectId); -}; + explicit QGeometry(QGeometryPrivate &dd, Qt3DCore::QNode *parent = nullptr); -Q3D_DECL_DEPRECATED typedef QSharedPointer<QPropertyValueRemovedChangeBase> QPropertyValueRemovedChangeBasePtr; +private: + Q_DECLARE_PRIVATE(QGeometry) +}; } // namespace Qt3DCore QT_END_NAMESPACE -#endif // QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_H +#endif // QT3DCORE_QGEOMETRY_H diff --git a/src/core/qlockableobserverinterface_p.h b/src/core/geometry/qgeometry_p.h index 57650aba2..467131fbe 100644 --- a/src/core/qlockableobserverinterface_p.h +++ b/src/core/geometry/qgeometry_p.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QT3DCORE_QLOCKABLEOBSERVERINTERFACE_P_H -#define QT3DCORE_QLOCKABLEOBSERVERINTERFACE_P_H +#ifndef QT3DCORE_QGEOMETRY_P_H +#define QT3DCORE_QGEOMETRY_P_H // // W A R N I N G @@ -51,27 +51,36 @@ // We mean it. // -#include <Qt3DCore/private/qobserverinterface_p.h> #include <Qt3DCore/private/qt3dcore_global_p.h> +#include <Qt3DCore/private/qnode_p.h> +#include <Qt3DCore/qgeometry.h> +#include <QVector3D> QT_BEGIN_NAMESPACE namespace Qt3DCore { -typedef std::vector<QSceneChangePtr> QSceneChangeList; +class QAttribute; -class Q_3DCORE_PRIVATE_EXPORT QLockableObserverInterface : public QObserverInterface +class Q_3DCORESHARED_EXPORT QGeometryPrivate : public QNodePrivate { public: - virtual ~QLockableObserverInterface(); - virtual void sceneChangeEventWithLock(const QSceneChangePtr &e) = 0; - virtual void sceneChangeEventWithLock(const QSceneChangeList &e) = 0; + Q_DECLARE_PUBLIC(QGeometry) + QGeometryPrivate(); + ~QGeometryPrivate(); + + void setExtent(const QVector3D &minExtent, const QVector3D &maxExtent); + + + QVector<QAttribute *> m_attributes; + QAttribute *m_boundingVolumePositionAttribute; + QVector3D m_minExtent; + QVector3D m_maxExtent; }; } // namespace Qt3DCore QT_END_NAMESPACE -Q_DECLARE_METATYPE(Qt3DCore::QLockableObserverInterface *) // LCOV_EXCL_LINE +#endif // QT3DCORE_QGEOMETRY_P_H -#endif // QT3DCORE_QLOCKABLEOBSERVERINTERFACE_P_H diff --git a/src/core/changes/qcomponentremovedchange_p.h b/src/core/geometry/qgeometryfactory_p.h index fe84da252..47f3a5281 100644 --- a/src/core/changes/qcomponentremovedchange_p.h +++ b/src/core/geometry/qgeometryfactory_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QT3DCORE_QCOMPONENTREMOVEDCHANGE_P_H -#define QT3DCORE_QCOMPONENTREMOVEDCHANGE_P_H +#ifndef QT3DCORE_QGEOMETRYFACTORY_P_H +#define QT3DCORE_QGEOMETRYFACTORY_P_H // // W A R N I N G @@ -51,33 +51,30 @@ // We mean it. // -#include <Qt3DCore/qnodeid.h> - -#include <Qt3DCore/private/qscenechange_p.h> -#include <Qt3DCore/private/qt3dcore_global_p.h> - -struct QMetaObject; +#include <Qt3DCore/qt3dcore_global.h> +#include <Qt3DCore/qabstractfunctor.h> +#include <QtCore/QSharedPointer> QT_BEGIN_NAMESPACE namespace Qt3DCore { -class QComponent; -class QEntity; +class QGeometry; -class Q_3DCORE_PRIVATE_EXPORT QComponentRemovedChangePrivate : public QSceneChangePrivate +class Q_3DCORESHARED_EXPORT QGeometryFactory : public QAbstractFunctor { public: - QComponentRemovedChangePrivate(const QEntity *entity, const QComponent *component); - - QNodeId m_entityId; - QNodeId m_componentId; - const QMetaObject *m_componentMetaObject; + virtual ~QGeometryFactory(); + virtual QGeometry *operator()() = 0; + virtual bool operator ==(const QGeometryFactory &other) const = 0; }; -} // namespace Qt3DCore +typedef QSharedPointer<QGeometryFactory> QGeometryFactoryPtr; + +} // namespace Qt3DRender QT_END_NAMESPACE -#endif // QT3DCORE_QCOMPONENTREMOVEDCHANGE_P_H +Q_DECLARE_METATYPE(Qt3DCore::QGeometryFactoryPtr) // LCOV_EXCL_LINE +#endif // QT3DCORE_QGEOMETRYFACTORY_P_H diff --git a/src/core/geometry/qgeometryview.cpp b/src/core/geometry/qgeometryview.cpp new file mode 100644 index 000000000..991bca0de --- /dev/null +++ b/src/core/geometry/qgeometryview.cpp @@ -0,0 +1,458 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgeometryview.h" +#include "qgeometryview_p.h" + +QT_BEGIN_NAMESPACE + +using namespace Qt3DCore; + +QGeometryViewPrivate::QGeometryViewPrivate() + : QNodePrivate() + , m_instanceCount(1) + , m_vertexCount(0) + , m_indexOffset(0) + , m_firstInstance(0) + , m_firstVertex(0) + , m_indexBufferByteOffset(0) + , m_restartIndexValue(-1) + , m_verticesPerPatch(0) + , m_primitiveRestart(false) + , m_geometry(nullptr) + , m_primitiveType(QGeometryView::Triangles) +{ +} + +QGeometryViewPrivate::~QGeometryViewPrivate() +{ +} + +/*! + \qmltype GeometryView + \instantiates Qt3DCore::QGeometryView + \inqmlmodule Qt3D.Core + \inherits Node + \since 6.0 + \brief Encapsulates geometry details. + + A GeometryView holds all the information necessary to handle + a Geometry. A Geometry holds the coordinates of the geometry data - + GeometryView specifies how to interpret that data. + */ + +/*! + \class Qt3DCore::QGeometryView + \inmodule Qt3DCore + \since 6.0 + \brief Encapsulates geometry details. + + A GeometryView holds all the information necessary to handle + a Geometry. A Geometry holds the coordinates of the geometry data - + GeometryView specifies how to interpret that data. + */ + + +/*! + \enum QGeometryView::PrimitiveType + + The type of the primitive. + + \value Points List of points + \value Lines List of lines + \value LineLoop Connected group of lines connected at ends forming a loop + \value LineStrip Connected group of lines + \value Triangles List of triangles + \value TriangleStrip List of connected triangles + \value TriangleFan List of connected triagles where all triangles share the first vertex + \value LinesAdjacency Allows geometry shader to access adjacent lines in a line list + \value TrianglesAdjacency Allows geometry shader to access adjacent triangles in a triangle list + \value LineStripAdjacency Allows geometry shader to access adjacent lines in a line strip + \value TriangleStripAdjacency Allows geometry shader to access adjacent triangles in a triangle strip + \value Patches Only primitive type accepted by tesselation shader where a patch consists of arbitrary number of vertices + */ + +/*! + \qmlproperty int GeometryView::instanceCount + + Holds the instance count. + */ + +/*! + \qmlproperty int GeometryView::vertexCount + + Holds the vertex count. + */ + +/*! + \qmlproperty int GeometryView::indexOffset + + Holds the base vertex. + */ + +/*! + \qmlproperty int GeometryView::firstInstance + + Holds the base instance. + */ + +/*! + \qmlproperty int GeometryView::firstVertex + + Holds the first vertex. + */ + +/*! + \qmlproperty int GeometryView::indexBufferByteOffset + + Holds the byte offset into the index buffer. + */ + +/*! + \qmlproperty int GeometryView::restartIndex + + Holds the restart index. + */ + +/*! + \qmlproperty int GeometryView::verticesPerPatch + + Holds vertices per patch. + */ + +/*! + \qmlproperty bool GeometryView::primitiveRestart + + Holds the primitive restart flag. + */ + +/*! + \qmlproperty Geometry GeometryView::geometry + + Holds the geometry. + */ + +/*! + \qmlproperty enumeration GeometryView::primitiveType + + Holds the primitive type. + + \list + \li QGeometryView.Points + \li QGeometryView.Lines + \li QGeometryView.LineLoop + \li QGeometryView.LineStrip + \li QGeometryView.Triangles + \li QGeometryView.TriangleStrip + \li QGeometryView.TriangleFan + \li QGeometryView.LinesAdjacency + \li QGeometryView.TrianglesAdjacency + \li QGeometryView.LineStripAdjacency + \li QGeometryView.TriangleStripAdjacency + \li QGeometryView.Patches + \endlist + \sa Qt3DCore::QGeometryView::PrimitiveType + */ + + +/*! + Constructs a new QGeometryView with \a parent. + */ +QGeometryView::QGeometryView(QNode *parent) + : QNode(*new QGeometryViewPrivate(), parent) +{ +} + +/*! + \internal + */ +QGeometryView::~QGeometryView() +{ +} + +/*! + \internal + */ +QGeometryView::QGeometryView(QGeometryViewPrivate &dd, QNode *parent) + : QNode(dd, parent) +{ +} + +/*! + \property QGeometryView::instanceCount + + Holds the instance count. + */ +int QGeometryView::instanceCount() const +{ + Q_D(const QGeometryView); + return d->m_instanceCount; +} + +/*! + \property QGeometryView::vertexCount + + Holds the primitive count. + */ +int QGeometryView::vertexCount() const +{ + Q_D(const QGeometryView); + return d->m_vertexCount; +} + +/*! + \property QGeometryView::indexOffset + + Holds the base vertex. + */ +int QGeometryView::indexOffset() const +{ + Q_D(const QGeometryView); + return d->m_indexOffset; +} + +/*! + \property QGeometryView::firstInstance + + Holds the base instance. + */ +int QGeometryView::firstInstance() const +{ + Q_D(const QGeometryView); + return d->m_firstInstance; +} + +/*! + \property QGeometryView::firstVertex + + Holds the base vertex. + */ +int QGeometryView::firstVertex() const +{ + Q_D(const QGeometryView); + return d->m_firstVertex; +} + +/*! + \property QGeometryView::indexBufferByteOffset + + Holds the byte offset into the index buffer. + */ +int QGeometryView::indexBufferByteOffset() const +{ + Q_D(const QGeometryView); + return d->m_indexBufferByteOffset; +} + +/*! + \property QGeometryView::restartIndexValue + + Holds the restart index. + */ +int QGeometryView::restartIndexValue() const +{ + Q_D(const QGeometryView); + return d->m_restartIndexValue; +} + +/*! + \property QGeometryView::verticesPerPatch + + Holds vertices per patch. + */ +int QGeometryView::verticesPerPatch() const +{ + Q_D(const QGeometryView); + return d->m_verticesPerPatch; +} + +/*! + \property QGeometryView::primitiveRestartEnabled + + Holds the primitive restart flag. + */ +bool QGeometryView::primitiveRestartEnabled() const +{ + Q_D(const QGeometryView); + return d->m_primitiveRestart; +} + +/*! + \property QGeometryView::geometry + + Holds the geometry. + */ +QGeometry *QGeometryView::geometry() const +{ + Q_D(const QGeometryView); + return d->m_geometry; +} + +/*! + \property QGeometryView::primitiveType + + Holds the primitive type. + */ +QGeometryView::PrimitiveType QGeometryView::primitiveType() const +{ + Q_D(const QGeometryView); + return d->m_primitiveType; +} + +void QGeometryView::setInstanceCount(int instanceCount) +{ + Q_D(QGeometryView); + if (d->m_instanceCount == instanceCount) + return; + + d->m_instanceCount = instanceCount; + emit instanceCountChanged(instanceCount); +} + +void QGeometryView::setVertexCount(int vertexCount) +{ + Q_D(QGeometryView); + if (d->m_vertexCount == vertexCount) + return; + + d->m_vertexCount = vertexCount; + emit vertexCountChanged(vertexCount); +} + +void QGeometryView::setIndexOffset(int indexOffset) +{ + Q_D(QGeometryView); + if (d->m_indexOffset == indexOffset) + return; + + d->m_indexOffset = indexOffset; + emit indexOffsetChanged(indexOffset); +} + +void QGeometryView::setFirstInstance(int firstInstance) +{ + Q_D(QGeometryView); + if (d->m_firstInstance == firstInstance) + return; + + d->m_firstInstance = firstInstance; + emit firstInstanceChanged(firstInstance); +} + +void QGeometryView::setFirstVertex(int firstVertex) +{ + Q_D(QGeometryView); + if (d->m_firstVertex == firstVertex) + return; + + d->m_firstVertex = firstVertex; + emit firstVertexChanged(firstVertex); +} + +void QGeometryView::setIndexBufferByteOffset(int offset) +{ + Q_D(QGeometryView); + if (d->m_indexBufferByteOffset == offset) + return; + + d->m_indexBufferByteOffset = offset; + emit indexBufferByteOffsetChanged(offset); +} + +void QGeometryView::setRestartIndexValue(int index) +{ + Q_D(QGeometryView); + if (index == d->m_restartIndexValue) + return; + + d->m_restartIndexValue = index; + emit restartIndexValueChanged(index); +} + +void QGeometryView::setVerticesPerPatch(int verticesPerPatch) +{ + Q_D(QGeometryView); + if (d->m_verticesPerPatch != verticesPerPatch) { + d->m_verticesPerPatch = verticesPerPatch; + emit verticesPerPatchChanged(verticesPerPatch); + } +} + +void QGeometryView::setPrimitiveRestartEnabled(bool enabled) +{ + Q_D(QGeometryView); + if (enabled == d->m_primitiveRestart) + return; + + d->m_primitiveRestart = enabled; + emit primitiveRestartEnabledChanged(enabled); +} + +void QGeometryView::setGeometry(QGeometry *geometry) +{ + Q_D(QGeometryView); + if (d->m_geometry == geometry) + return; + + if (d->m_geometry) + d->unregisterDestructionHelper(d->m_geometry); + + if (geometry && !geometry->parent()) + geometry->setParent(this); + + d->m_geometry = geometry; + + // Ensures proper bookkeeping + if (d->m_geometry) + d->registerDestructionHelper(d->m_geometry, &QGeometryView::setGeometry, d->m_geometry); + + emit geometryChanged(geometry); +} + +void QGeometryView::setPrimitiveType(QGeometryView::PrimitiveType primitiveType) +{ + Q_D(QGeometryView); + if (d->m_primitiveType == primitiveType) + return; + + d->m_primitiveType = primitiveType; + emit primitiveTypeChanged(primitiveType); +} + +QT_END_NAMESPACE diff --git a/src/core/geometry/qgeometryview.h b/src/core/geometry/qgeometryview.h new file mode 100644 index 000000000..da76f3de0 --- /dev/null +++ b/src/core/geometry/qgeometryview.h @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3DCORE_QGEOMETRYVIEW_H +#define QT3DCORE_QGEOMETRYVIEW_H + +#include <Qt3DCore/qnode.h> +#include <Qt3DCore/qgeometry.h> +#include <Qt3DCore/qt3dcore_global.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DCore { + +class QGeometryViewPrivate; +class QGeometryFactory; + +typedef QSharedPointer<QGeometryFactory> QGeometryFactoryPtr; + +class Q_3DCORESHARED_EXPORT QGeometryView : public Qt3DCore::QNode +{ + Q_OBJECT + Q_PROPERTY(int instanceCount READ instanceCount WRITE setInstanceCount NOTIFY instanceCountChanged) + Q_PROPERTY(int vertexCount READ vertexCount WRITE setVertexCount NOTIFY vertexCountChanged) + Q_PROPERTY(int indexOffset READ indexOffset WRITE setIndexOffset NOTIFY indexOffsetChanged) + Q_PROPERTY(int firstInstance READ firstInstance WRITE setFirstInstance NOTIFY firstInstanceChanged) + Q_PROPERTY(int firstVertex READ firstVertex WRITE setFirstVertex NOTIFY firstVertexChanged) + Q_PROPERTY(int indexBufferByteOffset READ indexBufferByteOffset WRITE setIndexBufferByteOffset NOTIFY indexBufferByteOffsetChanged) + Q_PROPERTY(int restartIndexValue READ restartIndexValue WRITE setRestartIndexValue NOTIFY restartIndexValueChanged) + Q_PROPERTY(int verticesPerPatch READ verticesPerPatch WRITE setVerticesPerPatch NOTIFY verticesPerPatchChanged) + Q_PROPERTY(bool primitiveRestartEnabled READ primitiveRestartEnabled WRITE setPrimitiveRestartEnabled NOTIFY primitiveRestartEnabledChanged) + Q_PROPERTY(Qt3DCore::QGeometry* geometry READ geometry WRITE setGeometry NOTIFY geometryChanged) + Q_PROPERTY(PrimitiveType primitiveType READ primitiveType WRITE setPrimitiveType NOTIFY primitiveTypeChanged) + +public: + explicit QGeometryView(Qt3DCore::QNode *parent = nullptr); + ~QGeometryView(); + + enum PrimitiveType { + Points = 0x0000, + Lines = 0x0001, + LineLoop = 0x0002, + LineStrip = 0x0003, + Triangles = 0x0004, + TriangleStrip = 0x0005, + TriangleFan = 0x0006, + LinesAdjacency = 0x000A, + TrianglesAdjacency = 0x000C, + LineStripAdjacency = 0x000B, + TriangleStripAdjacency = 0x000D, + Patches = 0x000E + }; + Q_ENUM(PrimitiveType) // LCOV_EXCL_LINE + + // how to figure out index count and all the fancy stuff that QMeshData provides for us? + // also how to figure out which attribute(s?) hold the indices? + + int instanceCount() const; + int vertexCount() const; + int indexOffset() const; + int firstInstance() const; + int firstVertex() const; + int indexBufferByteOffset() const; + int restartIndexValue() const; + int verticesPerPatch() const; + bool primitiveRestartEnabled() const; + QGeometry *geometry() const; + PrimitiveType primitiveType() const; + + QGeometryFactoryPtr geometryFactory() const; + void setGeometryFactory(const QGeometryFactoryPtr &factory); + +public Q_SLOTS: + void setInstanceCount(int instanceCount); + void setVertexCount(int vertexCount); + void setIndexOffset(int indexOffset); + void setFirstInstance(int firstInstance); + void setFirstVertex(int firstVertex); + void setIndexBufferByteOffset(int offset); + void setRestartIndexValue(int index); + void setVerticesPerPatch(int verticesPerPatch); + void setPrimitiveRestartEnabled(bool enabled); + void setGeometry(QGeometry *geometry); + void setPrimitiveType(PrimitiveType primitiveType); + +Q_SIGNALS: + void instanceCountChanged(int instanceCount); + void vertexCountChanged(int vertexCount); + void indexOffsetChanged(int indexOffset); + void firstInstanceChanged(int firstInstance); + void firstVertexChanged(int firstVertex); + void indexBufferByteOffsetChanged(int offset); + void restartIndexValueChanged(int restartIndexValue); + void verticesPerPatchChanged(int verticesPerPatch); + void primitiveRestartEnabledChanged(bool primitiveRestartEnabled); + void geometryChanged(QGeometry *geometry); + void primitiveTypeChanged(PrimitiveType primitiveType); + +protected: + explicit QGeometryView(QGeometryViewPrivate &dd, Qt3DCore::QNode *parent = nullptr); + +private: + Q_DECLARE_PRIVATE(QGeometryView) +}; + +} // namespace Qt3DCore + +QT_END_NAMESPACE + +#endif // QT3DCORE_QGEOMETRYVIEW_H diff --git a/src/core/changes/qcomponentaddedchange_p.h b/src/core/geometry/qgeometryview_p.h index 2a600288d..ff8ff4880 100644 --- a/src/core/changes/qcomponentaddedchange_p.h +++ b/src/core/geometry/qgeometryview_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QT3DCORE_QCOMPONENTADDEDCHANGE_P_H -#define QT3DCORE_QCOMPONENTADDEDCHANGE_P_H +#ifndef QT3DCORE_QGEOMETRYVIEW_P_H +#define QT3DCORE_QGEOMETRYVIEW_P_H // // W A R N I N G @@ -51,33 +51,41 @@ // We mean it. // -#include <Qt3DCore/qnodeid.h> - -#include <Qt3DCore/private/qscenechange_p.h> +#include <Qt3DCore/private/qnode_p.h> +#include <Qt3DCore/qgeometryview.h> +#include <Qt3DCore/private/qgeometryfactory_p.h> #include <Qt3DCore/private/qt3dcore_global_p.h> - -struct QMetaObject; +#include <memory> QT_BEGIN_NAMESPACE namespace Qt3DCore { -class QComponent; -class QEntity; - -class Q_3DCORE_PRIVATE_EXPORT QComponentAddedChangePrivate : public QSceneChangePrivate +class Q_3DCORESHARED_EXPORT QGeometryViewPrivate : public Qt3DCore::QNodePrivate { public: - QComponentAddedChangePrivate(const QEntity *entity, const QComponent *component); + QGeometryViewPrivate(); + ~QGeometryViewPrivate(); - QNodeId m_entityId; - QNodeId m_componentId; - const QMetaObject *m_componentMetaObject; + Q_DECLARE_PUBLIC(QGeometryView) + + int m_instanceCount; + int m_vertexCount; + int m_indexOffset; + int m_firstInstance; + int m_firstVertex; + int m_indexBufferByteOffset; + int m_restartIndexValue; + int m_verticesPerPatch; + bool m_primitiveRestart; + QGeometry *m_geometry; + QGeometryView::PrimitiveType m_primitiveType; }; } // namespace Qt3DCore QT_END_NAMESPACE -#endif // QT3DCORE_QCOMPONENTADDEDCHANGE_P_H + +#endif // QT3DCORE_QGEOMETRYVIEW_P_H diff --git a/src/core/jobs/qaspectjob.cpp b/src/core/jobs/qaspectjob.cpp index 0a2ee9841..557756581 100644 --- a/src/core/jobs/qaspectjob.cpp +++ b/src/core/jobs/qaspectjob.cpp @@ -40,6 +40,9 @@ #include "qaspectjob.h" #include "qaspectjob_p.h" +#include <Qt3DCore/qaspectengine.h> +#include <Qt3DCore/private/qaspectengine_p.h> + #include <QtCore/QByteArray> QT_BEGIN_NAMESPACE @@ -91,7 +94,7 @@ QAspectJob::QAspectJob() /*! * \fn void Qt3DCore::QAspectJob::run() - * Executes the job. + * Executes the job. This is called on a separate thread by the scheduler. */ /*! @@ -146,11 +149,28 @@ QVector<QWeakPointer<QAspectJob> > QAspectJob::dependencies() const return d->m_dependencies; } -void QAspectJob::postFrame(QAspectManager *aspectManager) +/*! + * This is called, in the main thread, when all the jobs have completed. + * It's a good point to push changes back to the frontend. + */ +void QAspectJob::postFrame(QAspectEngine *aspectEngine) +{ + Q_D(QAspectJob); + if (aspectEngine) { + auto manager = QAspectEnginePrivate::get(aspectEngine)->m_aspectManager; + d->postFrame(manager); + } +} + +/*! + * Should return true (default) if the job has actually something to do. + * If returning false, the job will not be scheduled (but it's dependencies + * will be). + */ +bool QAspectJob::isRequired() { Q_D(QAspectJob); - if (aspectManager) - d->postFrame(aspectManager); + return d->isRequired(); } } // namespace Qt3DCore diff --git a/src/core/jobs/qaspectjob.h b/src/core/jobs/qaspectjob.h index 7cc784e0f..c618c3c19 100644 --- a/src/core/jobs/qaspectjob.h +++ b/src/core/jobs/qaspectjob.h @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE namespace Qt3DCore { class QAspectJobPrivate; -class QAspectManager; +class QAspectEngine; class Q_3DCORESHARED_EXPORT QAspectJob { @@ -63,7 +63,8 @@ public: QVector<QWeakPointer<QAspectJob> > dependencies() const; virtual void run() = 0; - void postFrame(QAspectManager *aspectManager); + virtual void postFrame(QAspectEngine *aspectEngine); + virtual bool isRequired(); protected: explicit QAspectJob(QAspectJobPrivate &dd); diff --git a/src/core/nodes/nodes.pri b/src/core/nodes/nodes.pri index 785ae2b21..097f1cbc7 100644 --- a/src/core/nodes/nodes.pri +++ b/src/core/nodes/nodes.pri @@ -13,7 +13,6 @@ HEADERS += \ $$PWD/qnodevisitor_p.h \ $$PWD/propertychangehandler_p.h \ $$PWD/qdestructionidandtypecollector_p.h \ - $$PWD/qnodecreatedchangegenerator_p.h \ $$PWD/qabstractnodefactory_p.h SOURCES += \ @@ -25,5 +24,4 @@ SOURCES += \ $$PWD/qnodevisitor.cpp \ $$PWD/qabstractnodefactory.cpp \ $$PWD/propertychangehandler.cpp \ - $$PWD/qdestructionidandtypecollector.cpp \ - $$PWD/qnodecreatedchangegenerator.cpp + $$PWD/qdestructionidandtypecollector.cpp diff --git a/src/core/nodes/qbackendnode.cpp b/src/core/nodes/qbackendnode.cpp index 4138ea060..4d15e1789 100644 --- a/src/core/nodes/qbackendnode.cpp +++ b/src/core/nodes/qbackendnode.cpp @@ -42,8 +42,6 @@ #include <Qt3DCore/qaspectengine.h> #include <Qt3DCore/qnode.h> -#include <Qt3DCore/qnodecommand.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/corelogging_p.h> @@ -59,31 +57,11 @@ QBackendNodeMapper::~QBackendNodeMapper() QBackendNodePrivate::QBackendNodePrivate(QBackendNode::Mode mode) : q_ptr(nullptr) , m_mode(mode) - , m_arbiter(nullptr) , m_enabled(false) { } -// Called by backend thread (renderer or other) while we are locked to sync changes -void QBackendNodePrivate::setArbiter(QLockableObserverInterface *arbiter) -{ - Q_ASSERT(m_mode == QBackendNode::ReadWrite); - m_arbiter = arbiter; -} - -// Called by backend thread/worker threads. We don't need locking -// as setting/unsetting the arbiter cannot happen at that time -void QBackendNodePrivate::notifyObservers(const QSceneChangePtr &e) -{ - Q_ASSERT(m_mode == QBackendNode::ReadWrite); - if (m_arbiter != nullptr) - m_arbiter->sceneChangeEvent(e); -} - -void QBackendNodePrivate::sceneChangeEvent(const QSceneChangePtr &e) -{ - q_func()->sceneChangeEvent(e); -} +QBackendNodePrivate::~QBackendNodePrivate() = default; void QBackendNodePrivate::setEnabled(bool enabled) { @@ -124,7 +102,7 @@ void QBackendNodePrivate::componentRemoved(QNode *frontend) */ /*! - * \fn Qt3DCore::QBackendNode *Qt3DCore::QBackendNodeMapper::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const + * \fn Qt3DCore::QBackendNode *Qt3DCore::QBackendNodeMapper::create(Qt3DCore::QNodeId id) const * * \TODO * @@ -210,61 +188,28 @@ QBackendNode::Mode QBackendNode::mode() const Q_DECL_NOTHROW } /*! - * \internal - */ -QBackendNode::QBackendNode(QBackendNodePrivate &dd) - : d_ptr(&dd) -{ - d_ptr->q_ptr = this; -} - -/*! - * Notifies observers of scene change \a e. - * \obsolete + * \brief QBackendNode::syncFromFrontEnd + * \param frontEnd + * \param firstTime + * + * This is called by the aspect when a \a frontEnd node needs to synchronize it's changes + * with the backend (normally due to property changes). + * + * \a firstTime will be true if the backend node was just created */ -void QBackendNode::notifyObservers(const QSceneChangePtr &e) -{ - Q_D(QBackendNode); - d->notifyObservers(e); -} - -/*! - \obsolete - - Send the command named \a name with contents \a data, - and specify \a replyTo as the command id to which the - reply needs to be sent. -*/ -QNodeCommand::CommandId QBackendNode::sendCommand(const QString &name, - const QVariant &data, - QNodeCommand::CommandId replyTo) +void QBackendNode::syncFromFrontEnd(const QNode *frontEnd, bool firstTime) { - auto e = QNodeCommandPtr::create(peerId()); - e->setName(name); - e->setData(data); - e->setReplyToCommandId(replyTo); - e->setDeliveryFlags(QSceneChange::Nodes); - notifyObservers(e); - return e->commandId(); + Q_UNUSED(frontEnd) + Q_UNUSED(firstTime) } /*! - Send the reply to \a command. - \obsolete -*/ -void QBackendNode::sendReply(const QNodeCommandPtr &command) -{ - command->setDeliveryFlags(QSceneChange::Nodes); - notifyObservers(command); -} - -/*! - * \obsolete + * \internal */ -void QBackendNode::initializeFromPeer(const QNodeCreatedChangeBasePtr &change) +QBackendNode::QBackendNode(QBackendNodePrivate &dd) + : d_ptr(&dd) { - Q_UNUSED(change) - qCDebug(Nodes) << Q_FUNC_INFO << change->metaObject()->className() << "does not override"; + d_ptr->q_ptr = this; } /*! @@ -276,25 +221,6 @@ void QBackendNode::setEnabled(bool enabled) Q_DECL_NOTHROW d->m_enabled = enabled; } -/*! - * \obsolete - */ -void QBackendNode::sceneChangeEvent(const QSceneChangePtr &e) -{ - Q_D(QBackendNode); - - switch (e->type()) { - case PropertyUpdated: { - auto propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e); - if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) - d->m_enabled = propertyChange->value().toBool(); - break; - } - default: - break; - } -} - } // Qt3D QT_END_NAMESPACE diff --git a/src/core/nodes/qbackendnode.h b/src/core/nodes/qbackendnode.h index 691375999..cefa41c52 100644 --- a/src/core/nodes/qbackendnode.h +++ b/src/core/nodes/qbackendnode.h @@ -40,16 +40,14 @@ #ifndef QT3DCORE_QBACKENDNODE_H #define QT3DCORE_QBACKENDNODE_H -#include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/qnodeid.h> -#include <Qt3DCore/qnodecommand.h> -#include <Qt3DCore/qscenechange.h> #include <Qt3DCore/qt3dcore_global.h> QT_BEGIN_NAMESPACE namespace Qt3DCore { +class QNode; class QBackendNodePrivate; class QBackendNode; class QAspectEngine; @@ -62,7 +60,7 @@ class Q_3DCORESHARED_EXPORT QBackendNodeMapper { public: virtual ~QBackendNodeMapper(); - virtual QBackendNode *create(const QNodeCreatedChangeBasePtr &change) const = 0; // TODO QT6 change to only take a NodeId + virtual QBackendNode *create(QNodeId id) const = 0; virtual QBackendNode *get(QNodeId id) const = 0; virtual void destroy(QNodeId id) const = 0; }; @@ -87,23 +85,18 @@ public: Mode mode() const Q_DECL_NOEXCEPT; + virtual void syncFromFrontEnd(const QNode *frontEnd, bool firstTime); + protected: Q_DECLARE_PRIVATE(QBackendNode) explicit QBackendNode(QBackendNodePrivate &dd); - Q3D_DECL_DEPRECATED void notifyObservers(const QSceneChangePtr &e); - Q3D_DECL_DEPRECATED QNodeCommand::CommandId sendCommand(const QString &name, const QVariant &data, - QNodeCommand::CommandId replyTo = QNodeCommand::CommandId()); - Q3D_DECL_DEPRECATED void sendReply(const QNodeCommandPtr &command); - Q3D_DECL_DEPRECATED virtual void sceneChangeEvent(const QSceneChangePtr &e); QBackendNodePrivate *d_ptr; private: Q_DISABLE_COPY(QBackendNode) void setPeerId(QNodeId id) Q_DECL_NOEXCEPT; - Q3D_DECL_DEPRECATED virtual void initializeFromPeer(const QNodeCreatedChangeBasePtr &change); - friend class QBackendNodePropertyChange; friend class QAbstractAspectPrivate; #if defined(QT_BUILD_INTERNAL) friend class QBackendNodeTester; diff --git a/src/core/nodes/qbackendnode_p.h b/src/core/nodes/qbackendnode_p.h index 260eef087..921c83a0b 100644 --- a/src/core/nodes/qbackendnode_p.h +++ b/src/core/nodes/qbackendnode_p.h @@ -53,10 +53,6 @@ #include <Qt3DCore/qbackendnode.h> #include <Qt3DCore/qnodeid.h> - -#include <Qt3DCore/private/qlockableobserverinterface_p.h> -#include <Qt3DCore/private/qobservableinterface_p.h> -#include <Qt3DCore/private/qobserverinterface_p.h> #include <Qt3DCore/private/qt3dcore_global_p.h> QT_BEGIN_NAMESPACE @@ -66,15 +62,11 @@ namespace Qt3DCore { class QNode; class Q_3DCORE_PRIVATE_EXPORT QBackendNodePrivate - : public QObserverInterface - , public QObservableInterface { public: QBackendNodePrivate(QBackendNode::Mode mode); + virtual ~QBackendNodePrivate(); - void setArbiter(QLockableObserverInterface *arbiter) override; - void notifyObservers(const QSceneChangePtr &e) override; - void sceneChangeEvent(const QSceneChangePtr &e) override; void setEnabled(bool enabled); static QBackendNodePrivate *get(QBackendNode *n); @@ -83,7 +75,6 @@ public: QBackendNode *q_ptr; QBackendNode::Mode m_mode; - QLockableObserverInterface *m_arbiter; QNodeId m_peerId; bool m_enabled; diff --git a/src/core/nodes/qentity.cpp b/src/core/nodes/qentity.cpp index 1199dfc4b..ac07faaef 100644 --- a/src/core/nodes/qentity.cpp +++ b/src/core/nodes/qentity.cpp @@ -41,7 +41,6 @@ #include "qentity_p.h" #include <Qt3DCore/qcomponent.h> -#include <Qt3DCore/qnodecreatedchange.h> #include <QtCore/QMetaObject> #include <QtCore/QMetaProperty> @@ -144,7 +143,7 @@ void QEntityPrivate::removeDestroyedComponent(QComponent *comp) Q_CHECK_PTR(comp); qCDebug(Nodes) << Q_FUNC_INFO << comp; - updateNode(comp, nullptr, ComponentRemoved); + updateComponentRelationShip(comp, ComponentRelationshipChange::Removed); m_components.removeOne(comp); // Remove bookkeeping connection @@ -223,7 +222,7 @@ void QEntity::addComponent(QComponent *comp) // Ensures proper bookkeeping d->registerPrivateDestructionHelper(comp, &QEntityPrivate::removeDestroyedComponent); - d->updateNode(comp, nullptr, ComponentAdded); + d->updateComponentRelationShip(comp, ComponentRelationshipChange::Added); static_cast<QComponentPrivate *>(QComponentPrivate::get(comp))->addEntity(this); } @@ -238,7 +237,7 @@ void QEntity::removeComponent(QComponent *comp) static_cast<QComponentPrivate *>(QComponentPrivate::get(comp))->removeEntity(this); - d->updateNode(comp, nullptr, ComponentRemoved); + d->updateComponentRelationShip(comp, ComponentRelationshipChange::Removed); d->m_components.removeOne(comp); @@ -294,35 +293,17 @@ QString QEntityPrivate::dumpSceneGraph() const return dumpSG(q).join('\n'); } -QNodeCreatedChangeBasePtr QEntity::createNodeCreationChange() const +void QEntityPrivate::updateComponentRelationShip(QComponent *component, ComponentRelationshipChange::RelationShip change) { - auto creationChange = QNodeCreatedChangePtr<QEntityData>::create(this); - auto &data = creationChange->data; - - Q_D(const QEntity); - data.parentEntityId = parentEntity() ? parentEntity()->id() : Qt3DCore::QNodeId(); - - // Find all child entities - QQueue<QNode *> queue; - queue.append(childNodes().toList()); - data.childEntityIds.reserve(queue.size()); - while (!queue.isEmpty()) { - auto *child = queue.dequeue(); - auto *childEntity = qobject_cast<QEntity *>(child); - if (childEntity != nullptr) - data.childEntityIds.push_back(childEntity->id()); - else - queue.append(child->childNodes().toList()); + if (m_changeArbiter) { + // Ensure node has its postConstructorInit called if we reach this + // point, we could otherwise endup referencing a node that has yet + // to be created in the backend + QNodePrivate::get(component)->_q_ensureBackendNodeCreated(); + + Q_Q(QEntity); + m_changeArbiter->addDirtyEntityComponentNodes(q, component, change); } - - data.componentIdsAndTypes.reserve(d->m_components.size()); - const QComponentVector &components = d->m_components; - for (QComponent *c : components) { - const auto idAndType = QNodeIdTypePair(c->id(), QNodePrivate::findStaticMetaObject(c->metaObject())); - data.componentIdsAndTypes.push_back(idAndType); - } - - return creationChange; } void QEntity::onParentChanged(QObject *) diff --git a/src/core/nodes/qentity.h b/src/core/nodes/qentity.h index 62398faa1..ab87da4eb 100644 --- a/src/core/nodes/qentity.h +++ b/src/core/nodes/qentity.h @@ -88,8 +88,6 @@ private Q_SLOTS: private: Q_DECLARE_PRIVATE(QEntity) - - QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; typedef QSharedPointer<QEntity> QEntityPtr; diff --git a/src/core/nodes/qentity_p.h b/src/core/nodes/qentity_p.h index 992f81931..d074148c1 100644 --- a/src/core/nodes/qentity_p.h +++ b/src/core/nodes/qentity_p.h @@ -55,6 +55,7 @@ #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qt3dcore_global_p.h> +#include <Qt3DCore/private/qchangearbiter_p.h> QT_BEGIN_NAMESPACE @@ -69,6 +70,7 @@ public : Q_DECLARE_PUBLIC(QEntity) QNodeId parentEntityId() const; + void updateComponentRelationShip(QComponent *component, ComponentRelationshipChange::RelationShip change); template<class T> QVector<T*> componentsOfType() const diff --git a/src/core/nodes/qnode.cpp b/src/core/nodes/qnode.cpp index ad084242f..918ce0827 100644 --- a/src/core/nodes/qnode.cpp +++ b/src/core/nodes/qnode.cpp @@ -43,12 +43,7 @@ #include <Qt3DCore/QComponent> #include <Qt3DCore/qaspectengine.h> -#include <Qt3DCore/qdynamicpropertyupdatedchange.h> #include <Qt3DCore/qentity.h> -#include <Qt3DCore/qnodedestroyedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <QtCore/QChildEvent> #include <QtCore/QEvent> #include <QtCore/QMetaObject> @@ -57,7 +52,6 @@ #include <Qt3DCore/private/corelogging_p.h> #include <Qt3DCore/private/qdestructionidandtypecollector_p.h> #include <Qt3DCore/private/qnodevisitor_p.h> -#include <Qt3DCore/private/qpostman_p.h> #include <Qt3DCore/private/qscene_p.h> #include <Qt3DCore/private/qaspectengine_p.h> #include <Qt3DCore/private/qaspectmanager_p.h> @@ -141,13 +135,6 @@ void QNodePrivate::notifyDestructionChangesAndRemoveFromScene() { Q_Q(QNode); - // We notify the backend that the parent lost us as a child - if (m_changeArbiter != nullptr && !m_parentId.isNull()) { - const auto change = QPropertyNodeRemovedChangePtr::create(m_parentId, q); - change->setPropertyName("children"); - notifyObservers(change); - } - // Tell the backend we are about to be destroyed if (m_hasBackendNode && m_scene && m_scene->engine()) QAspectEnginePrivate::get(m_scene->engine())->removeNode(q); @@ -238,9 +225,7 @@ void QNodePrivate::_q_addChild(QNode *childNode) // we need to catch that to avoid sending more than one new child event // to the backend. childD->m_notifiedParent = true; - const auto change = QPropertyNodeAddedChangePtr::create(m_id, childNode); - change->setPropertyName("children"); - notifyObservers(change); + update(); } // Update the scene @@ -261,13 +246,7 @@ void QNodePrivate::_q_removeChild(QNode *childNode) Q_ASSERT_X(childNode->parent() == q_func(), Q_FUNC_INFO, "not a child of this node"); QNodePrivate::get(childNode)->m_parentId = QNodeId(); - - // We notify the backend that we lost a child - if (m_changeArbiter != nullptr) { - const auto change = QPropertyNodeRemovedChangePtr::create(m_id, childNode); - change->setPropertyName("children"); - notifyObservers(change); - } + update(); } /*! @@ -458,7 +437,7 @@ void QNodePrivate::addEntityComponentToScene(QNode *root) \internal */ // Called in the main thread by QScene -> following QEvent::childAdded / addChild -void QNodePrivate::setArbiter(QLockableObserverInterface *arbiter) +void QNodePrivate::setArbiter(QChangeArbiter *arbiter) { if (m_changeArbiter && m_changeArbiter != arbiter) { unregisterNotifiedProperties(); @@ -467,7 +446,7 @@ void QNodePrivate::setArbiter(QLockableObserverInterface *arbiter) Q_Q(QNode); m_changeArbiter->removeDirtyFrontEndNode(q); } - m_changeArbiter = static_cast<QAbstractArbiter *>(arbiter); + m_changeArbiter = arbiter; if (m_changeArbiter) registerNotifiedProperties(); } @@ -523,53 +502,6 @@ void QNodePrivate::_q_ensureBackendNodeCreated() */ /*! - * Sends the \a change QSceneChangePtr to any QBackendNodes in the registered - * aspects that correspond to this QNode. - * - * You only need to call this function if you wish to send a specific type of - * change in place of the automatic handling. - * - * Note: as of Qt 5.14, change messages are deprecated and should not be used, - * in particular for properties. - */ -void QNode::notifyObservers(const QSceneChangePtr &change) -{ - Q_D(QNode); - d->notifyObservers(change); -} - -/*! - \obsolete - - Called when one or more backend aspects sends a notification \a change to the - current Qt3DCore::QNode instance. - - \note This method should be reimplemented in your subclasses to properly - handle the \a change. -*/ -void QNode::sceneChangeEvent(const QSceneChangePtr &change) -{ - Q_UNUSED(change) - if (change->type() == Qt3DCore::PropertyUpdated) { - // TODO: Do this more efficiently. We could pass the metaobject and property - // index to the animation aspect via the QChannelMapping. This would - // allow us to avoid the propertyIndex lookup here by sending them in - // a new subclass of QPropertyUpdateChange. - // Try to find property and call setter - auto e = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(change); - const QMetaObject *mo = metaObject(); - const int propertyIndex = mo->indexOfProperty(e->propertyName()); - QMetaProperty mp = mo->property(propertyIndex); - bool wasBlocked = blockNotifications(true); - mp.write(this, e->value()); - blockNotifications(wasBlocked); - } else { - // Nothing is handling this change, warn the user. - qWarning() << Q_FUNC_INFO << "sceneChangeEvent should have been subclassed"; - } -} - -/*! \internal */ void QNodePrivate::setScene(QScene *scene) @@ -618,25 +550,6 @@ void QNodePrivate::notifyDynamicPropertyChange(const QByteArray &name, const QVa update(); } -/*! - \internal - */ -// Called by the main thread -void QNodePrivate::notifyObservers(const QSceneChangePtr &change) -{ - Q_ASSERT(change); - - // Don't send notifications if we are blocking - if (m_blockNotifications && change->type() == PropertyUpdated) - return; - - if (m_changeArbiter != nullptr) { - QAbstractPostman *postman = m_changeArbiter->postman(); - if (postman != nullptr) - postman->notifyBackend(change); - } -} - // Inserts this tree into the main Scene tree. // Needed when SceneLoaders provide a cloned tree from the backend // and need to insert it in the main scene tree @@ -682,19 +595,6 @@ void QNodePrivate::update() } } -void QNodePrivate::updateNode(QNode *node, const char *property, ChangeFlag change) -{ - if (m_changeArbiter) { - // Ensure node has its postConstructorInit called if we reach this - // point, we could otherwise endup referencing a node that has yet - // to be created in the backend - QNodePrivate::get(node)->_q_ensureBackendNodeCreated(); - - Q_Q(QNode); - m_changeArbiter->addDirtyFrontEndNode(q, node, property, change); - } -} - /*! \internal */ @@ -1000,21 +900,6 @@ void QNode::clearPropertyTrackings() } /*! - * \obsolete - */ -QNodeCreatedChangeBasePtr QNode::createNodeCreationChange() const -{ - // Uncomment this when implementing new frontend and backend types. - // Any classes that don't override this function will be noticeable here. - // Note that some classes actually don't need to override as they have - // no additional data to send. In those cases this default implementation - // is perfectly fine. - // const QMetaObject *mo = metaObject(); - // qDebug() << Q_FUNC_INFO << mo->className(); - return QNodeCreatedChangeBasePtr::create(this); -} - -/*! \fn Qt3DCore::QNodeCommand::CommandId Qt3DCore::QNodeCommand::inReplyTo() const Returns the id of the original QNodeCommand message that @@ -1052,52 +937,6 @@ QNodeCreatedChangeBasePtr QNode::createNodeCreationChange() const Erases all values that have been saved by the property tracking. */ -/*! - * \brief Sends a command message to the backend node - * \obsolete - * - * Creates a QNodeCommand message and dispatches it to the backend node. The - * command is given and a \a name and some \a data which can be used in the - * backend node to perform various operations. - * This returns a CommandId which can be used to identify the initial command - * when receiving a message in reply. If the command message is to be sent in - * reply to another command, \a replyTo contains the id of that command. - * - * \sa QNodeCommand, QNode::sendReply - */ -QNodeCommand::CommandId QNode::sendCommand(const QString &name, - const QVariant &data, - QNodeCommand::CommandId replyTo) -{ - Q_D(QNode); - - // Bail out early, if we can, to avoid operator new - if (d->m_blockNotifications) - return QNodeCommand::CommandId(0); - - auto e = QNodeCommandPtr::create(d->m_id); - e->setName(name); - e->setData(data); - e->setReplyToCommandId(replyTo); - d->notifyObservers(e); - return e->commandId(); -} - -/*! - * \brief Send a \a command back to the backend node. - * \obsolete - * - * Assumes the command is to be to sent back in reply to itself to the backend node. - * - * \sa QNodeCommand, QNode::sendCommand - */ -void QNode::sendReply(const QNodeCommandPtr &command) -{ - Q_D(QNode); - command->setDeliveryFlags(QSceneChange::BackendNodes); - d->notifyObservers(command); -} - namespace { diff --git a/src/core/nodes/qnode.h b/src/core/nodes/qnode.h index efdec8da5..f24daf63f 100644 --- a/src/core/nodes/qnode.h +++ b/src/core/nodes/qnode.h @@ -40,10 +40,7 @@ #ifndef QT3DCORE_QNODE_H #define QT3DCORE_QNODE_H -#include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/qnodeid.h> -#include <Qt3DCore/qnodecommand.h> -#include <Qt3DCore/qscenechange.h> #include <Qt3DCore/qt3dcore_global.h> #include <QtCore/QObject> @@ -99,10 +96,6 @@ public: void clearPropertyTracking(const QString &propertyName); void clearPropertyTrackings(); - Q3D_DECL_DEPRECATED QNodeCommand::CommandId sendCommand(const QString &name, const QVariant &data = QVariant(), - QNodeCommand::CommandId replyTo = QNodeCommand::CommandId()); - Q3D_DECL_DEPRECATED void sendReply(const QNodeCommandPtr &command); - public Q_SLOTS: void setParent(QNode *parent); void setEnabled(bool isEnabled); @@ -116,12 +109,9 @@ Q_SIGNALS: protected: explicit QNode(QNodePrivate &dd, QNode *parent = nullptr); - Q3D_DECL_DEPRECATED void notifyObservers(const QSceneChangePtr &change); - Q3D_DECL_DEPRECATED virtual void sceneChangeEvent(const QSceneChangePtr &change); private: Q_DECLARE_PRIVATE(QNode) - Q3D_DECL_DEPRECATED virtual QNodeCreatedChangeBasePtr createNodeCreationChange() const; // We only want setParent(QNode *) to be callable // when dealing with QNode objects @@ -135,8 +125,6 @@ private: friend class QAspectEngine; friend class QAspectEnginePrivate; friend class QAbstractAspectPrivate; - friend class QNodeCreatedChangeGenerator; - friend class QPostman; friend class QScene; #if defined(QT_BUILD_INTERNAL) diff --git a/src/core/nodes/qnode_p.h b/src/core/nodes/qnode_p.h index 5aa4c5328..907f0062a 100644 --- a/src/core/nodes/qnode_p.h +++ b/src/core/nodes/qnode_p.h @@ -57,7 +57,6 @@ #include <Qt3DCore/private/propertychangehandler_p.h> #include <Qt3DCore/private/qchangearbiter_p.h> -#include <Qt3DCore/private/qobservableinterface_p.h> #include <Qt3DCore/private/qt3dcore_global_p.h> #include <QtCore/private/qobject_p.h> #include <QQueue> @@ -69,7 +68,7 @@ namespace Qt3DCore { class QNode; class QAspectEngine; -class Q_3DCORE_PRIVATE_EXPORT QNodePrivate : public QObjectPrivate, public QObservableInterface +class Q_3DCORE_PRIVATE_EXPORT QNodePrivate : public QObjectPrivate { public: QNodePrivate(); @@ -80,26 +79,21 @@ public: virtual void setScene(QScene *scene); QScene *scene() const; - void setArbiter(QLockableObserverInterface *arbiter) override; + void setArbiter(QChangeArbiter *arbiter); void notifyPropertyChange(const char *name, const QVariant &value); void notifyDynamicPropertyChange(const QByteArray &name, const QVariant &value); - void notifyObservers(const QSceneChangePtr &change) override; void insertTree(QNode *treeRoot, int depth = 0); void updatePropertyTrackMode(); void update(); - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - void updateNode(QNode *node, const char* property, ChangeFlag change); - QT_WARNING_POP Q_DECLARE_PUBLIC(QNode) // For now this just protects access to the m_changeArbiter. // Later on we may decide to extend support for multiple observers. - QAbstractArbiter *m_changeArbiter; + QChangeArbiter *m_changeArbiter; QMetaObject *m_typeInfo; QScene *m_scene; mutable QNodeId m_id; diff --git a/src/core/nodes/qnodecreatedchangegenerator.cpp b/src/core/nodes/qnodecreatedchangegenerator.cpp deleted file mode 100644 index d91949fb1..000000000 --- a/src/core/nodes/qnodecreatedchangegenerator.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnodecreatedchangegenerator_p.h" - -#include <Qt3DCore/private/qnodevisitor_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QNodeCreatedChangeGenerator::QNodeCreatedChangeGenerator(QNode *rootNode) -{ - QNodeVisitor visitor; - visitor.traverse(rootNode, this, &QNodeCreatedChangeGenerator::createCreationChange); -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/nodes/qnodecreatedchangegenerator_p.h b/src/core/nodes/qnodecreatedchangegenerator_p.h deleted file mode 100644 index 35e5b673e..000000000 --- a/src/core/nodes/qnodecreatedchangegenerator_p.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODECREATEDCHANGEGENERATOR_H -#define QT3DCORE_QNODECREATEDCHANGEGENERATOR_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/qnode.h> -#include <Qt3DCore/qnodecreatedchange.h> -#include <Qt3DCore/qt3dcore_global.h> -#include <QtCore/qvector.h> - -#include <Qt3DCore/private/qnode_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class Q_3DCORE_PRIVATE_EXPORT QNodeCreatedChangeGenerator -{ -public: - QNodeCreatedChangeGenerator(QNode *rootNode); - - QVector<QNodeCreatedChangeBasePtr> creationChanges() const { return m_creationChanges; } - -private: - void createCreationChange(QNode *node) - { - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - const auto creationChange = node->createNodeCreationChange(); - m_creationChanges.push_back(creationChange); - - // Store the metaobject of the node in the QNode so that we have it available - // to us during destruction in the QNode destructor. This allows us to send - // the QNodeId and the metaobject as typeinfo to the backend aspects so they - // in turn can find the correct QBackendNodeMapper object to handle the destruction - // of the corresponding backend nodes. - QNodePrivate *d = QNodePrivate::get(node); - d->m_typeInfo = const_cast<QMetaObject*>(creationChange->metaObject()); - - // Mark this node as having been handled for creation so that it is picked up - d->m_hasBackendNode = true; - QT_WARNING_POP - } - - QVector<QNodeCreatedChangeBasePtr> m_creationChanges; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODECREATEDCHANGEGENERATOR_H diff --git a/src/core/qchangearbiter.cpp b/src/core/qchangearbiter.cpp index e5745b017..678178a44 100644 --- a/src/core/qchangearbiter.cpp +++ b/src/core/qchangearbiter.cpp @@ -39,6 +39,7 @@ #include "qchangearbiter_p.h" +#include <Qt3DCore/qentity.h> #include <Qt3DCore/qcomponent.h> #include <QtCore/QMutexLocker> #include <QtCore/QReadLocker> @@ -47,7 +48,6 @@ #include <Qt3DCore/private/corelogging_p.h> #include <Qt3DCore/private/qabstractaspectjobmanager_p.h> -#include <Qt3DCore/private/qpostman_p.h> #include <Qt3DCore/private/qscene_p.h> #include <mutex> @@ -56,127 +56,14 @@ QT_BEGIN_NAMESPACE namespace Qt3DCore { -/* !\internal - \class Qt3DCore::QChangeArbiter - \inmodule Qt3DCore - \since 5.5 - - \brief Acts as a message router between observables and observers. - - Observables can be of two types: QNode observables and \l {QObservableInterface}s. - QNode notifications are sent from the frontend QNode and delivered to the backend observers. - QObservableInterface notifications are sent from backend nodes to backend observers and/or to the - registered QPostman, which in turn delivers the notifications to the target frontend QNode. - - QNode observables are registered automatically. However, QObservableInterface object have to be registered manually - by providing the QNodeId of the corresponding frontend QNode. - - Observers can be registered to receive messages from a QObservableInterface/QNode observable by providing a QNode NodeUuid. - When a notification from a QObservableInterface is received, it is then sent to all observers observing the - QNode NodeUuid as well as the QPostman to update the frontend QNode. -*/ QChangeArbiter::QChangeArbiter(QObject *parent) : QObject(parent) - , m_jobManager(nullptr) - , m_postman(nullptr) , m_scene(nullptr) { - // The QMutex has to be recursive to handle the case where : - // 1) SyncChanges is called, mutex is locked - // 2) Changes are distributed - // 3) An observer decides to register a new observable upon receiving notification - // 4) registerObserver locks the mutex once again -> we need recursion otherwise deadlock - // 5) Mutex is unlocked - leaving registerObserver - // 6) Mutex is unlocked - leaving SyncChanges } QChangeArbiter::~QChangeArbiter() { - if (m_jobManager != nullptr) - m_jobManager->waitForPerThreadFunction(QChangeArbiter::destroyThreadLocalChangeQueue, this); - m_lockingChangeQueues.clear(); - m_changeQueues.clear(); -} - -void QChangeArbiter::initialize(QAbstractAspectJobManager *jobManager) -{ - Q_CHECK_PTR(jobManager); - m_jobManager = jobManager; - - // Init TLS for the change queues - m_jobManager->waitForPerThreadFunction(QChangeArbiter::createThreadLocalChangeQueue, this); -} - -void QChangeArbiter::distributeQueueChanges(QChangeQueue *changeQueue) -{ - for (int i = 0, n = int(changeQueue->size()); i < n; i++) { - QSceneChangePtr& change = (*changeQueue)[i]; - // Lookup which observers care about the subject this change came from - // and distribute the change to them - if (change.isNull()) - continue; - - if (change->type() == NodeCreated || change->type() == NodeDeleted) { - Q_ASSERT(false); // messages no longer used - } - - const QNodeId nodeId = change->subjectId(); - const auto it = m_nodeObservations.constFind(nodeId); - if (it != m_nodeObservations.cend()) { - const QObserverList &observers = it.value(); - for (const QObserverPair &observer : observers) { - if ((change->type() & observer.first) && - (change->deliveryFlags() & QSceneChange::BackendNodes)) - observer.second->sceneChangeEvent(change); - } - // Also send change to the postman - if (change->deliveryFlags() & QSceneChange::Nodes) { - // Check if QNode actually cares about the change - if (m_postman->shouldNotifyFrontend(change)) - m_postman->sceneChangeEvent(change); - } - } - } - changeQueue->clear(); -} - -QThreadStorage<QChangeArbiter::QChangeQueue *> *QChangeArbiter::tlsChangeQueue() -{ - return &(m_tlsChangeQueue); -} - -void QChangeArbiter::appendChangeQueue(QChangeArbiter::QChangeQueue *queue) -{ - const std::lock_guard<QRecursiveMutex> locker(m_mutex);; - m_changeQueues.append(queue); -} - -void QChangeArbiter::removeChangeQueue(QChangeArbiter::QChangeQueue *queue) -{ - const std::lock_guard<QRecursiveMutex> locker(m_mutex);; - m_changeQueues.removeOne(queue); -} - -void QChangeArbiter::appendLockingChangeQueue(QChangeArbiter::QChangeQueue *queue) -{ - const std::lock_guard<QRecursiveMutex> locker(m_mutex);; - m_lockingChangeQueues.append(queue); -} - -void QChangeArbiter::removeLockingChangeQueue(QChangeArbiter::QChangeQueue *queue) -{ - const std::lock_guard<QRecursiveMutex> locker(m_mutex);; - m_lockingChangeQueues.removeOne(queue); -} - -void QChangeArbiter::syncChanges() -{ - const std::lock_guard<QRecursiveMutex> locker(m_mutex);; - for (QChangeArbiter::QChangeQueue *changeQueue : qAsConst(m_changeQueues)) - distributeQueueChanges(changeQueue); - - for (QChangeQueue *changeQueue : qAsConst(m_lockingChangeQueues)) - distributeQueueChanges(changeQueue); } void QChangeArbiter::setScene(QScene *scene) @@ -184,69 +71,11 @@ void QChangeArbiter::setScene(QScene *scene) m_scene = scene; } -QAbstractPostman *QChangeArbiter::postman() const -{ - return m_postman; -} - QScene *QChangeArbiter::scene() const { return m_scene; } -void QChangeArbiter::registerObserver(QObserverInterface *observer, - QNodeId nodeId, - ChangeFlags changeFlags) -{ - const std::lock_guard<QRecursiveMutex> locker(m_mutex);; - QObserverList &observerList = m_nodeObservations[nodeId]; - observerList.append(QObserverPair(changeFlags, observer)); -} - -void QChangeArbiter::unregisterObserver(QObserverInterface *observer, QNodeId nodeId) -{ - const std::lock_guard<QRecursiveMutex> locker(m_mutex);; - const auto it = m_nodeObservations.find(nodeId); - if (it != m_nodeObservations.end()) { - QObserverList &observers = it.value(); - for (int i = observers.count() - 1; i >= 0; i--) { - if (observers[i].second == observer) - observers.removeAt(i); - } - if (observers.isEmpty()) - m_nodeObservations.erase(it); - } -} - -void QChangeArbiter::sceneChangeEvent(const QSceneChangePtr &e) -{ - // qCDebug(ChangeArbiter) << Q_FUNC_INFO << QThread::currentThread(); - - // Add the change to the thread local storage queue - no locking required => yay! - QChangeQueue *localChangeQueue = m_tlsChangeQueue.localData(); - localChangeQueue->push_back(e); - - emit receivedChange(); - - // qCDebug(ChangeArbiter) << "Change queue for thread" << QThread::currentThread() << "now contains" << localChangeQueue->count() << "items"; -} - -void QChangeArbiter::sceneChangeEventWithLock(const QSceneChangePtr &e) -{ - const std::lock_guard<QRecursiveMutex> locker(m_mutex);; - sceneChangeEvent(e); -} - -void QChangeArbiter::sceneChangeEventWithLock(const QSceneChangeList &e) -{ - const std::lock_guard<QRecursiveMutex> locker(m_mutex);; - QChangeQueue *localChangeQueue = m_tlsChangeQueue.localData(); - qCDebug(ChangeArbiter) << Q_FUNC_INFO << "Handles " << e.size() << " changes at once"; - localChangeQueue->insert(localChangeQueue->end(), e.begin(), e.end()); - - emit receivedChange(); -} - void QChangeArbiter::addDirtyFrontEndNode(QNode *node) { if (!m_dirtyFrontEndNodes.contains(node)) { @@ -255,18 +84,19 @@ void QChangeArbiter::addDirtyFrontEndNode(QNode *node) } } -void QChangeArbiter::addDirtyFrontEndNode(QNode *node, QNode *subNode, const char *property, ChangeFlag change) +void QChangeArbiter::addDirtyEntityComponentNodes(QEntity *entity, QComponent *component, + ComponentRelationshipChange::RelationShip change) { - addDirtyFrontEndNode(node); - m_dirtySubNodeChanges.push_back({node, subNode, change, property}); + addDirtyFrontEndNode(entity); + m_dirtyEntityComponentNodeChanges.push_back({entity, component, change}); } void QChangeArbiter::removeDirtyFrontEndNode(QNode *node) { m_dirtyFrontEndNodes.removeOne(node); - m_dirtySubNodeChanges.erase(std::remove_if(m_dirtySubNodeChanges.begin(), m_dirtySubNodeChanges.end(), [node](const NodeRelationshipChange &elt) { + m_dirtyEntityComponentNodeChanges.erase(std::remove_if(m_dirtyEntityComponentNodeChanges.begin(), m_dirtyEntityComponentNodeChanges.end(), [node](const ComponentRelationshipChange &elt) { return elt.node == node || elt.subNode == node; - }), m_dirtySubNodeChanges.end()); + }), m_dirtyEntityComponentNodeChanges.end()); } QVector<QNode *> QChangeArbiter::takeDirtyFrontEndNodes() @@ -274,72 +104,9 @@ QVector<QNode *> QChangeArbiter::takeDirtyFrontEndNodes() return std::move(m_dirtyFrontEndNodes); } -QVector<NodeRelationshipChange> QChangeArbiter::takeDirtyFrontEndSubNodes() -{ - return std::move(m_dirtySubNodeChanges); -} - -// Either we have the postman or we could make the QChangeArbiter agnostic to the postman -// but that would require adding it to every QObserverList in m_aspectObservations. -void QChangeArbiter::setPostman(QAbstractPostman *postman) -{ - if (m_postman != postman) { - // Unregister old postman here if needed - m_postman = postman; - } -} - -void QChangeArbiter::createUnmanagedThreadLocalChangeQueue(void *changeArbiter) -{ - Q_ASSERT(changeArbiter); - - QChangeArbiter *arbiter = static_cast<QChangeArbiter *>(changeArbiter); - - qCDebug(ChangeArbiter) << Q_FUNC_INFO << QThread::currentThread(); - if (!arbiter->tlsChangeQueue()->hasLocalData()) { - QChangeQueue *localChangeQueue = new QChangeQueue; - arbiter->tlsChangeQueue()->setLocalData(localChangeQueue); - arbiter->appendLockingChangeQueue(localChangeQueue); - } -} - -void QChangeArbiter::destroyUnmanagedThreadLocalChangeQueue(void *changeArbiter) -{ - Q_ASSERT(changeArbiter); - - QChangeArbiter *arbiter = static_cast<QChangeArbiter *>(changeArbiter); - qCDebug(ChangeArbiter) << Q_FUNC_INFO << QThread::currentThread(); - if (arbiter->tlsChangeQueue()->hasLocalData()) { - QChangeQueue *localChangeQueue = arbiter->tlsChangeQueue()->localData(); - arbiter->removeLockingChangeQueue(localChangeQueue); - arbiter->tlsChangeQueue()->setLocalData(nullptr); - } -} - -void QChangeArbiter::createThreadLocalChangeQueue(void *changeArbiter) -{ - Q_CHECK_PTR(changeArbiter); - - QChangeArbiter *arbiter = static_cast<QChangeArbiter *>(changeArbiter); - - qCDebug(ChangeArbiter) << Q_FUNC_INFO << QThread::currentThread(); - if (!arbiter->tlsChangeQueue()->hasLocalData()) { - QChangeQueue *localChangeQueue = new QChangeQueue; - arbiter->tlsChangeQueue()->setLocalData(localChangeQueue); - arbiter->appendChangeQueue(localChangeQueue); - } -} - -void QChangeArbiter::destroyThreadLocalChangeQueue(void *changeArbiter) +QVector<ComponentRelationshipChange> QChangeArbiter::takeDirtyEntityComponentNodes() { - // TODO: Implement me! - Q_UNUSED(changeArbiter); - QChangeArbiter *arbiter = static_cast<QChangeArbiter *>(changeArbiter); - if (arbiter->tlsChangeQueue()->hasLocalData()) { - QChangeQueue *localChangeQueue = arbiter->tlsChangeQueue()->localData(); - arbiter->removeChangeQueue(localChangeQueue); - arbiter->tlsChangeQueue()->setLocalData(nullptr); - } + return std::move(m_dirtyEntityComponentNodeChanges); } } // namespace Qt3DCore diff --git a/src/core/qchangearbiter_p.h b/src/core/qchangearbiter_p.h index 483b46575..91c232d2a 100644 --- a/src/core/qchangearbiter_p.h +++ b/src/core/qchangearbiter_p.h @@ -52,7 +52,6 @@ // #include <Qt3DCore/qnodeid.h> -#include <Qt3DCore/qscenechange.h> #include <QtCore/QFlags> #include <QtCore/QMutex> #include <QtCore/QObject> @@ -62,9 +61,7 @@ #include <QtCore/QVariant> #include <QtCore/QVector> -#include <Qt3DCore/private/qlockableobserverinterface_p.h> #include <Qt3DCore/private/qt3dcore_global_p.h> -#include <Qt3DCore/private/qscenechange_p.h> QT_BEGIN_NAMESPACE @@ -76,103 +73,48 @@ class QAbstractAspectJobManager; class QSceneObserverInterface; class QAbstractPostman; class QScene; +class QEntity; +class QComponent; - -class Q_3DCORE_PRIVATE_EXPORT QAbstractArbiter : public QLockableObserverInterface +struct ComponentRelationshipChange { -public: - virtual QAbstractPostman *postman() const = 0; - virtual void addDirtyFrontEndNode(QNode *node) = 0; - virtual void removeDirtyFrontEndNode(QNode *node) = 0; - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - virtual void addDirtyFrontEndNode(QNode *node, QNode *subNode, const char *property, ChangeFlag change) = 0; - QT_WARNING_POP + QNode *node; + QNode *subNode; + + enum RelationShip { + Added = 0, + Removed + }; + RelationShip change; }; -class Q_3DCORE_PRIVATE_EXPORT QChangeArbiter final +class Q_3DCORE_PRIVATE_EXPORT QChangeArbiter : public QObject - , public QAbstractArbiter { Q_OBJECT public: explicit QChangeArbiter(QObject *parent = nullptr); ~QChangeArbiter(); - void initialize(Qt3DCore::QAbstractAspectJobManager *jobManager); - - void syncChanges(); - - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - void registerObserver(QObserverInterface *observer, - QNodeId nodeId, - ChangeFlags changeFlags = AllChanges); - QT_WARNING_POP - void unregisterObserver(QObserverInterface *observer, - QNodeId nodeId); - - void sceneChangeEvent(const QSceneChangePtr &e) override; // QLockableObserverInterface impl - void sceneChangeEventWithLock(const QSceneChangePtr &e) override; // QLockableObserverInterface impl - void sceneChangeEventWithLock(const QSceneChangeList &e) override; // QLockableObserverInterface impl - - void addDirtyFrontEndNode(QNode *node) override; - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - void addDirtyFrontEndNode(QNode *node, QNode *subNode, const char *property, ChangeFlag change) override; - QT_WARNING_POP - void removeDirtyFrontEndNode(QNode *node) override; + void addDirtyFrontEndNode(QNode *node); + void addDirtyEntityComponentNodes(QEntity *entity, QComponent *component, + ComponentRelationshipChange::RelationShip change); + + void removeDirtyFrontEndNode(QNode *node); QVector<QNode *> takeDirtyFrontEndNodes(); - QVector<NodeRelationshipChange> takeDirtyFrontEndSubNodes(); + QVector<ComponentRelationshipChange> takeDirtyEntityComponentNodes(); - void setPostman(Qt3DCore::QAbstractPostman *postman); void setScene(Qt3DCore::QScene *scene); - QAbstractPostman *postman() const final; QScene *scene() const; - static void createUnmanagedThreadLocalChangeQueue(void *changeArbiter); - static void destroyUnmanagedThreadLocalChangeQueue(void *changeArbiter); - static void createThreadLocalChangeQueue(void *changeArbiter); - static void destroyThreadLocalChangeQueue(void *changeArbiter); - Q_SIGNALS: void receivedChange(); protected: - typedef std::vector<QSceneChangePtr> QChangeQueue; - typedef QPair<ChangeFlags, QObserverInterface *> QObserverPair; - typedef QVector<QObserverPair> QObserverList; - - void distributeQueueChanges(QChangeQueue *queue); - - QThreadStorage<QChangeQueue *> *tlsChangeQueue(); - void appendChangeQueue(QChangeQueue *queue); - void removeChangeQueue(QChangeQueue *queue); - void appendLockingChangeQueue(QChangeQueue *queue); - void removeLockingChangeQueue(QChangeQueue *queue); - -private: - mutable QRecursiveMutex m_mutex; - QAbstractAspectJobManager *m_jobManager; - - // The lists of observers indexed by observable (QNodeId). - // m_nodeObservations is for observables in the main thread's object tree - QHash<QNodeId, QObserverList> m_nodeObservations; - - // Each thread has a TLS ChangeQueue so we never need to lock whilst - // receiving a QSceneChange. - QThreadStorage<QChangeQueue *> m_tlsChangeQueue; - - // We store a list of the ChangeQueue's from each thread. This will only - // be accessed from the aspect thread during the syncChanges() phase. - QList<QChangeQueue *> m_changeQueues; - QList<QChangeQueue *> m_lockingChangeQueues; - QAbstractPostman *m_postman; QScene *m_scene; - QVector<QNode *> m_dirtyFrontEndNodes; - QVector<NodeRelationshipChange> m_dirtySubNodeChanges; + QVector<ComponentRelationshipChange> m_dirtyEntityComponentNodeChanges; }; } // namespace Qt3DCore diff --git a/src/core/qobservableinterface.cpp b/src/core/qobservableinterface.cpp deleted file mode 100644 index 51c4dbbf9..000000000 --- a/src/core/qobservableinterface.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qobservableinterface_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QObservableInterface::~QObservableInterface() -{ -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/qobserverinterface.cpp b/src/core/qobserverinterface.cpp deleted file mode 100644 index 0e452f169..000000000 --- a/src/core/qobserverinterface.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qobserverinterface_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QObserverInterface::~QObserverInterface() -{ -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/qpostman.cpp b/src/core/qpostman.cpp deleted file mode 100644 index 6d6484f18..000000000 --- a/src/core/qpostman.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpostman_p.h" -#include "qpostman_p_p.h" - -#include <Qt3DCore/qnode.h> -#include <Qt3DCore/qpropertyupdatedchange.h> - -#include <Qt3DCore/private/qlockableobserverinterface_p.h> -#include <Qt3DCore/private/qnode_p.h> -#include <Qt3DCore/private/qpropertyupdatedchangebase_p.h> -#include <Qt3DCore/private/qscene_p.h> -#include <QtCore/private/qobject_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPostmanPrivate *QPostmanPrivate::get(QPostman *q) -{ - return q->d_func(); -} - -QPostman::QPostman(QObject *parent) - : QObject(*new QPostmanPrivate, parent) -{ - qRegisterMetaType<QSceneChangePtr >("QSceneChangePtr"); -} - -QPostman::~QPostman() -{ -} - -void QPostman::setScene(QScene *scene) -{ - Q_D(QPostman); - d->m_scene = scene; -} - -static inline QMetaMethod notifyFrontendNodeMethod() -{ - int idx = QPostman::staticMetaObject.indexOfMethod("notifyFrontendNode(QSceneChangePtr)"); - Q_ASSERT(idx != -1); - return QPostman::staticMetaObject.method(idx); -} - -void QPostman::sceneChangeEvent(const QSceneChangePtr &e) -{ - static const QMetaMethod notifyFrontendNode = notifyFrontendNodeMethod(); - notifyFrontendNode.invoke(this, Q_ARG(QSceneChangePtr, e)); -} - -static inline QMetaMethod submitChangeBatchMethod() -{ - int idx = QPostman::staticMetaObject.indexOfMethod("submitChangeBatch()"); - Q_ASSERT(idx != -1); - return QPostman::staticMetaObject.method(idx); -} - -/* - * \internal - * This will start or append \a change to a batch of changes from frontend - * nodes. Once the batch is complete, when the event loop returns, the batch is - * sent to the QChangeArbiter to notify the backend aspects. - */ -void QPostman::notifyBackend(const QSceneChangePtr &change) -{ - // If batch in progress - // add change - // otherwise start batch - // by calling a queued slot - Q_D(QPostman); - if (d->m_batch.empty()) { - static const QMetaMethod submitChangeBatch = submitChangeBatchMethod(); - submitChangeBatch.invoke(this, Qt::QueuedConnection); - } - d->m_batch.push_back(change); -} - -// AspectThread -bool QPostman::shouldNotifyFrontend(const QSceneChangePtr &e) -{ - Q_D(QPostman); - const QPropertyUpdatedChangePtr propertyChange = qSharedPointerDynamicCast<QPropertyUpdatedChange>(e); - if (Q_LIKELY(d->m_scene != nullptr) && !propertyChange.isNull()) { - const QScene::NodePropertyTrackData propertyTrackData - = d->m_scene->lookupNodePropertyTrackData(e->subjectId()); - - const QNode::PropertyTrackingMode trackMode = propertyTrackData.trackedPropertiesOverrides.value(QLatin1String(propertyChange->propertyName()), - propertyTrackData.defaultTrackMode); - - switch (trackMode) { - case QNode::TrackAllValues: - return true; - - case QNode::DontTrackValues: - return false; - - case QNode::TrackFinalValues: { - const bool isIntermediate - = QPropertyUpdatedChangeBasePrivate::get(propertyChange.data())->m_isIntermediate; - return !isIntermediate; - } - - default: - Q_UNREACHABLE(); - return false; - } - } - return true; -} - -// Main Thread -void QPostman::notifyFrontendNode(const QSceneChangePtr &e) -{ - Q_D(QPostman); - if (!e.isNull() && d->m_scene != nullptr) { - QNode *n = d->m_scene->lookupNode(e->subjectId()); - if (n != nullptr) - n->sceneChangeEvent(e); - } -} - -void QPostman::submitChangeBatch() -{ - Q_D(QPostman); - QLockableObserverInterface *arbiter = nullptr; - if (d->m_scene && (arbiter = d->m_scene->arbiter()) != nullptr) { - arbiter->sceneChangeEventWithLock(d->m_batch); - d->m_batch.clear(); - } -} - -} //Qt3D - -QT_END_NAMESPACE diff --git a/src/core/qpostman_p.h b/src/core/qpostman_p.h deleted file mode 100644 index 3e5f91742..000000000 --- a/src/core/qpostman_p.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPOSTMAN_P_H -#define QT3DCORE_QPOSTMAN_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/private/qobserverinterface_p.h> -#include <Qt3DCore/private/qt3dcore_global_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QScene; -class QPostmanPrivate; - -class Q_3DCORE_PRIVATE_EXPORT QAbstractPostman : public QObserverInterface -{ -public: - virtual void setScene(QScene *sceneLookup) = 0; - virtual void notifyBackend(const QSceneChangePtr &change) = 0; - virtual bool shouldNotifyFrontend(const QSceneChangePtr &change) = 0; -}; - -class Q_AUTOTEST_EXPORT QPostman final - : public QObject - , public QAbstractPostman -{ - Q_OBJECT -public: - explicit QPostman(QObject *parent = nullptr); - ~QPostman(); - - void setScene(QScene *sceneLookup) final; - void sceneChangeEvent(const QSceneChangePtr &e) final; - void notifyBackend(const QSceneChangePtr &change) final; - bool shouldNotifyFrontend(const QSceneChangePtr &e) final; - -public Q_SLOTS: - void submitChangeBatch(); - -private: - Q_DECLARE_PRIVATE(QPostman) - Q_INVOKABLE void notifyFrontendNode(const QSceneChangePtr &e); - -}; - -} // Qt3D - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(Qt3DCore::QAbstractPostman*) // LCOV_EXCL_LINE - -#endif // QT3DCORE_QPOSTMAN_P_H diff --git a/src/core/qscene.cpp b/src/core/qscene.cpp index 1b8996e8d..17f89603f 100644 --- a/src/core/qscene.cpp +++ b/src/core/qscene.cpp @@ -43,9 +43,7 @@ #include <QtCore/QHash> #include <QtCore/QReadLocker> -#include <Qt3DCore/private/qlockableobserverinterface_p.h> #include <Qt3DCore/private/qnode_p.h> -#include <Qt3DCore/private/qobservableinterface_p.h> QT_BEGIN_NAMESPACE @@ -65,10 +63,8 @@ public: QAspectEngine *m_engine; QHash<QNodeId, QNode *> m_nodeLookupTable; QMultiHash<QNodeId, QNodeId> m_componentToEntities; - QMultiHash<QNodeId, QObservableInterface *> m_observablesLookupTable; - QHash<QObservableInterface *, QNodeId> m_observableToUuid; QHash<QNodeId, QScene::NodePropertyTrackData> m_nodePropertyTrackModeLookupTable; - QAbstractArbiter *m_arbiter; + QChangeArbiter *m_arbiter; QScopedPointer<NodePostConstructorInit> m_postConstructorInit; mutable QReadWriteLock m_lock; mutable QReadWriteLock m_nodePropertyTrackModeLock; @@ -91,17 +87,6 @@ QAspectEngine *QScene::engine() const return d->m_engine; } -// Called by any thread -void QScene::addObservable(QObservableInterface *observable, QNodeId id) -{ - Q_D(QScene); - QWriteLocker lock(&d->m_lock); - d->m_observablesLookupTable.insert(id, observable); - d->m_observableToUuid.insert(observable, id); - if (d->m_arbiter != nullptr) - observable->setArbiter(d->m_arbiter); -} - // Called by main thread only void QScene::addObservable(QNode *observable) { @@ -114,44 +99,19 @@ void QScene::addObservable(QNode *observable) } } -// Called by any thread -void QScene::removeObservable(QObservableInterface *observable, QNodeId id) -{ - Q_D(QScene); - QWriteLocker lock(&d->m_lock); - d->m_observablesLookupTable.remove(id, observable); - d->m_observableToUuid.remove(observable); - observable->setArbiter(nullptr); -} - // Called by main thread void QScene::removeObservable(QNode *observable) { Q_D(QScene); if (observable != nullptr) { QWriteLocker lock(&d->m_lock); - QNodeId nodeUuid = observable->id(); - const auto p = d->m_observablesLookupTable.equal_range(nodeUuid); // must be non-const equal_range to ensure p.second stays valid - auto it = p.first; - while (it != p.second) { - it.value()->setArbiter(nullptr); - d->m_observableToUuid.remove(it.value()); - it = d->m_observablesLookupTable.erase(it); - } + const QNodeId nodeUuid = observable->id(); d->m_nodeLookupTable.remove(nodeUuid); observable->d_func()->setArbiter(nullptr); } } // Called by any thread -QObservableList QScene::lookupObservables(QNodeId id) const -{ - Q_D(const QScene); - QReadLocker lock(&d->m_lock); - return d->m_observablesLookupTable.values(id); -} - -// Called by any thread QNode *QScene::lookupNode(QNodeId id) const { Q_D(const QScene); @@ -170,26 +130,19 @@ QVector<QNode *> QScene::lookupNodes(const QVector<QNodeId> &ids) const return nodes; } -QNodeId QScene::nodeIdFromObservable(QObservableInterface *observable) const -{ - Q_D(const QScene); - QReadLocker lock(&d->m_lock); - return d->m_observableToUuid.value(observable); -} - QNode *QScene::rootNode() const { Q_D(const QScene); return d->m_rootNode; } -void QScene::setArbiter(QAbstractArbiter *arbiter) +void QScene::setArbiter(QChangeArbiter *arbiter) { Q_D(QScene); d->m_arbiter = arbiter; } -QAbstractArbiter *QScene::arbiter() const +QChangeArbiter *QScene::arbiter() const { Q_D(const QScene); return d->m_arbiter; diff --git a/src/core/qscene_p.h b/src/core/qscene_p.h index cdb85ebe6..b2341b159 100644 --- a/src/core/qscene_p.h +++ b/src/core/qscene_p.h @@ -55,7 +55,6 @@ #include <Qt3DCore/qnode.h> #include <QtCore/qscopedpointer.h> -#include <Qt3DCore/private/qobservableinterface_p.h> #include <Qt3DCore/private/qt3dcore_global_p.h> QT_BEGIN_NAMESPACE @@ -65,9 +64,7 @@ namespace Qt3DCore { class QScenePrivate; class QAspectEngine; class NodePostConstructorInit; -class QAbstractArbiter; - -typedef QList<QObservableInterface *> QObservableList; +class QChangeArbiter; class Q_3DCORE_PRIVATE_EXPORT QScene { @@ -77,20 +74,16 @@ public: QAspectEngine *engine() const; - void addObservable(QObservableInterface *observable, QNodeId id); void addObservable(QNode *observable); - void removeObservable(QObservableInterface *observable, QNodeId id); void removeObservable(QNode *observable); - QObservableList lookupObservables(QNodeId id) const; QNode *lookupNode(QNodeId id) const; QVector<QNode *> lookupNodes(const QVector<QNodeId> &ids) const; - QNodeId nodeIdFromObservable(QObservableInterface *observable) const; QNode *rootNode() const; - void setArbiter(QAbstractArbiter *arbiter); - QAbstractArbiter *arbiter() const; + void setArbiter(QChangeArbiter *arbiter); + QChangeArbiter *arbiter() const; // Component -> Entities QVector<QNodeId> entitiesForComponent(QNodeId id) const; diff --git a/src/core/qscheduler.cpp b/src/core/qscheduler.cpp index c52445a35..6c63fc1c1 100644 --- a/src/core/qscheduler.cpp +++ b/src/core/qscheduler.cpp @@ -140,10 +140,10 @@ int QScheduler::scheduleAndWaitForFrameAspectJobs(qint64 time, bool dumpJobs) QTaskLogger logger(m_aspectManager->serviceLocator()->systemInformation(), 4097, 0, QTaskLogger::AspectJob); for (auto &job : qAsConst(jobQueue)) - QAspectJobPrivate::get(job.data())->postFrame(m_aspectManager); + job->postFrame(m_aspectManager->engine()); for (QAbstractAspect *aspect : aspects) - QAbstractAspectPrivate::get(aspect)->jobsDone(); + aspect->jobsDone(); } return totalJobs; diff --git a/src/core/qt3dcore_global.h b/src/core/qt3dcore_global.h index e932b02ba..b2ad787c0 100644 --- a/src/core/qt3dcore_global.h +++ b/src/core/qt3dcore_global.h @@ -55,12 +55,6 @@ QT_BEGIN_NAMESPACE # define Q_3DCORESHARED_EXPORT #endif -#ifdef BUILD_QT3D_MODULE -#define Q3D_DECL_DEPRECATED -#else -#define Q3D_DECL_DEPRECATED Q_DECL_DEPRECATED -#endif - #define QT3D_DECLARE_TYPEINFO(NS, Class, Flags) \ } /* NS */ \ Q_DECLARE_TYPEINFO(NS :: Class, Flags); \ diff --git a/src/core/qlockableobserverinterface.cpp b/src/core/qurlhelper.cpp index ac0bf4c32..1660714c9 100644 --- a/src/core/qlockableobserverinterface.cpp +++ b/src/core/qurlhelper.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -37,16 +37,32 @@ ** ****************************************************************************/ -#include "qlockableobserverinterface_p.h" +#include "qurlhelper_p.h" QT_BEGIN_NAMESPACE namespace Qt3DCore { -QLockableObserverInterface::~QLockableObserverInterface() +QString QUrlHelper::urlToLocalFileOrQrc(const QUrl &url) { + const QString scheme(url.scheme().toLower()); + if (scheme == QLatin1String("qrc")) { + if (url.authority().isEmpty()) + return QLatin1Char(':') + url.path(); + return QString(); + } + +#if defined(Q_OS_ANDROID) + if (scheme == QLatin1String("assets")) { + if (url.authority().isEmpty()) + return url.toString(); + return QString(); + } +#endif + + return url.toLocalFile(); } -} // namespace Qt3DCore +} // Qt3DCore QT_END_NAMESPACE diff --git a/src/core/qobserverinterface_p.h b/src/core/qurlhelper_p.h index d19905dd2..b545ece12 100644 --- a/src/core/qobserverinterface_p.h +++ b/src/core/qurlhelper_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QT3DCORE_QOBSERVERINTERFACE_P_H -#define QT3DCORE_QOBSERVERINTERFACE_P_H +#ifndef QT3DCORE_QURLHELPER_P_H +#define QT3DCORE_QURLHELPER_P_H // // W A R N I N G @@ -51,23 +51,21 @@ // We mean it. // -#include <Qt3DCore/qscenechange.h> +#include <Qt3DCore/qt3dcore_global.h> +#include <QUrl> QT_BEGIN_NAMESPACE namespace Qt3DCore { -class Q_3DCORESHARED_EXPORT QObserverInterface +class Q_3DCORESHARED_EXPORT QUrlHelper { public: - virtual ~QObserverInterface(); - virtual void sceneChangeEvent(const QSceneChangePtr &e) = 0; + static QString urlToLocalFileOrQrc(const QUrl &url); }; -} // namespace Qt3DCore +} // Qt3DCore QT_END_NAMESPACE -Q_DECLARE_METATYPE(Qt3DCore::QObserverInterface *) // LCOV_EXCL_LINE - -#endif // QT3DCORE_QOBSERVERINTERFACE_P_H +#endif // QT3DCORE_QURLHELPER_P_H diff --git a/src/core/resources/qboundedcircularbuffer_p.h b/src/core/resources/qboundedcircularbuffer_p.h deleted file mode 100644 index 22299d7da..000000000 --- a/src/core/resources/qboundedcircularbuffer_p.h +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QBOUNDEDCIRCULARBUFFER_P_H -#define QT3DCORE_QBOUNDEDCIRCULARBUFFER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/QReadWriteLock> -#include <QtCore/QReadLocker> -#include <QtCore/QSemaphore> -#include <QtCore/QtGlobal> - -#include <Qt3DCore/private/qcircularbuffer_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -template <class T> -class QBoundedCircularBuffer -{ -public: - explicit QBoundedCircularBuffer(int capacity_) - : m_free( capacity_ ), - m_used( capacity_ ), - m_buffer( capacity_ ) - { - m_used.acquire(capacity_); - } - - int capacity() const { return m_buffer.capacity(); } - int freeSize() const { return m_free.available(); } - int size() const { return m_used.available(); } - bool isFull() const { return m_free.available() == 0; } - bool isEmpty() const { return m_used.available() == 0; } - - void push_back(const T &value) - { - m_free.acquire(); - QWriteLocker locker(&m_lock); - m_buffer.append(value); - locker.unlock(); - m_used.release(); - } - - void push(const T &t) { push_back(t); } - void append(const T &t) { push_back(t); } - - T pop_front() - { - m_used.acquire(); - QWriteLocker locker(&m_lock); - T value = m_buffer.first(); - m_buffer.remove(0); - locker.unlock(); - m_free.release(); - return value; - } - - T pop() { return pop_front(); } - T takeFirst() { return pop_front(); } - - void clear() - { - QWriteLocker locker(&m_lock); - m_buffer.clear(); - int used = m_used.available(); - m_free.release(used); - m_used.acquire(used); - } - - T at(int i) const - { - QReadLocker readLocker(&m_lock); - return m_buffer.at(i); - } - - T front() const - { - QReadLocker readLocker(&m_lock); - return m_buffer.front(); - } - - T back() const - { - QReadLocker readLocker(&m_lock); - return m_buffer.back(); - } - -protected: - Q_DISABLE_COPY(QBoundedCircularBuffer) - - QSemaphore m_free; - QSemaphore m_used; - QCircularBuffer<T> m_buffer; - mutable QReadWriteLock m_lock; -}; - -} //Qt3D - -QT_END_NAMESPACE - -#endif // QT3DCORE_QBOUNDEDCIRCULARBUFFER_P_H diff --git a/src/core/resources/qcircularbuffer_p.h b/src/core/resources/qcircularbuffer_p.h deleted file mode 100644 index e10b7236d..000000000 --- a/src/core/resources/qcircularbuffer_p.h +++ /dev/null @@ -1,1330 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QCIRCULARBUFFER_H -#define QT3DCORE_QCIRCULARBUFFER_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/qt3dcore_global.h> -#include <QtCore/QtGlobal> -#include <QtCore/qlist.h> -#include <QtCore/qpair.h> -#include <QtCore/qshareddata.h> -#include <QtCore/qvector.h> - -#include <algorithm> -#include <iterator> -#include <limits> -#include <memory> -#include <new> - - -#ifdef Q_COMPILER_INITIALIZER_LISTS -# include <initializer_list> -#endif - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class CircularBufferData : public QSharedData -{ -protected: - CircularBufferData() - : data(nullptr), - capacity(0), - size(0), - first(-1), - last(-1) - {} - - ~CircularBufferData() - { - // Release the raw memory - deallocate(data); - } - - int wraparound(int index) const - { - index = index < capacity ? index : (index - capacity); - Q_ASSERT(index < capacity); // make sure that wrapping around once was enough - return index; - } - - void *allocate(int count, size_t sizeOfT) - { return operator new[](count * sizeOfT); } - void deallocate(void *p) - { operator delete[](p); } - - void *data; // Array of the actual data -public: - int capacity; // Size of the m_data array - int size; // Number of elements of m_data actually used - int first; // Index in m_data of the first element of the circular buffer - int last; // Index in m_data of the last element of the circular buffer -}; - -template <typename T> -class TypedCircularBufferData : public CircularBufferData -{ - template <typename InputIterator> - explicit TypedCircularBufferData(InputIterator f, InputIterator l, std::input_iterator_tag) Q_DECL_EQ_DELETE; -public: - TypedCircularBufferData() : CircularBufferData() {} - template <typename ForwardIterator> - explicit TypedCircularBufferData(ForwardIterator f, ForwardIterator l, std::forward_iterator_tag) - { - const int n = int(std::distance(f, l)); - CircularBufferData::data = allocate(n); - std::uninitialized_copy(f, l, data()); - first = 0; - last = n - 1; - size = capacity = n; - } - ~TypedCircularBufferData() - { - if (QTypeInfo<T>::isComplex && size != 0) { - // The type is complex so we manually call the destructor for each item - // since we used the placement new operator to instantiate them - if (first <= last) { - // Destroy items from first to last - T *b = data() + first; - T *i = b + size; - while (i-- != b) - i->~T(); - } else { - // Destroy items at end of data array - T *b = data() + first; - T *i = data() + capacity; - while (i-- != b) - i->~T(); - - // Destroy items at beginning of data array - b = data(); - i = b + last; - while (i-- != b) - i->~T(); - } - } - - } - - using CircularBufferData::wraparound; - T *allocate(int count) { return static_cast<T*>(CircularBufferData::allocate(count, sizeof(T))); } - using CircularBufferData::deallocate; - T *data() const { return static_cast<T*>(CircularBufferData::data); } - void setData(T *newdata) { CircularBufferData::data = static_cast<void*>(newdata); } -}; - -template <typename T> -class QCircularBuffer -{ - typedef TypedCircularBufferData<T> Data; -public: - typedef QPair<T*,int> array_range; - typedef QPair<const T*,int> const_array_range; - typedef array_range ArrayRange; - typedef const_array_range ConstArrayRange; - - QCircularBuffer() - : d(new Data()) - {} - - explicit QCircularBuffer(int amount); - explicit QCircularBuffer(int amount, const T &val); - explicit QCircularBuffer(int amount, int initialSize, const T &value); -#ifdef Q_COMPILER_INITIALIZER_LISTS - QCircularBuffer(std::initializer_list<T> list) - : d(new Data(list.begin(), list.end(), std::random_access_iterator_tag())) - {} -#endif - template <typename ForwardIterator> - explicit QCircularBuffer(ForwardIterator f, ForwardIterator l) - : d(new Data(f, l, typename std::iterator_traits<ForwardIterator>::iterator_category())) - {} - - QCircularBuffer(const QCircularBuffer<T> &other) - : d(other.d) - {} - - void swap(QCircularBuffer &other) { d.swap(other.d); } - - QCircularBuffer<T> &operator = (const QCircularBuffer<T> &other) - { - d = other.d; - return *this; - } - - ~QCircularBuffer() {} - - class iterator - { - public: - typedef std::random_access_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; - typedef T value_type; - typedef T *pointer; - typedef T &reference; - - Q_DECL_CONSTEXPR iterator() : buffer(nullptr), index(-1) {} - iterator(QCircularBuffer<T> *buf, int idx) - : buffer(buf), index(idx) - {} - - T &operator*() const { return (*buffer)[ index ]; } - T *operator->() const { return &(*buffer)[index]; } - T &operator[](int j) const { return (*buffer)[ index + j ]; } - - bool operator==(const iterator &other) const - { - return (buffer == other.buffer && index == other.index); - } - - bool operator!=(const iterator &other) const - { - return (buffer != other.buffer || index != other.index); - } - - bool operator<(const iterator &other) const - { - Q_ASSERT_X(buffer == other.buffer, "QCircularBuffer<T>::iterator::operator<", "iterators use different buffers"); - return index < other.index; - } - - bool operator<=(const iterator &other) const - { - Q_ASSERT_X(buffer == other.buffer, "QCircularBuffer<T>::iterator::operator<=", "iterators use different buffers"); - return index <= other.index; - } - - bool operator>(const iterator &other) const - { - Q_ASSERT_X(buffer == other.buffer, "QCircularBuffer<T>::iterator::operator>", "iterators use different buffers"); - return index > other.index; - } - - bool operator>=(const iterator &other) const - { - Q_ASSERT_X(buffer == other.buffer, "QCircularBuffer<T>::iterator::operator>=", "iterators use different buffers"); - return index >= other.index; - } - - iterator &operator++() { ++index; return *this; } - iterator operator++(int) - { - iterator ans = *this; - ++index; - return ans; - } - - iterator &operator--() { --index; return *this; } - iterator operator--(int) - { - iterator ans = *this; - --index; - return ans; - } - - iterator &operator+=(int j) { index += j; return *this; } - iterator &operator-=(int j) { index -= j; return *this; } - iterator operator+(int j) const { return iterator(buffer, index + j); } - iterator operator-(int j) const { return iterator(buffer, index - j); } - int operator-(iterator other) const - { - Q_ASSERT_X(buffer == other.buffer, "QCircularBuffer<T>::iterator::operator-", "iterators use different buffers"); - return index - other.index; - } - - private: - QCircularBuffer<T> *buffer; - int index; - friend class QCircularBuffer; - }; - friend class iterator; - - class const_iterator - { - public: - typedef std::random_access_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; - typedef T value_type; - typedef const T *pointer; - typedef const T &reference; - - Q_DECL_CONSTEXPR const_iterator() : buffer(nullptr), index(-1) {} - const_iterator(const QCircularBuffer<T> *buff, int idx) - : buffer(buff), index(idx) - {} - const_iterator(const iterator &other) - : buffer(other.buffer), index(other.index) - {} - - const T &operator*() const { return buffer->at(index); } - const T *operator->() const { return &buffer->at(index); } - const T &operator[](int j) const { return buffer->at(index + j); } - - bool operator==(const const_iterator &other) const - { - Q_ASSERT_X(buffer == other.buffer, "QCircularBuffer<T>::const_iterator::operator==", "iterators use different buffers"); - return index == other.index; - } - - bool operator!=(const const_iterator &other) const - { - Q_ASSERT_X(buffer == other.buffer, "QCircularBuffer<T>::const_iterator::operator!=", "iterators use different buffers"); - return index != other.index; - } - - bool operator<(const const_iterator &other) const - { - Q_ASSERT_X(buffer == other.buffer, "QCircularBuffer<T>::const_iterator::operator<", "iterators use different buffers"); - return index < other.index; - } - - bool operator<=(const const_iterator &other) const - { - Q_ASSERT_X(buffer == other.buffer, "QCircularBuffer<T>::const_iterator::operator<=", "iterators use different buffers"); - return index <= other.index; - } - - bool operator>(const const_iterator &other) const - { - Q_ASSERT_X(buffer == other.buffer, "QCircularBuffer<T>::const_iterator::operator>", "iterators use different buffers"); - return index > other.index; - } - - bool operator>=(const const_iterator &other) const - { - Q_ASSERT_X(buffer == other.buffer, "QCircularBuffer<T>::const_iterator::operator>=", "iterators use different buffers"); - return index >= other.index; - } - - const_iterator &operator++() { ++index; return *this; } - const_iterator operator++(int) - { - const_iterator ans = *this; - ++index; - return ans; - } - - const_iterator &operator--() { --index; return *this; } - const_iterator operator--(int) - { - const_iterator ans = *this; - --index; - return ans; - } - - const_iterator &operator+=(int j) { index += j; return *this; } - const_iterator &operator-=(int j) { index -= j; return *this; } - const_iterator operator+(int j) const { return const_iterator(buffer, index + j); } - const_iterator operator-(int j) const { return const_iterator(buffer, index - j); } - int operator-(const_iterator other) const - { - Q_ASSERT_X(buffer == other.buffer, "QCircularBuffer<T>::const_iterator::operator-", "iterators use different buffers"); - return index - other.index; - } - - private: - const QCircularBuffer<T> *buffer; - int index; - friend class QCircularBuffer; - }; - friend class const_iterator; - - typedef std::reverse_iterator<iterator> reverse_iterator; - typedef std::reverse_iterator<const_iterator> const_reverse_iterator; - - iterator begin() { return iterator(this, 0); } - const_iterator begin() const { return const_iterator(this, 0); } - const_iterator cbegin() const { return const_iterator(this, 0); } - reverse_iterator rbegin() { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } - const_reverse_iterator crbegin() const { return const_reverse_iterator(end()); } - const_iterator constBegin() const { return const_iterator(this, 0); } - iterator end() { return iterator(this, d->size); } - const_iterator end() const { return const_iterator(this, d->size); } - const_iterator cend() const { return const_iterator(this, d->size); } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } - const_reverse_iterator crend() const { return const_reverse_iterator(begin()); } - const_iterator constEnd() const { return const_iterator(this, d->size); } - iterator insert(const_iterator before, int number, const T &val) - { - insert(before.index, number, val); - return iterator(this, before.index); - } - iterator insert(const_iterator before, const T &val) { return insert(before, 1, val); } - iterator erase(const_iterator b, const_iterator e) - { - int number = e - b; - remove(b.index, number); - return iterator(this, e.index - number); - } - iterator erase(const_iterator pos) { return erase(pos, pos + 1); } - - // STL compatibility - typedef T value_type; - typedef value_type *pointer; - typedef const value_type *const_pointer; - typedef value_type &reference; - typedef const value_type &const_reference; - typedef ptrdiff_t difference_type; - typedef iterator Iterator; - typedef const_iterator ConstIterator; - typedef int size_type; - - void push_back(const T &t) { append(t); } - void push_front(const T &t) { prepend(t); } - void pop_back() { Q_ASSERT(!isEmpty()); erase(end() - 1); } - void pop_front() { Q_ASSERT(!isEmpty()); erase(begin()); } - bool empty() const { return isEmpty(); } - T &front() { return first(); } - const T &front() const { return first(); } - T &back() { return last(); } - const T &back() const { return last(); } - - QAtomicInt refCount() const { return d->ref; } - - void append(const T &val); - - const T &at(int i) const - { - Q_ASSERT_X(i >= 0 && i < d->size, "QCircularBuffer<T>::at", "index out of range"); - return d->data()[d->wraparound(d->first + i)]; - } - - const T &operator[](int i) const - { - Q_ASSERT_X(i >= 0 && i < d->size, "QCircularBuffer<T>::operator[]", "index out of range"); - return d->data()[d->wraparound(d->first + i)]; - } - - T &operator[](int i) - { - d.detach(); - Q_ASSERT_X(i >= 0 && i < d->size, "QCircularBuffer<T>::operator[]", "index out of range"); - return d->data()[d->wraparound(d->first + i)]; - } - - int capacity() const { return d->capacity; } - - void clear() { *this = QCircularBuffer<T>(d->capacity); } - - bool contains(const T &val) const; - int count(const T &val) const; - int count() const { return size(); } - - array_range data() - { - d.detach(); - if (d->size == 0) - return array_range(nullptr, 0); - if (!isLinearised()) - linearise(); - return array_range(d->data() + d->first, d->last - d->first + 1); - } - const_array_range data() const { return constData(); } - const_array_range constData() const - { - if (!isLinearised() || d->size == 0) - return const_array_range(nullptr, 0); - return const_array_range(d->data() + d->first, d->last - d->first + 1); - } - - array_range dataOne() - { - d.detach(); - if (d->size == 0) - return array_range(nullptr, 0); - if (isLinearised()) - return array_range(d->data() + d->first, d->last - d->first + 1); - else - return array_range(d->data() + d->first, d->capacity - d->first); - } - const_array_range dataOne() const { return constDataOne(); } - const_array_range constDataOne() const - { - if (d->size == 0) - return const_array_range(nullptr, 0); - if (isLinearised()) - return const_array_range(d->data() + d->first, d->last - d->first + 1); - else - return const_array_range(d->data() + d->first, d->capacity - d->first); - } - - array_range dataTwo() - { - d.detach(); - if (d->size == 0 || isLinearised()) - return array_range(nullptr, 0); - return array_range(d->data(), d->last + 1); - } - const_array_range dataTwo() const { return constDataTwo(); } - const_array_range constDataTwo() const - { - if (d->size == 0 || isLinearised()) - return const_array_range(nullptr, 0); - return const_array_range(d->data(), d->last + 1); - } - - bool endsWith(const T &val) const { return !isEmpty() && last() == val; } - QCircularBuffer<T> &fill(const T &val, int number = -1); - T &first() { Q_ASSERT(!isEmpty()); d.detach(); return d->data()[ d->first ]; } - const T &first() const { Q_ASSERT(!isEmpty()); return d->data()[ d->first ]; } - int freeSize() const { return sizeAvailable(); } - - static QCircularBuffer<T> fromList(const QList<T> &list) - { return QCircularBuffer(list.begin(), list.end()); } - static QCircularBuffer<T> fromVector(const QVector<T> &vector) - { return QCircularBuffer(vector.begin(), vector.end()); } - - int indexOf(const T &val, int from = 0) const; - void insert(int i, const T &val) { insert(i, 1, val); } - void insert(int i, int number, const T &val); - bool isEmpty() const { return d->size == 0; } - bool isFull() const { return d->size == d->capacity; } - bool isLinearised() const { return (d->last >= d->first); } - T &last() { Q_ASSERT(!isEmpty()); return d->data()[ d->last ]; } - const T &last() const { Q_ASSERT(!isEmpty()); return d->data()[ d->last ]; } - int lastIndexOf(const T &val, int from = -1) const; - void linearise() - { - if (!isLinearised()) { - QCircularBuffer linearized(this->cbegin(), this->cend()); - swap(linearized); - } - } - - void prepend(const T &val); - void remove(int i) { remove(i, 1); } - void remove(int i, int number); - - void replace(int i, const T &val) - { - Q_ASSERT_X(i >= 0 && i < d->size, "QCircularBuffer<T>::replace", "index out of range"); - const T copy(val); - (*this)[ i ] = copy; - } - - void reserve(int amount) { setCapacity(amount); } - void resize(int newSize); - void setCapacity(int amount); - int size() const { return d->size; } - Q_DECL_CONSTEXPR int max_size() const { return std::numeric_limits<size_type>::max(); } - int sizeAvailable() const { return d->capacity - d->size; } - void squeeze() { setCapacity(size()); } - bool startsWith(const T &val) const { return !isEmpty() && first() == val; } - - QList<T> toList() const; - QVector<T> toVector() const; - - T value(int i) const - { - if (i < 0 || i >= d->size) - return T(); - return at(i); - } - - T value(int i, const T &defaultValue) const - { - if (i < 0 || i >= d->size) - return defaultValue; - return at(i); - } - - QCircularBuffer<T> &operator+=(const T &other) { append(other); return *this; } - QCircularBuffer<T> &operator+=(const QCircularBuffer<T> &other); - QCircularBuffer<T> &operator+=(const QVector<T> &other); - QCircularBuffer<T> &operator+=(const QList<T> &other); - - QCircularBuffer<T> &operator<<(const T &other) { append(other); return *this; } - QCircularBuffer<T> &operator<<(const QCircularBuffer<T> &other) { *this += other; return *this; } - QCircularBuffer<T> &operator<<(const QVector<T> &other) { *this += other; return *this; } - QCircularBuffer<T> &operator<<(const QList<T> &other) { *this += other; return *this; } - - inline bool isSharedWith(const QCircularBuffer &other) const { return d == other.d; } - -private: - QExplicitlySharedDataPointer<Data> d; -}; - -template <typename T> -QCircularBuffer<T> operator+(const QCircularBuffer<T> &lhs, const QCircularBuffer<T> &rhs); - -template <typename T> -inline bool operator==(const QCircularBuffer<T> &lhs, const QCircularBuffer<T> &rhs) -{ return lhs.isSharedWith(rhs) || (lhs.size() == rhs.size() && std::equal(lhs.begin(), lhs.end(), rhs.begin())); } - -template <typename T> -inline bool operator!=(const QCircularBuffer<T> &lhs, const QCircularBuffer<T> &rhs) -{ return !operator==(lhs, rhs); } - -template <typename T> -inline void swap(QCircularBuffer<T> &lhs, QCircularBuffer<T> &rhs) -{ lhs.swap(rhs); } - -template <typename T> -inline bool operator< (const QCircularBuffer<T> &lhs, const QCircularBuffer<T> &rhs) -{ return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } - -template <typename T> -inline bool operator> (const QCircularBuffer<T> &lhs, const QCircularBuffer<T> &rhs) -{ return operator<(rhs, lhs); } - -template <typename T> -inline bool operator>=(const QCircularBuffer<T> &lhs, const QCircularBuffer<T> &rhs) -{ return !operator<(lhs, rhs); } - -template <typename T> -inline bool operator<=(const QCircularBuffer<T> &lhs, const QCircularBuffer<T> &rhs) -{ return !operator>(lhs, rhs); } - -// out-of-line function implementations: - -#ifndef Q_QDOC - -template <typename T> -QCircularBuffer<T>::QCircularBuffer(int amount) - : d(new Data()) -{ - // Allocate some raw memory - d->setData(d->allocate(amount)); - d->capacity = amount; - - // Initialize memory block to zero - memset(d->data(), 0, amount * sizeof(T)); -} - -template <typename T> -QCircularBuffer<T>::QCircularBuffer(int amount, const T &val) - : d(new Data()) -{ - // Allocate some raw memory - d->setData(d->allocate(amount)); - d->capacity = amount; - - // Initialize the objects. In this case we always use the placement new operator - T *b = d->data(); - T *i = b + d->capacity; - while (i != b) - new (--i) T(val); - d->first = 0; - d->last = d->capacity - 1; - d->size = d->capacity; -} - -template <typename T> -QCircularBuffer<T>::QCircularBuffer(int amount, int initialSize, const T &val) - : d(new Data()) -{ - Q_ASSERT_X(amount >= initialSize, "QCircularBuffer<T>::QCircularBuffer(int capacity, int size, const T &value)", "size is greater than capacity"); - - // Allocate some raw memory - d->setData(d->allocate(amount)); - d->capacity = amount; - - // Initialize the objects that need to be set to the specified value. - // In this case we always use the placement new operator - T *b = d->data(); - T *i = b + initialSize; - while (i != b) - new (--i) T(val); - - // Initialize the remaining memory to zero - memset(d->data() + initialSize, 0, (amount - initialSize) * sizeof(T)); - - d->first = 0; - d->last = initialSize - 1; - d->size = initialSize; -} - -template <typename T> -void QCircularBuffer<T>::append(const T &val) -{ - // If we have no capacity we do nothing - if (!d->capacity) - return; - d.detach(); - if (d->size == d->capacity) { - // Buffer is full. Overwrite earliest item and rotate - d->data()[ d->first ] = val; - d->first = d->wraparound(++d->first); - d->last = d->wraparound(++d->last); - } else if (d->size != 0) { - // Buffer is partially full. Append data to end of array using appropriate method - int index = d->wraparound(d->first + d->size); - if (QTypeInfo<T>::isComplex) - new (d->data() + index) T(val); - else - d->data()[ index ] = val; - ++d->size; - ++d->last; - } else { - // Buffer is empty. Append data to end of array using appropriate method - d->size = 1; - d->first = d->last = 0; - if (QTypeInfo<T>::isComplex) - new (d->data() + d->first) T(val); - else - d->data()[ d->first ] = val; - } -} - -template <typename T> -bool QCircularBuffer<T>::contains(const T &val) const -{ - if (isLinearised()) { - T *b = d->data() + d->first; - T *i = b + d->size; - while (i != b) - if (*--i == val) - return true; - return false; - } else { - // Check the array from m_first to the end - T *b = d->data() + d->first; - T *i = d->data() + d->capacity; - while (i != b) - if (*--i == val) - return true; - - // Check array from 0 to m_end - b = d->data(); - i = d->data() + d->last + 1; - while (i != b) - if (*--i == val) - return true; - - return false; - } -} - -template <typename T> -int QCircularBuffer<T>::count(const T &val) const -{ - int c = 0; - if (isLinearised()) { - T *b = d->data() + d->first; - T *i = b + d->size; - while (i != b) - if (*--i == val) - ++c; - } else { - // Check the array from m_first to the end - T *b = d->data() + d->first; - T *i = d->data() + d->capacity; - while (i != b) - if (*--i == val) - ++c; - - // Check array from 0 to m_end - b = d->data(); - i = d->data() + d->last + 1; - while (i != b) - if (*--i == val) - ++c; - } - return c; -} - -template <typename T> -QCircularBuffer<T> &QCircularBuffer<T>::fill(const T &val, int number) -{ - Q_ASSERT_X(d->capacity >= number, "QCircularBuffer<T>::fill", "size is greater than capacity"); - const T copy(val); - d.detach(); - int oldSize = d->size; - d->size = (number < 0 ? d->size : number); - d->first = (number == 0 ? -1 : 0); - d->last = d->size - 1; - - // Copy item into array size times - if (d->size) { - T *b = d->data(); - T *i = d->data() + d->size; - while (i != b) - *--i = copy; - } - - if (d->size < oldSize) { - // Cleanup old items beyond end of new array - T *b = d->data() + d->size; - T *i = d->data() + oldSize; - while (i-- != b) { - i->~T(); - //TODO: Optimize to a single memset call - memset(i, 0, sizeof(T)); - } - } - - return *this; -} - -template <typename T> -int QCircularBuffer<T>::indexOf(const T &val, int from) const -{ - Q_ASSERT_X(from < d->size, "QCircularBuffer<T>::indexOf", "from is greater than last valid index"); - if (from < 0) - from = qMax(from + d->size, 0); - else if (from >= d->size) - from = d->size - 1; - for (int i = from; i < d->size; ++i) - if (at(i) == val) - return i; - return -1; -} - -template <typename T> -void QCircularBuffer<T>::insert(int i, int number, const T &val) -{ - Q_ASSERT_X(i >= 0 && i <= d->size, "QCircularBuffer<T>::insert", "index out of range"); - d.detach(); - int freeCapacity = d->capacity - d->size; - - // Calculate number of elements that will actually be inserted. This - // depends upon where the insertion has been requested and any spare - // capacity left in the buffer. This is because elements at higher - // indices will be pushed to the right and will potentially wrap around - // to overwrite earlier elements. - int numToInsert = qMin(number, i + freeCapacity); - - // Calculate the number of elements at the beginning of the buffer that - // will be overwritten - int numToOverwrite = qMin(i, qMax(0, number - freeCapacity)); - - // Decide which way to shift to minimize the amount of copying required. - if (i < d->size / 2) { - // Inserting in lower half of buffer so we shift earlier items down - - // Shift data at the bottom end down. This may only be a subset if some - // of the early data is to be overwritten. - if (QTypeInfo<T>::isStatic) { - int b = d->first + numToOverwrite; - int e = d->first + i - 1; - for (int j = b; j <= e; ++j) { - int srcIndex = j % d->capacity; - int dstIndex = (j - numToInsert + d->capacity) % d->capacity; - T *src = d->data() + srcIndex; - T *dst = d->data() + dstIndex; - - new (dst) T(*src); - } - } else { - // We have a movable type so a simple memcopy (or maybe two or - // three) will suffice to shift the data at the bottom end - int numToMove = i - numToOverwrite; - if (numToMove > 0) { - int srcBegin = (d->first + numToOverwrite) % d->capacity; - int srcEnd = (d->first + i - 1) % d->capacity; - int dstBegin = (srcBegin - numToInsert + d->capacity) % d->capacity; - int dstEnd = (srcEnd - numToInsert + d->capacity) % d->capacity; - - // Do we have any wrap-around problems to deal with? - bool srcRegionWraps = (srcEnd < srcBegin); - bool dstRegionWraps = (dstEnd < dstBegin); - if (!srcRegionWraps && dstRegionWraps) { - // Destination region wraps so do the move in two steps - int wrapCount = abs(srcBegin - numToInsert); - memmove(d->data() + d->capacity - wrapCount, d->data() + srcBegin, wrapCount * sizeof(T)); - memmove(d->data(), d->data() + srcBegin + wrapCount, (numToMove - wrapCount) * sizeof(T)); - } else if (srcRegionWraps && !dstRegionWraps) { - // Source region wraps so do the move in two steps - int wrapCount = d->capacity - srcBegin; - memmove(d->data() + dstBegin, d->data() + d->capacity - wrapCount, wrapCount * sizeof(T)); - memmove(d->data() + dstBegin + numToInsert, d->data(), (numToMove - wrapCount) * sizeof(T)); - } else if (srcRegionWraps && dstRegionWraps) { - // Source and destination regions wrap so we have to do this in three steps - int srcWrapCount = d->capacity - srcBegin; - memmove(d->data() + dstBegin, d->data() + d->capacity - srcWrapCount, srcWrapCount * sizeof(T)); - memmove(d->data() + d->capacity - numToInsert, d->data(), numToInsert * sizeof(T)); - memmove(d->data(), d->data() + numToInsert, (numToMove - srcWrapCount - numToInsert) * sizeof(T)); - } else { - // No wrap around - do a single memmove - memmove(d->data() + dstBegin, d->data() + srcBegin, numToMove * sizeof(T)); - } - } - } - - // Insert the new items - int e = d->first + i; - int b = e - numToInsert; - for (int j = b; j < e; ++j) { - T *p = d->data() + ((j + d->capacity) % d->capacity); - new (p) T(val); - } - - // Adjust the first, last and size indices as needed. - // NB. The last index never changes in this regime. - d->size += qMin(number, freeCapacity); - d->first = (d->first - (numToInsert - numToOverwrite) + d->capacity) % d->capacity; - } else { - // Inserting in upper half of buffer so we shift later items up - - // Shift data at the top end up which may or may not overwrite some - // of the earliest data - if (QTypeInfo<T>::isStatic) { - int b = d->first + d->size - 1; - int e = d->first + i; - for (int j = b; j >= e; j--) { - int srcIndex = j % d->capacity; - int dstIndex = (j + numToInsert) % d->capacity; - T *src = d->data() + srcIndex; - T *dst = d->data() + dstIndex; - - new (dst) T(*src); - } - } else { - // We have a movable type so a simple memcopy (or maybe two or - // three) will suffice to shift the data at the top end - int numToMove = d->size - i; - if (numToMove > 0) { - int srcBegin = (d->first + i) % d->capacity; - int srcEnd = d->last; - int dstBegin = (srcBegin + numToInsert) % d->capacity; - int dstEnd = (srcEnd + numToInsert) % d->capacity; - - // Do we have any wrap-around problems to deal with? - bool srcRegionWraps = (srcEnd < srcBegin); - bool dstRegionWraps = (dstEnd < dstBegin); - if (!srcRegionWraps && dstRegionWraps) { - // Destination region wraps so do the move in two steps - int wrapCount = srcEnd + numToInsert - d->capacity + 1; - memmove(d->data(), d->data() + srcEnd - wrapCount + 1, wrapCount * sizeof(T)); - memmove(d->data() + dstBegin, d->data() + srcBegin, (numToMove - wrapCount) * sizeof(T)); - } else if (srcRegionWraps && !dstRegionWraps) { - // Source region wraps so do the move in two steps - int wrapCount = d->last + 1; - memmove(d->data() + numToInsert, d->data(), wrapCount * sizeof(T)); - memmove(d->data() + dstBegin, d->data() + srcBegin, (numToMove - wrapCount) * sizeof(T)); - } else if (srcRegionWraps && dstRegionWraps) { - // Source and destination regions wrap so we have to do this in three steps - int srcWrapCount = d->last + 1; - memmove(d->data() + numToInsert, d->data(), srcWrapCount * sizeof(T)); - memmove(d->data(), d->data() + d->capacity - numToInsert, numToInsert * sizeof(T)); - memmove(d->data() + dstBegin, d->data() + srcBegin, (numToMove - srcWrapCount - numToInsert) * sizeof(T)); - } else { - // No wrap around - do a single memmove - memmove(d->data() + dstBegin, d->data() + srcBegin, numToMove * sizeof(T)); - } - } - } - - // Insert the new items - for (int j = d->first + i; j < d->first + i + numToInsert; ++j) { - T *p = d->data() + (j % d->capacity); - new (p) T(val); - } - - // Adjust the first, last and size indices as needed - d->size += qMin(number, freeCapacity); - d->first = (d->first + numToOverwrite) % d->capacity; - d->last = (d->last + numToInsert) % d->capacity; - } -} - -template <typename T> -int QCircularBuffer<T>::lastIndexOf(const T &val, int from) const -{ - if (from < 0) - from = qMax(from + d->size, 0); - else if (from >= d->size) - from = d->size - 1; - for (int i = from; i >= 0; --i) - if (at(i) == val) - return i; - return -1; -} - -template <typename T> -void QCircularBuffer<T>::prepend(const T &val) -{ - // If we have no capacity we do nothing - if (!d->capacity) - return; - - d.detach(); - if (d->size == d->capacity) { - // Buffer is full. Overwrite last item and rotate - d->data()[ d->last ] = val; - d->first = (--d->first + d->capacity) % d->capacity; - d->last = (--d->last + d->capacity) % d->capacity; - } else if (d->size != 0) { - // Buffer is partially full. Prepend data to start of array using appropriate method - d->first = (--d->first + d->capacity) % d->capacity; - ++d->size; - if (QTypeInfo<T>::isComplex) - new (d->data() + d->first) T(val); - else - d->data()[ d->first ] = val; - } else { - // Buffer is empty. Prepend data to start of array using appropriate method - d->size = 1; - d->first = d->last = d->capacity - 1; - if (QTypeInfo<T>::isComplex) - new (d->data() + d->first) T(val); - else - d->data()[ d->first ] = val; - } -} - -template <typename T> -void QCircularBuffer<T>::remove(int i, int number) -{ - Q_ASSERT_X(i >= 0 && number > 0 && i + number <= d->size, "QCircularBuffer<T>::remove", "index out of range"); - d.detach(); - - // HACK (it actually makes sense, but requires some more thinking) - if ( i == 0 && !QTypeInfo<T>::isComplex ) { - d->first = d->wraparound( d->first + number ); - d->size -= number; - return; - } - - // Calculate the number of items that need to be moved downward - int numToMoveDown = d->size - number - i; - int numToMoveUp = i; - - if (numToMoveDown < numToMoveUp) { - // Move higher items down - int numToMove = numToMoveDown; - - if (QTypeInfo<T>::isComplex) { - // Copy items down from higher positions - int b = d->first + i; - int e = b + numToMove; - for (int j = b; j < e ; ++j) { - T *src = d->data() + ((j + number) % d->capacity); - T *dst = d->data() + (j % d->capacity); - new (dst) T(*src); - } - - // Clean up items at end of buffer - for (int j = d->last; j > d->last - number; --j) { - T *p = d->data() + ((j + d->capacity) % d->capacity); - p->~T(); - //TODO: Optimize to a single memset call - memset(p, 0, sizeof(T)); - } - } else { - if (isLinearised()) { - // With a linearised buffer we can do a simple move and removal of items - memmove(d->data() + d->last - numToMove - number + 1, d->data() + d->last - numToMove + 1, numToMove * sizeof(T)); - memset(d->data() + d->last - number + 1, 0, number * sizeof(T)); - } else { - // With a non-linearised buffer we need to be careful of wrapping issues - int srcBegin = (d->last - numToMove + 1 + d->capacity) % d->capacity; - int srcEnd = d->last; - int dstBegin = (d->first + i) % d->capacity; - int dstEnd = (dstBegin + numToMove - 1) % d->capacity; - - bool srcRegionWraps = (srcEnd < srcBegin); - bool dstRegionWraps = (dstEnd < dstBegin); - if (srcRegionWraps && !dstRegionWraps) { - // Source region wraps so do the move in two steps - int wrapCount = d->capacity - srcBegin; - memmove(d->data() + dstBegin, d->data() + srcBegin, wrapCount * sizeof(T)); - memmove(d->data() + dstBegin + wrapCount, d->data(), (numToMove - wrapCount) * sizeof(T)); - } else if (!srcRegionWraps && dstRegionWraps) { - // Destination region wraps so do the move in two steps - int wrapCount = number - srcBegin; - memmove(d->data() + d->capacity - wrapCount, d->data() + srcBegin, wrapCount * sizeof(T)); - memmove(d->data(), d->data() + srcBegin + wrapCount, (numToMove - wrapCount) * sizeof(T)); - } else if (srcRegionWraps && dstRegionWraps) { - // Source and destination regions wrap so we have to do this in three steps - int srcWrapCount = d->capacity - srcBegin; - memmove(d->data() + dstBegin, d->data() + srcBegin, srcWrapCount * sizeof(T)); - memmove(d->data() + dstBegin + srcWrapCount, d->data(), number * sizeof(T)); - memmove(d->data(), d->data() + number, (numToMove - srcWrapCount - number) * sizeof(T)); - } else { - // No wrap around, so we can do this in one hit - memmove(d->data() + dstBegin, d->data() + srcBegin, numToMove * sizeof(T)); - } - - // We potentially have a disjoint region that needs zeroing - int zeroStart = (d->last - number + d->capacity + 1) % d->capacity; - int zeroEnd = d->last; - if (zeroEnd < zeroStart) { - // Region to be zeroed wraps. Do it in two steps. - memset(d->data(), 0, (d->last + 1) * sizeof(T)); - memset(d->data() + zeroStart, 0, (number - d->last - 1) * sizeof(T)); - } else { - // Region to be zeroed is contiguous - memset(d->data() + zeroStart, 0, number * sizeof(T)); - } - } - } - - // Adjust the indices - d->size -= number; - d->last = (d->last - number + d->capacity) % d->capacity; - } else { - // Move lower items up - int numToMove = numToMoveUp; - - if (QTypeInfo<T>::isComplex) { - // Copy items up from lower positions - int b = d->first + i - 1; - int e = b - numToMove; - for (int j = b; j > e ; --j) { - T *src = d->data() + ((j + d->capacity) % d->capacity); - T *dst = d->data() + ((j + d->capacity + number) % d->capacity); - new (dst) T(*src); - } - - // Clean up items at start of buffer - for (int j = d->first; j < d->first + number; ++j) { - T *p = d->data() + (j % d->capacity); - p->~T(); - //TODO: Optimize to a single memset call - memset(p, 0, sizeof(T)); - } - } else { - if (isLinearised()) { - // With a linearised buffer we can do a simple move and removal of items - memmove(d->data() + d->first + number, d->data() + d->first, numToMove * sizeof(T)); - memset(d->data() + d->first, 0, number * sizeof(T)); - } else { - // With a non-linearised buffer we need to be careful of wrapping issues - int srcBegin = d->first; - int srcEnd = (srcBegin + numToMove - 1) % d->capacity; - int dstBegin = (srcBegin + number) % d->capacity; - int dstEnd = (dstBegin + numToMove - 1) % d->capacity; - - bool srcRegionWraps = (srcEnd < srcBegin); - bool dstRegionWraps = (dstEnd < dstBegin); - if (srcRegionWraps && !dstRegionWraps) { - // Source region wraps so do the move in two steps - int wrapCount = srcEnd + 1; - memmove(d->data() + dstEnd - wrapCount + 1, d->data(), wrapCount * sizeof(T)); - memmove(d->data() + dstBegin, d->data() + srcBegin, (numToMove - wrapCount) * sizeof(T)); - } else if (!srcRegionWraps && dstRegionWraps) { - // Destination region wraps so do the move in two steps - int wrapCount = dstEnd + 1; - memmove(d->data(), d->data() + srcEnd - wrapCount + 1, wrapCount * sizeof(T)); - memmove(d->data() + dstBegin, d->data() + srcBegin, (numToMove - wrapCount) * sizeof(T)); - } else if (srcRegionWraps && dstRegionWraps) { - // Source and destination regions wrap so we have to do this in three steps - int srcWrapCount = srcEnd + 1; - memmove(d->data() + dstEnd - srcWrapCount + 1, d->data(), srcWrapCount * sizeof(T)); - memmove(d->data(), d->data() + d->capacity - number, number * sizeof(T)); - memmove(d->data() + dstBegin, d->data() + srcBegin, (numToMove - srcWrapCount - number) * sizeof(T)); - } else { - // No wrap around, so we can do this in one hit - memmove(d->data() + dstBegin, d->data() + srcBegin, numToMove * sizeof(T)); - } - - // We potentially have a disjoint region that needs zeroing - int zeroStart = d->first; - int zeroEnd = (zeroStart + number - 1) % d->capacity; - if (zeroEnd < zeroStart) { - // Region to be zeroed wraps. Do it in two steps. - memset(d->data() + zeroStart, 0, (d->capacity - d->first) * sizeof(T)); - memset(d->data(), 0, (number - d->capacity + d->first) * sizeof(T)); - } else { - // Region to be zeroed is contiguous - memset(d->data() + zeroStart, 0, number * sizeof(T)); - } - } - } - - // Adjust the indices - d->size -= number; - d->first = (d->first + number) % d->capacity; - } -} - -template <typename T> -void QCircularBuffer<T>::setCapacity(int amount) -{ - if (amount == d->capacity) - return; - - d.detach(); - // Allocate some new raw memory - T *newData = d->allocate(amount); - - // How many items can we copy across? - int newSize = qMin(d->size, amount); - - if (QTypeInfo<T>::isComplex) { - // Copy across the elements from the original array - for (int i = 0; i < newSize; ++i) { - T *src = d->data() + ((d->first + i) % d->capacity); - T *dst = newData + i; - new (dst) T(*src); - } - - // Destroy the original items. - // The type is complex so we manually call the destructor for each item - // since we used the placement new operator to instantiate them - T *b = d->data(); - T *i = b + d->capacity; - while (i-- != b) - i->~T(); - } else { - // Copy across the elements from the original array. The source region - // potentially wraps so we may have to do this in one or two steps - if (isLinearised()) { - memmove(newData, d->data() + d->first, newSize * sizeof(T)); - } else { - int step1Size = qMin(newSize, d->capacity - d->first); - memmove(newData, d->data() + d->first, step1Size * sizeof(T)); - int step2Size = qMax(0, qMin(newSize - d->capacity + d->first, d->last + 1)); - memmove(newData + step1Size, d->data(), step2Size * sizeof(T)); - } - } - - // Initialize any memory outside of the valid buffer (ie the unused items) - memset(newData + newSize, 0, (amount - newSize) * sizeof(T)); - - // Release the raw memory for the old array - d->deallocate(d->data()); - - // Assign the new memory to be our buffer data and fix indices - d->setData(newData); - d->capacity = amount; - d->first = 0; - d->size = newSize; - d->last = d->size - 1; -} - -template <typename T> -void QCircularBuffer<T>::resize(int newSize) -{ - Q_ASSERT_X(newSize >= 0 && newSize <= d->capacity, "QCircularBuffer<T>::resize", "size out of range"); - d.detach(); - if (newSize < d->size) { - remove(newSize, d->size - newSize); - } else if (newSize > d->size) { - const T t = T(); - insert(d->size, newSize - d->size, t); - } -} - -template <typename T> -QCircularBuffer<T> &QCircularBuffer<T>::operator+=(const QCircularBuffer<T> &other) -{ - d.detach(); - // How many items do we need to copy? No point in ever copying across a number - // greater than capacity - int numToCopy = qMin(other.size(), d->capacity); - int offset = other.size() - numToCopy; - for (int i = 0; i < numToCopy; ++i) - append(other.at(offset + i)); - return *this; -} - -template <typename T> -QCircularBuffer<T> &QCircularBuffer<T>::operator+=(const QVector<T> &other) -{ - d.detach(); - // How many items do we need to copy? No point in ever copying across a number - // greater than capacity - int numToCopy = qMin(other.size(), d->capacity); - int offset = other.size() - numToCopy; - for (int i = 0; i < numToCopy; ++i) - append(other.at(offset + i)); - return *this; -} - -template <typename T> -QCircularBuffer<T> &QCircularBuffer<T>::operator+=(const QList<T> &other) -{ - d.detach(); - // How many items do we need to copy? No point in ever copying across a number - // greater than capacity - int numToCopy = qMin(other.size(), d->capacity); - int offset = other.size() - numToCopy; - for (int i = 0; i < numToCopy; ++i) - append(other.at(offset + i)); - return *this; -} - -template <typename T> -QList<T> QCircularBuffer<T>::toList() const -{ - QList<T> list; - list.reserve(size()); - for (int i = 0; i < size(); ++i) - list.append(at(i)); - return list; -} - -template <typename T> -QVector<T> QCircularBuffer<T>::toVector() const -{ - QVector<T> vector; - vector.reserve(size()); - for (int i = 0; i < size(); ++i) - vector.append(at(i)); - return vector; -} - -template <typename T> -QCircularBuffer<T> operator+(const QCircularBuffer<T> &lhs, const QCircularBuffer<T> &rhs) -{ - QCircularBuffer<T> circ(lhs.size() + rhs.size()); - for (int i = 0; i < lhs.size(); ++i) - circ.append(lhs.at(i)); - for (int i = 0; i < rhs.size(); ++i) - circ.append(rhs.at(i)); - return circ; -} - -#endif // Q_QDOC - -Q_DECLARE_SEQUENTIAL_ITERATOR(CircularBuffer) -Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(CircularBuffer) - -} //Qt3D - -QT_END_NAMESPACE - -#endif // QT3DCORE_QCIRCULARBUFFER_H diff --git a/src/core/resources/qframeallocator.cpp b/src/core/resources/qframeallocator.cpp deleted file mode 100644 index e85ae4057..000000000 --- a/src/core/resources/qframeallocator.cpp +++ /dev/null @@ -1,322 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* !\internal - \class Qt3DCore::QFrameAllocator - \inmodule Qt3DCore - \brief Provides a pool of memory chunks to be used to allocate objects on a per frame basis. - - The memory can be recycled by following frames by calling clear which won't deallocate any memory. - - \note Be really careful when allocating polymorphic types. You must be - sure to call deallocate with the subclass type to properly release all - memory. -*/ - -#include "qframeallocator_p.h" -#include "qframeallocator_p_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QFrameAllocatorPrivate::QFrameAllocatorPrivate() - : m_maxObjectSize(0U) - , m_alignment(0U) -{ -} - -QFrameAllocator::QFrameAllocator(uint maxObjectSize, uint alignment, uint pageSize) - : d_ptr(new QFrameAllocatorPrivate) -{ - Q_ASSERT(alignment && pageSize && pageSize < UCHAR_MAX); - Q_D(QFrameAllocator); - d->m_maxObjectSize = maxObjectSize; - d->m_alignment = alignment; - d->m_allocatorPool.resize(d->allocatorIndexFromSize(maxObjectSize) + 1); - for (int i = 0, n = d->m_allocatorPool.size(); i < n; ++i) - d->m_allocatorPool[i].init((i + 1) * d->m_alignment, pageSize); -} - -QFrameAllocator::~QFrameAllocator() -{ - Q_D(QFrameAllocator); - for (int i = 0, n = d->m_allocatorPool.size(); i < n; ++i) - d->m_allocatorPool[i].release(); -} - -// Clear all memory chunks, allocated memory is not released -void QFrameAllocator::clear() -{ - Q_D(QFrameAllocator); - for (int i = 0, n = d->m_allocatorPool.size(); i < n; ++i) - d->m_allocatorPool[i].clear(); -} - -// Trim excess memory used by chunks -void QFrameAllocator::trim() -{ - Q_D(QFrameAllocator); - for (int i = 0, n = d->m_allocatorPool.size(); i < n; ++i) - d->m_allocatorPool[i].trim(); -} - -uint QFrameAllocator::maxObjectSize() const -{ - Q_D(const QFrameAllocator); - return d->m_maxObjectSize; -} - -int QFrameAllocator::allocatorPoolSize() const -{ - Q_D(const QFrameAllocator); - return d->m_allocatorPool.size(); -} - -bool QFrameAllocator::isEmpty() const -{ - Q_D(const QFrameAllocator); - for (const QFixedFrameAllocator &allocator : d->m_allocatorPool) { - if (!allocator.isEmpty()) - return false; - } - return true; -} - -uint QFrameAllocator::totalChunkCount() const -{ - Q_D(const QFrameAllocator); - uint chunkCount = 0; - for (const QFixedFrameAllocator& allocator : d->m_allocatorPool) - chunkCount += allocator.chunkCount(); - return chunkCount; -} - -QFixedFrameAllocator::QFixedFrameAllocator() - : m_blockSize(0) - , m_nbrBlock(0) - , m_lastAllocatedChunck(nullptr) - , m_lastFreedChunck(nullptr) -{ -} - -QFixedFrameAllocator::~QFixedFrameAllocator() -{ - release(); -} - -void QFixedFrameAllocator::init(uint blockSize, uchar pageSize) -{ - m_blockSize = blockSize; - m_nbrBlock = pageSize; -} - -void *QFixedFrameAllocator::allocate() -{ - Q_ASSERT(m_blockSize); - return scan().allocate(m_blockSize); -} - -QFrameChunk &QFixedFrameAllocator::scan() -{ - Q_ASSERT(m_blockSize); - Q_ASSERT(m_nbrBlock); - - if (m_lastAllocatedChunck && m_lastAllocatedChunck->m_blocksAvailable) - return *m_lastAllocatedChunck; - - for (int i = 0; i < m_chunks.size(); i++) { - if (m_chunks[i].m_blocksAvailable > 0) { - m_lastAllocatedChunck = m_chunks.begin() + i; - return *m_lastAllocatedChunck; - } - } - m_chunks.resize(m_chunks.size() + 1); - QFrameChunk &newChunk = m_chunks.last(); - newChunk.init(m_blockSize, m_nbrBlock); - m_lastAllocatedChunck = &newChunk; - m_lastFreedChunck = &newChunk; - return newChunk; -} - -void QFixedFrameAllocator::deallocate(void *ptr) -{ - Q_ASSERT(m_blockSize && m_nbrBlock); - if (!m_chunks.empty() && ptr != nullptr) { - if (m_lastFreedChunck != nullptr && m_lastFreedChunck->contains(ptr, m_blockSize)) - m_lastFreedChunck->deallocate(ptr, m_blockSize); - else { - for (int i = 0; i < m_chunks.size(); i++) { - if (m_chunks[i].contains(ptr, m_blockSize)) { - m_chunks[i].deallocate(ptr, m_blockSize); - m_lastFreedChunck = m_chunks.begin() + i; - break ; - } - } - } - } -} - -void QFixedFrameAllocator::trim() -{ - for (int i = m_chunks.size() - 1; i >= 0; i--) { - if (m_chunks.at(i).isEmpty()) { - m_chunks[i].release(); - if (m_lastAllocatedChunck == &m_chunks[i]) - m_lastAllocatedChunck = nullptr; - if (m_lastFreedChunck == &m_chunks[i]) - m_lastFreedChunck = nullptr; - m_chunks.removeAt(i); - } - } -} - -void QFixedFrameAllocator::release() -{ - for (int i = m_chunks.size() - 1; i >= 0; i--) - m_chunks[i].release(); - m_chunks.clear(); - m_lastAllocatedChunck = nullptr; - m_lastFreedChunck = nullptr; -} - -// Allows to reuse chunks without having to reinitialize and reallocate them -void QFixedFrameAllocator::clear() -{ - for (int i = m_chunks.size() - 1; i >= 0; i--) - m_chunks[i].clear(m_blockSize, m_nbrBlock); -} - -bool QFixedFrameAllocator::isEmpty() const -{ - for (const QFrameChunk &chunck : m_chunks) { - if (chunck.m_blocksAvailable != chunck.m_maxBlocksAvailable) - return false; - } - return true; -} - -// QFrameChuck is agnostic about blocksize -// However if it was initialized with a block size of 16 -// You should then pass 16 to allocate and deallocate -void QFrameChunk::init(uint blockSize, uchar blocks) -{ - m_data = new uchar[blockSize * blocks]; - m_firstAvailableBlock = 0; - m_blocksAvailable = blocks; - m_maxBlocksAvailable = blocks; - uchar *p = m_data; - // Init each block with its position stored in its first byte - for (uchar i = 0; i < blocks; p += blockSize) - *p = ++i; -#ifdef QFRAMEALLOCATOR_DEBUG - VALGRIND_CREATE_MEMPOOL(m_data, 0, true); - VALGRIND_MAKE_MEM_NOACCESS(m_data, blockSize * blocks); - VALGRIND_MEMPOOL_ALLOC(m_data, m_data, blockSize * blocks); -#endif -} - -void *QFrameChunk::allocate(uint blockSize) -{ - if (m_blocksAvailable == 0) - return nullptr; - uchar *r = m_data + (m_firstAvailableBlock * blockSize); - m_firstAvailableBlock = *r; - --m_blocksAvailable; - return r; -} - -// Shouldn't be called more than once for the same pointer -void QFrameChunk::deallocate(void *p, uint blockSize) -{ - if (p >= m_data) { - uchar *toRelease = static_cast<uchar *>(p); - uchar oldFreeBlock = m_firstAvailableBlock; - m_firstAvailableBlock = static_cast<uchar>((toRelease - m_data) / blockSize); - *toRelease = oldFreeBlock; - ++m_blocksAvailable; - } -} - -bool QFrameChunk::contains(void *p, uint blockSize) -{ - uchar *c = static_cast<uchar *>(p); - return (m_data <= c && c < m_data + blockSize * m_maxBlocksAvailable); -} - -// Reset chunck without releasing heap allocated memory -void QFrameChunk::clear(uint blockSize, uchar blocks) -{ - m_firstAvailableBlock = 0; - m_blocksAvailable = blocks; - - uchar *p = m_data; - // Init each block with its position stored in its first byte - for (uchar i = 0; i < blocks; p += blockSize) - *p = ++i; -} - -void QFrameChunk::release() -{ -#ifdef QFRAMEALLOCATOR_DEBUG - VALGRIND_MEMPOOL_FREE(m_data, m_data); - VALGRIND_DESTROY_MEMPOOL(m_data); -#endif - delete [] m_data; -} - -void* QFrameAllocator::allocateRawMemory(size_t size) -{ - Q_D(QFrameAllocator); - Q_ASSERT(size <= d->m_maxObjectSize); - uint allocatorIndex = d->allocatorIndexFromSize(uint(size)); - return d->allocateAtChunk(allocatorIndex); -} - -void QFrameAllocator::deallocateRawMemory(void* ptr, size_t size) -{ - Q_D(QFrameAllocator); - Q_ASSERT(size <= d->m_maxObjectSize); - uint allocatorIndex = d->allocatorIndexFromSize(uint(size)); - d->deallocateAtChunck(ptr, allocatorIndex); -} - -} // Qt3D - -QT_END_NAMESPACE diff --git a/src/core/resources/qframeallocator_p_p.h b/src/core/resources/qframeallocator_p_p.h deleted file mode 100644 index bf4e0a2b1..000000000 --- a/src/core/resources/qframeallocator_p_p.h +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QFRAMEALLOCATOR_P_P_H -#define QT3DCORE_QFRAMEALLOCATOR_P_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/qt3dcore_global.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QFrameAllocator; - -struct Q_AUTOTEST_EXPORT QFrameChunk -{ - void init(uint blockSize, uchar blocks); - void *allocate(uint blockSize); - - void deallocate(void *p, uint blockSize); - bool contains(void *p, uint blockSize); - void clear(uint blockSize, uchar blocks); - void release(); - - inline bool isEmpty() const { return m_blocksAvailable == m_maxBlocksAvailable; } - - uchar *m_data; - uchar m_firstAvailableBlock; - uchar m_blocksAvailable; - uchar m_maxBlocksAvailable; -}; - -class Q_AUTOTEST_EXPORT QFixedFrameAllocator -{ -public: - QFixedFrameAllocator(); - ~QFixedFrameAllocator(); - - void init(uint blockSize, uchar pageSize = 128); - void *allocate(); - void deallocate(void *ptr); - void trim(); - void release(); - void clear(); - bool isEmpty() const; - - inline int chunkCount() const { return m_chunks.size(); } - inline uchar pageSize() const { return m_nbrBlock; } - inline uint blockSize() const { return m_blockSize; } - -private: - QFrameChunk &scan(); - -private: - uint m_blockSize; - uchar m_nbrBlock; - QVector<QFrameChunk> m_chunks; - QFrameChunk *m_lastAllocatedChunck; - QFrameChunk *m_lastFreedChunck; -}; - -class QFrameAllocatorPrivate -{ -public: - QFrameAllocatorPrivate(); - - inline void *allocateAtChunk(uint allocatorIndex) - { - return m_allocatorPool[allocatorIndex].allocate(); - } - - inline void deallocateAtChunck(void *ptr, uint allocatorIndex) - { - m_allocatorPool[allocatorIndex].deallocate(ptr); - } - - inline uint allocatorIndexFromSize(uint targetSize) const - { - return (targetSize + m_alignment - 1) / m_alignment - 1; - } - - uint m_maxObjectSize; - uint m_alignment; - QVector<QFixedFrameAllocator> m_allocatorPool; -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3DCORE_QFRAMEALLOCATOR_P_P_H diff --git a/src/core/resources/qloadgltf_p.h b/src/core/resources/qloadgltf_p.h index be7ee0d5f..ce49a2a80 100644 --- a/src/core/resources/qloadgltf_p.h +++ b/src/core/resources/qloadgltf_p.h @@ -60,13 +60,6 @@ inline QJsonDocument qLoadGLTF(const QByteArray &gltfData) { -#if QT_CONFIG(binaryjson) - { - QJsonDocument sceneDocument = QJsonDocument::fromBinaryData(gltfData); - if (!sceneDocument.isNull()) - return sceneDocument; - } -#endif { const QCborValue cbor = QCborValue::fromCbor(gltfData); if (cbor.isMap()) diff --git a/src/core/resources/resources.pri b/src/core/resources/resources.pri index 89540a36d..d25070d56 100644 --- a/src/core/resources/resources.pri +++ b/src/core/resources/resources.pri @@ -1,15 +1,10 @@ HEADERS += \ $$PWD/qloadgltf_p.h \ $$PWD/qresourcemanager_p.h \ - $$PWD/qcircularbuffer_p.h \ - $$PWD/qboundedcircularbuffer_p.h \ - $$PWD/qframeallocator_p.h \ - $$PWD/qframeallocator_p_p.h \ $$PWD/qhandle_p.h SOURCES += \ - $$PWD/qresourcemanager.cpp \ - $$PWD/qframeallocator.cpp + $$PWD/qresourcemanager.cpp # Define proper SIMD flags for qresourcemanager.cpp diff --git a/src/core/transforms/qabstractskeleton.cpp b/src/core/transforms/qabstractskeleton.cpp index 4a30d0710..cdda89418 100644 --- a/src/core/transforms/qabstractskeleton.cpp +++ b/src/core/transforms/qabstractskeleton.cpp @@ -46,7 +46,7 @@ namespace Qt3DCore { QAbstractSkeletonPrivate::QAbstractSkeletonPrivate() : Qt3DCore::QNodePrivate() - , m_type(QSkeletonCreatedChangeBase::Skeleton) + , m_type(Skeleton) , m_jointCount(0) { } @@ -105,13 +105,6 @@ QAbstractSkeleton::~QAbstractSkeleton() { } -/*! \internal */ -void QAbstractSkeleton::sceneChangeEvent(const QSceneChangePtr &change) -{ - // TODO Unused remove in Qt6 - Q_UNUSED(change) -} - /*! \property Qt3DCore::QAbstractSkeleton::jointCount diff --git a/src/core/transforms/qabstractskeleton.h b/src/core/transforms/qabstractskeleton.h index 1c2eba08f..7da78011f 100644 --- a/src/core/transforms/qabstractskeleton.h +++ b/src/core/transforms/qabstractskeleton.h @@ -64,8 +64,6 @@ Q_SIGNALS: protected: QAbstractSkeleton(QAbstractSkeletonPrivate &dd, Qt3DCore::QNode *parent = nullptr); - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QAbstractSkeleton) diff --git a/src/core/transforms/qabstractskeleton_p.h b/src/core/transforms/qabstractskeleton_p.h index 35d0df755..333fa5fdf 100644 --- a/src/core/transforms/qabstractskeleton_p.h +++ b/src/core/transforms/qabstractskeleton_p.h @@ -51,8 +51,8 @@ // We mean it. // +#include <Qt3DCore/qabstractskeleton.h> #include <Qt3DCore/private/qnode_p.h> -#include <Qt3DCore/private/qskeletoncreatedchange_p.h> #include <Qt3DCore/private/sqt_p.h> QT_BEGIN_NAMESPACE @@ -62,6 +62,11 @@ namespace Qt3DCore { class Q_3DCORE_PRIVATE_EXPORT QAbstractSkeletonPrivate : public Qt3DCore::QNodePrivate { public: + enum SkeletonType { + Skeleton = 0, + SkeletonLoader + }; + QAbstractSkeletonPrivate(); void setJointCount(int jointCount); @@ -70,7 +75,7 @@ public: static const QAbstractSkeletonPrivate *get(const QAbstractSkeleton *q); static QAbstractSkeletonPrivate *get(QAbstractSkeleton *q); - QSkeletonCreatedChangeBase::SkeletonType m_type; + SkeletonType m_type; int m_jointCount; QVector<Sqt> m_localPoses; diff --git a/src/core/transforms/qarmature.cpp b/src/core/transforms/qarmature.cpp index d9fef7767..56d310152 100644 --- a/src/core/transforms/qarmature.cpp +++ b/src/core/transforms/qarmature.cpp @@ -157,16 +157,6 @@ void QArmature::setSkeleton(Qt3DCore::QAbstractSkeleton *skeleton) } } -/*! \internal */ -Qt3DCore::QNodeCreatedChangeBasePtr QArmature::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QArmatureData>::create(this); - auto &data = creationChange->data; - Q_D(const QArmature); - data.skeletonId = qIdForNode(d->m_skeleton); - return creationChange; -} - } // namespace Qt3DCore QT_END_NAMESPACE diff --git a/src/core/transforms/qarmature.h b/src/core/transforms/qarmature.h index e3beffa01..5e02f99c3 100644 --- a/src/core/transforms/qarmature.h +++ b/src/core/transforms/qarmature.h @@ -72,7 +72,6 @@ protected: private: Q_DECLARE_PRIVATE(QArmature) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DCore diff --git a/src/core/transforms/qjoint.cpp b/src/core/transforms/qjoint.cpp index 408d42f6d..de7d913e3 100644 --- a/src/core/transforms/qjoint.cpp +++ b/src/core/transforms/qjoint.cpp @@ -40,8 +40,6 @@ #include "qjoint.h" #include "qjoint_p.h" -#include <Qt3DCore/qnodecreatedchange.h> - QT_BEGIN_NAMESPACE namespace Qt3DCore { @@ -350,7 +348,7 @@ void QJoint::addChildJoint(QJoint *joint) d->registerDestructionHelper(joint, &QJoint::removeChildJoint, d->m_childJoints); if (d->m_changeArbiter != nullptr) - d->updateNode(joint, "childJoint", PropertyValueAdded); + d->update(); } } @@ -363,7 +361,7 @@ void QJoint::removeChildJoint(QJoint *joint) Q_D(QJoint); if (d->m_childJoints.contains(joint)) { if (d->m_changeArbiter != nullptr) - d->updateNode(joint, "childJoint", PropertyValueRemoved); + d->update(); d->m_childJoints.removeOne(joint); @@ -390,21 +388,6 @@ QString QJoint::name() const return d->m_name; } -/*! \internal */ -Qt3DCore::QNodeCreatedChangeBasePtr QJoint::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QJointData>::create(this); - auto &data = creationChange->data; - Q_D(const QJoint); - data.inverseBindMatrix = d->m_inverseBindMatrix; - data.childJointIds = qIdsForNodes(d->m_childJoints); - data.rotation = d->m_rotation; - data.scale = d->m_scale; - data.translation = d->m_translation; - data.name = d->m_name; - return creationChange; -} - } // namespace Qt3DCore QT_END_NAMESPACE diff --git a/src/core/transforms/qjoint.h b/src/core/transforms/qjoint.h index d3672e99f..1bd404a1a 100644 --- a/src/core/transforms/qjoint.h +++ b/src/core/transforms/qjoint.h @@ -105,7 +105,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QJoint) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DCore diff --git a/src/core/transforms/qskeleton.cpp b/src/core/transforms/qskeleton.cpp index 141d8c0c4..751daaabe 100644 --- a/src/core/transforms/qskeleton.cpp +++ b/src/core/transforms/qskeleton.cpp @@ -40,7 +40,6 @@ #include "qskeleton.h" #include "qskeleton_p.h" #include <Qt3DCore/qjoint.h> -#include <Qt3DCore/private/qskeletoncreatedchange_p.h> QT_BEGIN_NAMESPACE @@ -50,7 +49,7 @@ QSkeletonPrivate::QSkeletonPrivate() : QAbstractSkeletonPrivate() , m_rootJoint(nullptr) { - m_type = QSkeletonCreatedChangeBase::Skeleton; + m_type = Skeleton; } /*! @@ -137,16 +136,6 @@ void QSkeleton::setRootJoint(Qt3DCore::QJoint *rootJoint) } } -/*! \internal */ -Qt3DCore::QNodeCreatedChangeBasePtr QSkeleton::createNodeCreationChange() const -{ - auto creationChange = QSkeletonCreatedChangePtr<QSkeletonData>::create(this); - auto &data = creationChange->data; - Q_D(const QSkeleton); - data.rootJointId = qIdForNode(d->m_rootJoint); - return creationChange; -} - } // namespace Qt3DCore QT_END_NAMESPACE diff --git a/src/core/transforms/qskeleton.h b/src/core/transforms/qskeleton.h index ecffe1aa9..51763b488 100644 --- a/src/core/transforms/qskeleton.h +++ b/src/core/transforms/qskeleton.h @@ -69,7 +69,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QSkeleton) - QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DCore diff --git a/src/core/transforms/qskeletonloader.cpp b/src/core/transforms/qskeletonloader.cpp index b1a311a0c..e86c72fbf 100644 --- a/src/core/transforms/qskeletonloader.cpp +++ b/src/core/transforms/qskeletonloader.cpp @@ -40,8 +40,6 @@ #include "qskeletonloader.h" #include "qskeletonloader_p.h" #include <Qt3DCore/qjoint.h> -#include <Qt3DCore/qpropertyupdatedchange.h> -#include <Qt3DCore/private/qskeletoncreatedchange_p.h> QT_BEGIN_NAMESPACE @@ -54,7 +52,7 @@ QSkeletonLoaderPrivate::QSkeletonLoaderPrivate() , m_status(QSkeletonLoader::NotReady) , m_rootJoint(nullptr) { - m_type = QSkeletonCreatedChangeBase::SkeletonLoader; + m_type = SkeletonLoader; } void QSkeletonLoaderPrivate::setStatus(QSkeletonLoader::Status status) @@ -241,23 +239,6 @@ void QSkeletonLoader::setRootJoint(QJoint *rootJoint) d->setRootJoint(rootJoint); } -/*! \internal */ -void QSkeletonLoader::sceneChangeEvent(const QSceneChangePtr &change) -{ - QAbstractSkeleton::sceneChangeEvent(change); -} - -/*! \internal */ -Qt3DCore::QNodeCreatedChangeBasePtr QSkeletonLoader::createNodeCreationChange() const -{ - auto creationChange = QSkeletonCreatedChangePtr<QSkeletonLoaderData>::create(this); - auto &data = creationChange->data; - Q_D(const QSkeletonLoader); - data.source = d->m_source; - data.createJoints = d->m_createJoints; - return creationChange; -} - } // namespace Qt3DCore QT_END_NAMESPACE diff --git a/src/core/transforms/qskeletonloader.h b/src/core/transforms/qskeletonloader.h index 516a84b0a..23b8cdda4 100644 --- a/src/core/transforms/qskeletonloader.h +++ b/src/core/transforms/qskeletonloader.h @@ -89,11 +89,9 @@ Q_SIGNALS: protected: explicit QSkeletonLoader(QSkeletonLoaderPrivate &dd, Qt3DCore::QNode *parent = nullptr); - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QSkeletonLoader) - QNodeCreatedChangeBasePtr createNodeCreationChange() const override; void setRootJoint(QJoint *rootJoint); // Needed for lifetime management of created joints }; diff --git a/src/core/transforms/qskeletonloader_p.h b/src/core/transforms/qskeletonloader_p.h index 6bd4e1eef..3284b772a 100644 --- a/src/core/transforms/qskeletonloader_p.h +++ b/src/core/transforms/qskeletonloader_p.h @@ -54,8 +54,6 @@ #include <Qt3DCore/private/qabstractskeleton_p.h> #include "qskeletonloader.h" -#include <Qt3DCore/private/qtypedpropertyupdatechange_p.h> - #include <memory> QT_BEGIN_NAMESPACE @@ -89,8 +87,6 @@ struct QSkeletonLoaderData }; class QJoint; -typedef QTypedPropertyUpdatedChange<std::unique_ptr<QJoint>> QJointChange; -typedef QTypedPropertyUpdatedChangePtr<std::unique_ptr<QJoint>> QJointChangePtr; } // namespace Qt3DCore diff --git a/src/core/transforms/qtransform.cpp b/src/core/transforms/qtransform.cpp index d41b87f79..edbca7280 100644 --- a/src/core/transforms/qtransform.cpp +++ b/src/core/transforms/qtransform.cpp @@ -40,8 +40,6 @@ #include "qtransform.h" #include "qtransform_p.h" -#include <Qt3DCore/qpropertyupdatedchange.h> - #include <Qt3DCore/private/qmath3d_p.h> QT_BEGIN_NAMESPACE @@ -234,35 +232,15 @@ QTransform::QTransform(QTransformPrivate &dd, QNode *parent) { } -/*! - \internal - */ -// TODO Unused remove in Qt6 -void QTransform::sceneChangeEvent(const QSceneChangePtr &change) -{ - Q_D(QTransform); - switch (change->type()) { - case PropertyUpdated: { - Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(change); - if (propertyChange->propertyName() == QByteArrayLiteral("worldMatrix")) { - const bool blocked = blockNotifications(true); - d->setWorldMatrix(propertyChange->value().value<QMatrix4x4>()); - blockNotifications(blocked); - } - break; - } - default: - break; - } -} - void QTransformPrivate::setWorldMatrix(const QMatrix4x4 &worldMatrix) { Q_Q(QTransform); if (m_worldMatrix == worldMatrix) return; + const bool blocked = q->blockNotifications(true); m_worldMatrix = worldMatrix; emit q->worldMatrixChanged(worldMatrix); + q->blockNotifications(blocked); } void QTransform::setMatrix(const QMatrix4x4 &m) @@ -631,19 +609,6 @@ QMatrix4x4 QTransform::rotateFromAxes(const QVector3D &xAxis, const QVector3D &y 0.0f, 0.0f, 0.0f, 1.0f); } -QNodeCreatedChangeBasePtr QTransform::createNodeCreationChange() const -{ - auto creationChange = QNodeCreatedChangePtr<QTransformData>::create(this); - auto &data = creationChange->data; - - Q_D(const QTransform); - data.rotation = d->m_rotation; - data.scale = d->m_scale; - data.translation = d->m_translation; - - return creationChange; -} - } // namespace Qt3DCore QT_END_NAMESPACE diff --git a/src/core/transforms/qtransform.h b/src/core/transforms/qtransform.h index ce6bf42fa..fa2d84baf 100644 --- a/src/core/transforms/qtransform.h +++ b/src/core/transforms/qtransform.h @@ -119,12 +119,9 @@ Q_SIGNALS: protected: explicit QTransform(QTransformPrivate &dd, QNode *parent = nullptr); - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QTransform) - QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DCore |