diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2018-01-17 11:49:32 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2018-01-17 11:49:32 +0000 |
commit | b420edb0b5e914b83c35a071b371d0759eba4d3d (patch) | |
tree | e84852a8c44a18fe6aeadf29cba5dcdefe8e9e58 /src | |
parent | 24b2599b91c51ae4b7f2c161cf46696bbde67624 (diff) | |
parent | e9594f27ccad5667ebc27451f87184296c5cd297 (diff) |
Merge branch '5.10' into dev
Conflicts:
.qmake.conf
Change-Id: I248aa369ba98659a61e563fd29cc811c76ea1e2d
Diffstat (limited to 'src')
103 files changed, 318 insertions, 354 deletions
diff --git a/src/animation/backend/buildblendtreesjob.cpp b/src/animation/backend/buildblendtreesjob.cpp index f35280cbf..cb7eb19c8 100644 --- a/src/animation/backend/buildblendtreesjob.cpp +++ b/src/animation/backend/buildblendtreesjob.cpp @@ -63,7 +63,7 @@ void BuildBlendTreesJob::setBlendedClipAnimators(const QVector<HBlendedClipAnima // We assume that the structure of blend node tree does not change once a BlendClipAnimator has been set to running void BuildBlendTreesJob::run() { - for (const HBlendedClipAnimator blendedClipAnimatorHandle : qAsConst(m_blendedClipAnimatorHandles)) { + for (const HBlendedClipAnimator &blendedClipAnimatorHandle : qAsConst(m_blendedClipAnimatorHandles)) { // Retrieve BlendTree node BlendedClipAnimator *blendClipAnimator = m_handler->blendedClipAnimatorManager()->data(blendedClipAnimatorHandle); Q_ASSERT(blendClipAnimator); diff --git a/src/animation/backend/gltfimporter.cpp b/src/animation/backend/gltfimporter.cpp index 8d9b5bb60..d9c0cb9a6 100644 --- a/src/animation/backend/gltfimporter.cpp +++ b/src/animation/backend/gltfimporter.cpp @@ -94,7 +94,7 @@ void jsonArrayToSqt(const QJsonArray &jsonArray, Qt3DCore::Sqt &sqt) QMatrix4x4 m; float *data = m.data(); int i = 0; - for (const auto element : jsonArray) + for (const auto &element : jsonArray) *(data + i++) = static_cast<float>(element.toDouble()); decomposeQMatrix4x4(m, sqt); @@ -784,7 +784,7 @@ bool GLTFImporter::processJSONSkin(const QJsonObject &json) bool GLTFImporter::processJSONAnimation(const QJsonObject &json) { - Animation animation(json); + const Animation animation(json); for (const auto &channel : animation.channels) { if (channel.samplerIndex == -1) diff --git a/src/animation/backend/handle_types_p.h b/src/animation/backend/handle_types_p.h index f05df22fe..5f80a5494 100644 --- a/src/animation/backend/handle_types_p.h +++ b/src/animation/backend/handle_types_p.h @@ -65,12 +65,12 @@ class ChannelMapping; class ChannelMapper; class Skeleton; -typedef Qt3DCore::QHandle<AnimationClip, 16> HAnimationClip; -typedef Qt3DCore::QHandle<ClipAnimator, 16> HClipAnimator; -typedef Qt3DCore::QHandle<BlendedClipAnimator, 12> HBlendedClipAnimator; -typedef Qt3DCore::QHandle<ChannelMapping, 16> HChannelMapping; -typedef Qt3DCore::QHandle<ChannelMapper, 16> HChannelMapper; -typedef Qt3DCore::QHandle<Skeleton, 16> HSkeleton; +typedef Qt3DCore::QHandle<AnimationClip> HAnimationClip; +typedef Qt3DCore::QHandle<ClipAnimator> HClipAnimator; +typedef Qt3DCore::QHandle<BlendedClipAnimator> HBlendedClipAnimator; +typedef Qt3DCore::QHandle<ChannelMapping> HChannelMapping; +typedef Qt3DCore::QHandle<ChannelMapper> HChannelMapper; +typedef Qt3DCore::QHandle<Skeleton> HSkeleton; } // namespace Animation } // namespace Qt3DAnimation diff --git a/src/animation/backend/loadanimationclipjob.cpp b/src/animation/backend/loadanimationclipjob.cpp index 4584449bc..d3319f8e1 100644 --- a/src/animation/backend/loadanimationclipjob.cpp +++ b/src/animation/backend/loadanimationclipjob.cpp @@ -70,7 +70,7 @@ void LoadAnimationClipJob::run() { Q_ASSERT(m_handler); AnimationClipLoaderManager *animationClipManager = m_handler->animationClipLoaderManager(); - for (const auto animationClipHandle : qAsConst(m_animationClipHandles)) { + for (const auto &animationClipHandle : qAsConst(m_animationClipHandles)) { AnimationClip *animationClip = animationClipManager->data(animationClipHandle); Q_ASSERT(animationClip); animationClip->loadAnimation(); diff --git a/src/animation/backend/managers_p.h b/src/animation/backend/managers_p.h index b88f1b8ae..ba4bcf730 100644 --- a/src/animation/backend/managers_p.h +++ b/src/animation/backend/managers_p.h @@ -71,8 +71,7 @@ class ClipBlendNode; class AnimationClipLoaderManager : public Qt3DCore::QResourceManager< AnimationClip, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: AnimationClipLoaderManager() {} @@ -80,8 +79,7 @@ public: class ClockManager : public Qt3DCore::QResourceManager< Clock, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: ClockManager() {} @@ -89,8 +87,7 @@ public: class ClipAnimatorManager : public Qt3DCore::QResourceManager< ClipAnimator, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: ClipAnimatorManager() {} @@ -98,8 +95,7 @@ public: class BlendedClipAnimatorManager : public Qt3DCore::QResourceManager< BlendedClipAnimator, - Qt3DCore::QNodeId, - 12> + Qt3DCore::QNodeId> { public: BlendedClipAnimatorManager() {} @@ -107,8 +103,7 @@ public: class ChannelMappingManager : public Qt3DCore::QResourceManager< ChannelMapping, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: ChannelMappingManager() {} @@ -116,8 +111,7 @@ public: class ChannelMapperManager : public Qt3DCore::QResourceManager< ChannelMapper, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: ChannelMapperManager() {} @@ -140,8 +134,7 @@ private: class SkeletonManager : public Qt3DCore::QResourceManager< Skeleton, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: SkeletonManager() {} diff --git a/src/animation/frontend/qanimationclipdata.cpp b/src/animation/frontend/qanimationclipdata.cpp index fe5e7c1e0..1dbbe4a30 100644 --- a/src/animation/frontend/qanimationclipdata.cpp +++ b/src/animation/frontend/qanimationclipdata.cpp @@ -122,12 +122,12 @@ bool QAnimationClipData::isValid() const Q_DECL_NOTHROW QAnimationClipData::const_iterator QAnimationClipData::begin() const Q_DECL_NOTHROW { - return d->m_channels.begin(); + return d->m_channels.cbegin(); } QAnimationClipData::const_iterator QAnimationClipData::end() const Q_DECL_NOTHROW { - return d->m_channels.end(); + return d->m_channels.cend(); } diff --git a/src/animation/frontend/qanimationgroup.h b/src/animation/frontend/qanimationgroup.h index 1e23c61ee..a4f34c815 100644 --- a/src/animation/frontend/qanimationgroup.h +++ b/src/animation/frontend/qanimationgroup.h @@ -37,7 +37,7 @@ #ifndef QT3DANIMATION_QANIMATIONGROUP_H #define QT3DANIMATION_QANIMATIONGROUP_H -#include <qobject.h> +#include <QtCore/qobject.h> #include <Qt3DAnimation/qabstractanimation.h> diff --git a/src/animation/frontend/qchannel.cpp b/src/animation/frontend/qchannel.cpp index f5e4ac7a3..801ad385b 100644 --- a/src/animation/frontend/qchannel.cpp +++ b/src/animation/frontend/qchannel.cpp @@ -128,12 +128,12 @@ void QChannel::clearChannelComponents() QChannel::const_iterator QChannel::begin() const Q_DECL_NOTHROW { - return d->m_channelComponents.begin(); + return d->m_channelComponents.cbegin(); } QChannel::const_iterator QChannel::end() const Q_DECL_NOTHROW { - return d->m_channelComponents.end(); + return d->m_channelComponents.cend(); } bool operator==(const QChannel &lhs, const QChannel &rhs) Q_DECL_NOTHROW diff --git a/src/animation/frontend/qchannelcomponent.cpp b/src/animation/frontend/qchannelcomponent.cpp index 1ecc5520c..b8511dd1f 100644 --- a/src/animation/frontend/qchannelcomponent.cpp +++ b/src/animation/frontend/qchannelcomponent.cpp @@ -117,12 +117,12 @@ void QChannelComponent::clearKeyFrames() QChannelComponent::const_iterator QChannelComponent::begin() const Q_DECL_NOTHROW { - return d->m_keyFrames.begin(); + return d->m_keyFrames.cbegin(); } QChannelComponent::const_iterator QChannelComponent::end() const Q_DECL_NOTHROW { - return d->m_keyFrames.end(); + return d->m_keyFrames.cend(); } bool operator==(const QChannelComponent &lhs, const QChannelComponent &rhs) Q_DECL_NOTHROW diff --git a/src/core/aspects/qabstractaspect.cpp b/src/core/aspects/qabstractaspect.cpp index dd1f37da4..2e37df60b 100644 --- a/src/core/aspects/qabstractaspect.cpp +++ b/src/core/aspects/qabstractaspect.cpp @@ -238,7 +238,8 @@ void QAbstractAspectPrivate::clearBackendNode(const QNodeDestroyedChangePtr &cha { // Each QNodeDestroyedChange may contain info about a whole sub-tree of nodes that // are being destroyed. Iterate over them and process each in turn - for (const auto &idAndType : change->subtreeIdsAndTypes()) { + const auto subTree = change->subtreeIdsAndTypes(); + for (const auto &idAndType : subTree) { const QMetaObject *metaObj = idAndType.type; QBackendNodeMapperPtr backendNodeMapper; diff --git a/src/core/aspects/qaspectmanager_p.h b/src/core/aspects/qaspectmanager_p.h index 1c87738ed..0a703a776 100644 --- a/src/core/aspects/qaspectmanager_p.h +++ b/src/core/aspects/qaspectmanager_p.h @@ -98,6 +98,7 @@ public Q_SLOTS: void exec(); void quit(); +public: const QVector<QAbstractAspect *> &aspects() const; QAbstractAspectJobManager *jobManager() const; QChangeArbiter *changeArbiter() const; diff --git a/src/core/resources/qhandle_p.h b/src/core/resources/qhandle_p.h index 95483d197..46bd5f5d4 100644 --- a/src/core/resources/qhandle_p.h +++ b/src/core/resources/qhandle_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE namespace Qt3DCore { -template <typename T, uint INDEXBITS = 16> +template <typename T> class QHandle { public: @@ -106,8 +106,8 @@ private: }; -template <typename T, uint INDEXBITS> -QDebug operator<<(QDebug dbg, const QHandle<T, INDEXBITS> &h) +template <typename T> +QDebug operator<<(QDebug dbg, const QHandle<T> &h) { QDebugStateSaver saver(dbg); QString binNumber = QString::number(h.handle(), 2).rightJustified(32, QChar::fromLatin1('0')); @@ -116,8 +116,8 @@ QDebug operator<<(QDebug dbg, const QHandle<T, INDEXBITS> &h) return dbg; } -template <typename T, uint INDEXBITS = 16> -uint qHash(const QHandle<T, INDEXBITS> &h, uint seed) +template <typename T> +uint qHash(const QHandle<T> &h, uint seed) { using QT_PREPEND_NAMESPACE(qHash); return qHash(h.handle(), seed); @@ -126,9 +126,9 @@ uint qHash(const QHandle<T, INDEXBITS> &h, uint seed) } // Qt3DCore // simpler than fighting the Q_DECLARE_TYPEINFO macro, use QString as a dummy to get movable semantics -template <typename T, uint I> -class QTypeInfo<Qt3DCore::QHandle<T,I> > - : public QTypeInfoMerger<Qt3DCore::QHandle<T,I>, QString> {}; +template <typename T> +class QTypeInfo<Qt3DCore::QHandle<T> > + : public QTypeInfoMerger<Qt3DCore::QHandle<T>, QString> {}; QT_END_NAMESPACE diff --git a/src/core/resources/qresourcemanager_p.h b/src/core/resources/qresourcemanager_p.h index 8f0440498..0ed86ef21 100644 --- a/src/core/resources/qresourcemanager_p.h +++ b/src/core/resources/qresourcemanager_p.h @@ -220,24 +220,24 @@ struct Int2Type }; }; -template<typename T, uint INDEXBITS = 16> -class QHandleData : public QHandle<T, INDEXBITS>::Data +template<typename T> +class QHandleData : public QHandle<T>::Data { public: T data; }; -template<typename T, uint INDEXBITS> -inline T *QHandle<T, INDEXBITS>::operator->() const { return (d && counter == d->counter) ? &static_cast<QHandleData<T, INDEXBITS> *>(d)->data : nullptr; } -template<typename T, uint INDEXBITS> -inline T *QHandle<T, INDEXBITS>::data() const { return (d && counter == d->counter) ? &static_cast<QHandleData<T, INDEXBITS> *>(d)->data : nullptr; } +template<typename T> +inline T *QHandle<T>::operator->() const { return (d && counter == d->counter) ? &static_cast<QHandleData<T> *>(d)->data : nullptr; } +template<typename T> +inline T *QHandle<T>::data() const { return (d && counter == d->counter) ? &static_cast<QHandleData<T> *>(d)->data : nullptr; } -template <typename T, uint INDEXBITS = 16> +template <typename T> class ArrayAllocatingPolicy { public: - typedef QHandleData<T, INDEXBITS> HandleData; - typedef QHandle<T, INDEXBITS> Handle; + typedef QHandleData<T> HandleData; + typedef QHandle<T> Handle; ArrayAllocatingPolicy() { } @@ -267,7 +267,7 @@ public: typename Handle::Data *d = handle.data_ptr(); d->nextFree = freeList; freeList = d; - performCleanup(&static_cast<QHandleData<T, INDEXBITS> *>(d)->data, Int2Type<QResourceInfo<T>::needsCleanup>()); + performCleanup(&static_cast<QHandleData<T> *>(d)->data, Int2Type<QResourceInfo<T>::needsCleanup>()); } T *data(Handle h) { @@ -340,31 +340,30 @@ private: }; #ifndef QT_NO_DEBUG_STREAM -template <typename ValueType, typename KeyType, uint INDEXBITS, +template <typename ValueType, typename KeyType, template <class> class LockingPolicy > class QResourceManager; -template <typename ValueType, typename KeyType, uint INDEXBITS = 16, +template <typename ValueType, typename KeyType, template <class> class LockingPolicy = NonLockingPolicy > -QDebug operator<<(QDebug dbg, const QResourceManager<ValueType, KeyType, INDEXBITS, LockingPolicy> &manager); +QDebug operator<<(QDebug dbg, const QResourceManager<ValueType, KeyType, LockingPolicy> &manager); #endif -template <typename ValueType, typename KeyType, uint INDEXBITS = 16, +template <typename ValueType, typename KeyType, template <class> class LockingPolicy = NonLockingPolicy > class QResourceManager - : public ArrayAllocatingPolicy<ValueType, INDEXBITS> - , public LockingPolicy< QResourceManager<ValueType, KeyType, INDEXBITS, LockingPolicy> > + : public ArrayAllocatingPolicy<ValueType> + , public LockingPolicy< QResourceManager<ValueType, KeyType, LockingPolicy> > { public: - typedef ArrayAllocatingPolicy<ValueType, INDEXBITS> Allocator; - typedef QHandle<ValueType, INDEXBITS> Handle; + typedef ArrayAllocatingPolicy<ValueType> Allocator; + typedef QHandle<ValueType> Handle; QResourceManager() : - Allocator(), - m_maxSize((1 << INDEXBITS) - 1) + Allocator() { } @@ -443,24 +442,21 @@ public: Allocator::releaseResource(handle); } - int maximumSize() const { return m_maxSize; } - protected: QHash<KeyType, Handle > m_keyToHandleMap; - const int m_maxSize; private: - friend QDebug operator<< <>(QDebug dbg, const QResourceManager<ValueType, KeyType, INDEXBITS, LockingPolicy> &manager); + friend QDebug operator<< <>(QDebug dbg, const QResourceManager<ValueType, KeyType, LockingPolicy> &manager); }; #ifndef QT_NO_DEBUG_STREAM -template <typename ValueType, typename KeyType, uint INDEXBITS, +template <typename ValueType, typename KeyType, template <class> class LockingPolicy > -QDebug operator<<(QDebug dbg, const QResourceManager<ValueType, KeyType, INDEXBITS, LockingPolicy> &manager) +QDebug operator<<(QDebug dbg, const QResourceManager<ValueType, KeyType, LockingPolicy> &manager) { QDebugStateSaver saver(dbg); - dbg << "Contains" << manager.count() << "items" << "of a maximum" << manager.maximumSize() << endl; + dbg << "Contains" << manager.count() << "items" << endl; dbg << "Key to Handle Map:" << endl; const auto end = manager.m_keyToHandleMap.cend(); diff --git a/src/core/services/qdownloadnetworkworker.cpp b/src/core/services/qdownloadnetworkworker.cpp index c728a1779..e1f806e92 100644 --- a/src/core/services/qdownloadnetworkworker.cpp +++ b/src/core/services/qdownloadnetworkworker.cpp @@ -91,7 +91,7 @@ void QDownloadNetworkWorker::onRequestCancelled(const QDownloadRequestPtr &reque void QDownloadNetworkWorker::onAllRequestsCancelled() { QMutexLocker l(&m_mutex); - for (auto e: qAsConst(m_requests)) { + for (auto &e: qAsConst(m_requests)) { e.first->m_cancelled = true; e.second->abort(); } diff --git a/src/extras/3dtext/qextrudedtextgeometry.h b/src/extras/3dtext/qextrudedtextgeometry.h index 9ee8b23f0..d6e682dbd 100644 --- a/src/extras/3dtext/qextrudedtextgeometry.h +++ b/src/extras/3dtext/qextrudedtextgeometry.h @@ -53,8 +53,8 @@ #include <Qt3DExtras/qt3dextras_global.h> #include <Qt3DRender/qgeometry.h> -#include <QString> -#include <QFont> +#include <QtCore/QString> +#include <QtGui/QFont> QT_BEGIN_NAMESPACE diff --git a/src/extras/3dtext/qextrudedtextmesh.h b/src/extras/3dtext/qextrudedtextmesh.h index 3f2f41a37..ea3054003 100644 --- a/src/extras/3dtext/qextrudedtextmesh.h +++ b/src/extras/3dtext/qextrudedtextmesh.h @@ -53,8 +53,8 @@ #include <Qt3DExtras/qt3dextras_global.h> #include <Qt3DRender/qgeometryrenderer.h> -#include <QString> -#include <QFont> +#include <QtCore/QString> +#include <QtGui/QFont> QT_BEGIN_NAMESPACE diff --git a/src/extras/defaults/qabstractspritesheet.h b/src/extras/defaults/qabstractspritesheet.h index cb8b70fd9..bbef65798 100644 --- a/src/extras/defaults/qabstractspritesheet.h +++ b/src/extras/defaults/qabstractspritesheet.h @@ -42,8 +42,8 @@ #include <Qt3DExtras/qt3dextras_global.h> #include <Qt3DCore/QNode> -#include <QVector2D> -#include <QMatrix3x3> +#include <QtGui/QVector2D> +#include <QtGui/QMatrix3x3> QT_BEGIN_NAMESPACE diff --git a/src/extras/defaults/qmorphphongmaterial.h b/src/extras/defaults/qmorphphongmaterial.h index 3b65088b1..235426f1c 100644 --- a/src/extras/defaults/qmorphphongmaterial.h +++ b/src/extras/defaults/qmorphphongmaterial.h @@ -39,7 +39,7 @@ #include <Qt3DExtras/qt3dextras_global.h> #include <Qt3DRender/qmaterial.h> -#include <QColor> +#include <QtGui/QColor> QT_BEGIN_NAMESPACE diff --git a/src/extras/defaults/qspritegrid.h b/src/extras/defaults/qspritegrid.h index 3b6a7005a..a0e73abdf 100644 --- a/src/extras/defaults/qspritegrid.h +++ b/src/extras/defaults/qspritegrid.h @@ -42,8 +42,8 @@ #include <Qt3DExtras/qabstractspritesheet.h> #include <Qt3DCore/qcomponent.h> -#include <QVector2D> -#include <QMatrix3x3> +#include <QtGui/QVector2D> +#include <QtGui/QMatrix3x3> QT_BEGIN_NAMESPACE diff --git a/src/extras/defaults/qspritesheet.h b/src/extras/defaults/qspritesheet.h index 00fd293c3..0e78c0e22 100644 --- a/src/extras/defaults/qspritesheet.h +++ b/src/extras/defaults/qspritesheet.h @@ -41,8 +41,8 @@ #define QT3DEXTRAS_QSPRITESHEET_H #include <Qt3DExtras/qabstractspritesheet.h> -#include <QRect> -#include <QVector> +#include <QtCore/QRect> +#include <QtCore/QVector> QT_BEGIN_NAMESPACE diff --git a/src/extras/defaults/qtexturematerial.h b/src/extras/defaults/qtexturematerial.h index b6347aff4..c4fb43f50 100644 --- a/src/extras/defaults/qtexturematerial.h +++ b/src/extras/defaults/qtexturematerial.h @@ -42,8 +42,8 @@ #include <Qt3DExtras/qt3dextras_global.h> #include <Qt3DRender/qmaterial.h> -#include <QVector2D> -#include <QMatrix3x3> +#include <QtGui/QVector2D> +#include <QtGui/QMatrix3x3> QT_BEGIN_NAMESPACE diff --git a/src/input/backend/assignkeyboardfocusjob.cpp b/src/input/backend/assignkeyboardfocusjob.cpp index 216c914d4..385074812 100644 --- a/src/input/backend/assignkeyboardfocusjob.cpp +++ b/src/input/backend/assignkeyboardfocusjob.cpp @@ -67,7 +67,7 @@ void AssignKeyboardFocusJob::run() { KeyboardDevice *keyboardDevice = m_inputHandler->keyboardDeviceManager()->lookupResource(m_keyboardDevice); const auto handles = m_inputHandler->keyboardInputManager()->activeHandles(); - for (const HKeyboardHandler handle : handles) { + for (const HKeyboardHandler &handle : handles) { KeyboardHandler *input = m_inputHandler->keyboardInputManager()->data(handle); Q_ASSERT(input); if (input->keyboardDevice() == m_keyboardDevice) { diff --git a/src/input/backend/axisaccumulatorjob.cpp b/src/input/backend/axisaccumulatorjob.cpp index 03e680ddb..cda8a5e26 100644 --- a/src/input/backend/axisaccumulatorjob.cpp +++ b/src/input/backend/axisaccumulatorjob.cpp @@ -62,7 +62,7 @@ void AxisAccumulatorJob::run() { // Iterate over the accumulators and ask each to step the integrations const auto activeHandles = m_axisAccumulatorManager->activeHandles(); - for (auto accumulatorHandle : activeHandles) { + for (const auto &accumulatorHandle : activeHandles) { AxisAccumulator *accumulator = m_axisAccumulatorManager->data(accumulatorHandle); if (accumulator->isEnabled()) accumulator->stepIntegration(m_axisManager, m_dt); diff --git a/src/input/backend/handle_types_p.h b/src/input/backend/handle_types_p.h index c132fdc99..cfe4e66b4 100644 --- a/src/input/backend/handle_types_p.h +++ b/src/input/backend/handle_types_p.h @@ -75,22 +75,22 @@ class GenericDeviceBackendNode; class PhysicalDeviceProxy; class AxisAccumulator; -typedef Qt3DCore::QHandle<KeyboardDevice, 8> HKeyboardDevice; -typedef Qt3DCore::QHandle<KeyboardHandler, 16> HKeyboardHandler; -typedef Qt3DCore::QHandle<MouseHandler, 16> HMouseHandler; -typedef Qt3DCore::QHandle<MouseDevice, 8> HMouseDevice; -typedef Qt3DCore::QHandle<Axis, 16> HAxis; -typedef Qt3DCore::QHandle<AxisActionHandler, 16> HAxisActionHandler; -typedef Qt3DCore::QHandle<AxisSetting, 16> HAxisSetting; -typedef Qt3DCore::QHandle<Action, 16> HAction; -typedef Qt3DCore::QHandle<AbstractAxisInput, 16> HAxisInput; -typedef Qt3DCore::QHandle<ActionInput, 16> HActionInput; -typedef Qt3DCore::QHandle<InputSequence, 16> HInputSequence; -typedef Qt3DCore::QHandle<InputChord, 16> HInputChord; -typedef Qt3DCore::QHandle<LogicalDevice, 16> HLogicalDevice; -typedef Qt3DCore::QHandle<GenericDeviceBackendNode, 8> HGenericDeviceBackendNode; -typedef Qt3DCore::QHandle<PhysicalDeviceProxy, 16> HPhysicalDeviceProxy; -typedef Qt3DCore::QHandle<AxisAccumulator, 16> HAxisAccumulator; +typedef Qt3DCore::QHandle<KeyboardDevice> HKeyboardDevice; +typedef Qt3DCore::QHandle<KeyboardHandler> HKeyboardHandler; +typedef Qt3DCore::QHandle<MouseHandler> HMouseHandler; +typedef Qt3DCore::QHandle<MouseDevice> HMouseDevice; +typedef Qt3DCore::QHandle<Axis> HAxis; +typedef Qt3DCore::QHandle<AxisActionHandler> HAxisActionHandler; +typedef Qt3DCore::QHandle<AxisSetting> HAxisSetting; +typedef Qt3DCore::QHandle<Action> HAction; +typedef Qt3DCore::QHandle<AbstractAxisInput> HAxisInput; +typedef Qt3DCore::QHandle<ActionInput> HActionInput; +typedef Qt3DCore::QHandle<InputSequence> HInputSequence; +typedef Qt3DCore::QHandle<InputChord> HInputChord; +typedef Qt3DCore::QHandle<LogicalDevice> HLogicalDevice; +typedef Qt3DCore::QHandle<GenericDeviceBackendNode> HGenericDeviceBackendNode; +typedef Qt3DCore::QHandle<PhysicalDeviceProxy> HPhysicalDeviceProxy; +typedef Qt3DCore::QHandle<AxisAccumulator> HAxisAccumulator; } // namespace Input } // namespace Qt3DInput diff --git a/src/input/backend/inputhandler.cpp b/src/input/backend/inputhandler.cpp index 525a45b6c..18559e9d4 100644 --- a/src/input/backend/inputhandler.cpp +++ b/src/input/backend/inputhandler.cpp @@ -221,7 +221,7 @@ QVector<Qt3DCore::QAspectJobPtr> InputHandler::keyboardJobs() QVector<QAspectJobPtr> jobs; const QList<QT_PREPEND_NAMESPACE(QKeyEvent)> events = pendingKeyEvents(); - for (const HKeyboardDevice cHandle : qAsConst(m_activeKeyboardDevices)) { + for (const HKeyboardDevice &cHandle : qAsConst(m_activeKeyboardDevices)) { KeyboardDevice *keyboardDevice = m_keyboardDeviceManager->data(cHandle); if (keyboardDevice) { keyboardDevice->updateKeyEvents(events); @@ -254,7 +254,7 @@ QVector<Qt3DCore::QAspectJobPtr> InputHandler::mouseJobs() const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> wheelEvents = pendingWheelEvents(); #endif - for (const HMouseDevice cHandle : qAsConst(m_activeMouseDevices)) { + for (const HMouseDevice &cHandle : qAsConst(m_activeMouseDevices)) { MouseDevice *controller = m_mouseDeviceManager->data(cHandle); controller->updateMouseEvents(mouseEvents); @@ -269,7 +269,7 @@ QVector<Qt3DCore::QAspectJobPtr> InputHandler::mouseJobs() ) { // Send the events to the mouse handlers that have for sourceDevice controller const QVector<HMouseHandler> activeMouseHandlers = m_mouseInputManager->activeHandles(); - for (HMouseHandler mouseHandlerHandle : activeMouseHandlers) { + for (const HMouseHandler &mouseHandlerHandle : activeMouseHandlers) { MouseHandler *mouseHandler = m_mouseInputManager->data(mouseHandlerHandle); Q_ASSERT(mouseHandler); diff --git a/src/input/backend/inputmanagers_p.h b/src/input/backend/inputmanagers_p.h index 956b0ab8b..eee8b27d3 100644 --- a/src/input/backend/inputmanagers_p.h +++ b/src/input/backend/inputmanagers_p.h @@ -79,8 +79,7 @@ namespace Input { class KeyboardInputManager : public Qt3DCore::QResourceManager< KeyboardHandler, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: KeyboardInputManager() {} @@ -88,8 +87,7 @@ public: class KeyboardDeviceManager : public Qt3DCore::QResourceManager< KeyboardDevice, - Qt3DCore::QNodeId, - 8> + Qt3DCore::QNodeId> { public: KeyboardDeviceManager() {} @@ -97,8 +95,7 @@ public: class MouseDeviceManager : public Qt3DCore::QResourceManager< MouseDevice, - Qt3DCore::QNodeId, - 8> + Qt3DCore::QNodeId> { public: MouseDeviceManager() {} @@ -106,8 +103,7 @@ public: class MouseInputManager : public Qt3DCore::QResourceManager< MouseHandler, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: MouseInputManager() {} @@ -115,8 +111,7 @@ public: class AxisManager : public Qt3DCore::QResourceManager< Axis, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: AxisManager() {} @@ -124,8 +119,7 @@ public: class AxisSettingManager : public Qt3DCore::QResourceManager< AxisSetting, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: AxisSettingManager() {} @@ -133,8 +127,7 @@ public: class ActionManager : public Qt3DCore::QResourceManager< Action, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: ActionManager() {} @@ -142,8 +135,7 @@ public: class ActionInputManager : public Qt3DCore::QResourceManager< ActionInput, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: ActionInputManager() {} @@ -151,8 +143,7 @@ public: class AnalogAxisInputManager : public Qt3DCore::QResourceManager< AnalogAxisInput, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: AnalogAxisInputManager() {} @@ -160,8 +151,7 @@ public: class ButtonAxisInputManager : public Qt3DCore::QResourceManager< ButtonAxisInput, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: ButtonAxisInputManager() {} @@ -169,8 +159,7 @@ public: class InputChordManager : public Qt3DCore::QResourceManager< InputChord, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: InputChordManager() {} @@ -178,8 +167,7 @@ public: class InputSequenceManager : public Qt3DCore::QResourceManager< InputSequence, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: InputSequenceManager() {} @@ -187,8 +175,7 @@ public: class LogicalDeviceManager : public Qt3DCore::QResourceManager< LogicalDevice, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: LogicalDeviceManager() {} @@ -203,8 +190,7 @@ private: class GenericDeviceBackendNodeManager : public Qt3DCore::QResourceManager< GenericDeviceBackendNode, - Qt3DCore::QNodeId, - 8> + Qt3DCore::QNodeId> { public: GenericDeviceBackendNodeManager() {} @@ -212,8 +198,7 @@ public: class Q_AUTOTEST_EXPORT PhysicalDeviceProxyManager : public Qt3DCore::QResourceManager< PhysicalDeviceProxy, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: PhysicalDeviceProxyManager() {} @@ -227,8 +212,7 @@ private: class AxisAccumulatorManager : public Qt3DCore::QResourceManager< AxisAccumulator, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: AxisAccumulatorManager() {} diff --git a/src/input/frontend/qinputaspect.cpp b/src/input/frontend/qinputaspect.cpp index cec1ca91c..b37e32d43 100644 --- a/src/input/frontend/qinputaspect.cpp +++ b/src/input/frontend/qinputaspect.cpp @@ -255,7 +255,7 @@ QVector<QAspectJobPtr> QInputAspect::jobsToExecute(qint64 time) const auto devHandles = d->m_inputHandler->logicalDeviceManager()->activeDevices(); QVector<QAspectJobPtr> axisActionJobs; axisActionJobs.reserve(devHandles.size()); - for (Input::HLogicalDevice devHandle : devHandles) { + for (const Input::HLogicalDevice &devHandle : devHandles) { const auto device = d->m_inputHandler->logicalDeviceManager()->data(devHandle); if (!device->isEnabled()) continue; diff --git a/src/logic/handle_types_p.h b/src/logic/handle_types_p.h index d137a4047..106241e2c 100644 --- a/src/logic/handle_types_p.h +++ b/src/logic/handle_types_p.h @@ -59,7 +59,7 @@ namespace Qt3DLogic { namespace Logic { class Handler; -typedef Qt3DCore::QHandle<Handler, 16> HHandler; +typedef Qt3DCore::QHandle<Handler> HHandler; } // namespace Logic } // namespace Qt3DLogic diff --git a/src/logic/managers_p.h b/src/logic/managers_p.h index 3d48aab24..17c230d28 100644 --- a/src/logic/managers_p.h +++ b/src/logic/managers_p.h @@ -64,8 +64,7 @@ namespace Logic { class HandlerManager : public Qt3DCore::QResourceManager< Handler, - Qt3DCore::QNodeId, - 16> + Qt3DCore::QNodeId> { public: HandlerManager() {} diff --git a/src/plugins/renderplugins/scene2d/scene2dplugin.h b/src/plugins/renderplugins/scene2d/scene2dplugin.h index 1a5d84492..4f972a87c 100644 --- a/src/plugins/renderplugins/scene2d/scene2dplugin.h +++ b/src/plugins/renderplugins/scene2d/scene2dplugin.h @@ -67,7 +67,6 @@ class Scene2DNode; class Scene2DNodeManager : public Qt3DCore::QResourceManager< Render::Quick::Scene2D, Qt3DCore::QNodeId, - 16, Qt3DCore::ObjectLevelLockingPolicy> { }; diff --git a/src/plugins/sceneparsers/assimp/assimpimporter.cpp b/src/plugins/sceneparsers/assimp/assimpimporter.cpp index 3a06c7807..66446ced5 100644 --- a/src/plugins/sceneparsers/assimp/assimpimporter.cpp +++ b/src/plugins/sceneparsers/assimp/assimpimporter.cpp @@ -380,7 +380,7 @@ AssimpImporter::~AssimpImporter() */ bool AssimpImporter::areAssimpExtensions(const QStringList &extensions) { - for (const auto ext : qAsConst(extensions)) + for (const auto &ext : qAsConst(extensions)) if (AssimpImporter::assimpSupportedFormatsList.contains(ext.toLower())) return true; return false; diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.cpp b/src/plugins/sceneparsers/gltf/gltfimporter.cpp index 4419bd708..9b8057334 100644 --- a/src/plugins/sceneparsers/gltf/gltfimporter.cpp +++ b/src/plugins/sceneparsers/gltf/gltfimporter.cpp @@ -1107,7 +1107,7 @@ void GLTFImporter::cleanup() m_shaderPaths.clear(); delete_if_without_parent(m_programs); m_programs.clear(); - for (auto params : qAsConst(m_techniqueParameters)) + for (const auto ¶ms : qAsConst(m_techniqueParameters)) delete_if_without_parent(params); m_techniqueParameters.clear(); delete_if_without_parent(m_techniques); @@ -1581,7 +1581,8 @@ void GLTFImporter::processJSONExtensions(const QString &id, const QJsonObject &j // level GLTF item. if (id == KEY_COMMON_MAT) { const auto lights = jsonObject.value(KEY_LIGHTS).toObject(); - for (const auto &lightKey : lights.keys()) { + const auto keys = lights.keys(); + for (const auto &lightKey : keys) { const auto light = lights.value(lightKey).toObject(); auto lightType = light.value(KEY_TYPE).toString(); const auto lightValues = light.value(lightType).toObject(); diff --git a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp index ba100e095..56c94a19c 100644 --- a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp +++ b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp @@ -394,7 +394,7 @@ bool GLTFExporter::exportScene(QEntity *sceneRoot, const QString &outDir, QFile::Permissions targetPermissions = gltfFile.permissions(); // Copy exported scene to actual export directory - for (const auto &sourceFileStr : m_exportedFiles) { + for (const auto &sourceFileStr : qAsConst(m_exportedFiles)) { QFileInfo fiSource(m_exportDir + sourceFileStr); QFileInfo fiDestination(finalExportDir + sourceFileStr); if (fiDestination.exists()) { @@ -548,7 +548,7 @@ void GLTFExporter::copyTextures() void GLTFExporter::createShaders() { qCDebug(GLTFExporterLog, "Creating shaders..."); - for (const auto &si : m_shaderInfo) { + for (const auto &si : qAsConst(m_shaderInfo)) { const QString fileName = m_exportDir + si.uri; QFile f(fileName); if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { @@ -571,7 +571,8 @@ void GLTFExporter::parseEntities(const QEntity *entity, Node *parentNode) node->uniqueName = newNodeName(); int irrelevantComponents = 0; - for (auto component : entity->components()) { + const auto components = entity->components(); + for (auto component : components) { if (auto mesh = qobject_cast<QGeometryRenderer *>(component)) m_meshMap.insert(node, mesh); else if (auto material = qobject_cast<QMaterial *>(component)) @@ -812,7 +813,8 @@ void GLTFExporter::parseMeshes() uint stride(0); - for (QAttribute *att : meshGeometry->attributes()) { + const auto attributes = meshGeometry->attributes(); + for (QAttribute *att : attributes) { if (att->attributeType() == QAttribute::IndexAttribute) { indexAttrib = att; indexPtr = reinterpret_cast<const quint16 *>(att->buffer()->data().constData()); @@ -969,11 +971,12 @@ void GLTFExporter::parseMeshes() qCDebug(GLTFExporterLog, " Vertex buffer size (bytes): %i", vertexBuf.size()); qCDebug(GLTFExporterLog, " Index buffer size (bytes): %i", indexBuf.size()); QStringList sl; - for (const auto &bv : meshInfo.views) + const auto views = meshInfo.views; + for (const auto &bv : views) sl << bv.name; qCDebug(GLTFExporterLog) << " buffer views:" << sl; sl.clear(); - for (const auto &acc : meshInfo.accessors) + for (const auto &acc : qAsConst(meshInfo.accessors)) sl << acc.name; qCDebug(GLTFExporterLog) << " accessors:" << sl; qCDebug(GLTFExporterLog, " material: '%ls'", @@ -1091,7 +1094,8 @@ void GLTFExporter::parseTechniques(QMaterial *material) int techniqueCount = 0; qCDebug(GLTFExporterLog, " Parsing material techniques..."); - for (auto technique : material->effect()->techniques()) { + const auto techniques = material->effect()->techniques(); + for (auto technique : techniques) { QString techName; if (m_techniqueIdMap.contains(technique)) { techName = m_techniqueIdMap.value(technique); @@ -1116,7 +1120,8 @@ void GLTFExporter::parseRenderPasses(QTechnique *technique) int passCount = 0; qCDebug(GLTFExporterLog, " Parsing render passes for technique..."); - for (auto pass : technique->renderPasses()) { + const auto renderPasses = technique->renderPasses(); + for (auto pass : renderPasses) { QString name; if (m_renderPassIdMap.contains(pass)) { name = m_renderPassIdMap.value(pass); @@ -1158,7 +1163,7 @@ QString GLTFExporter::addShaderInfo(QShaderProgram::ShaderType type, QByteArray if (code.isEmpty()) return QString(); - for (const auto &si : m_shaderInfo) { + for (const auto &si : qAsConst(m_shaderInfo)) { if (si.type == QShaderProgram::Vertex && code == si.code) return si.name; } @@ -1223,7 +1228,7 @@ bool GLTFExporter::saveScene() m_obj["buffers"] = buffers; QJsonObject bufferViews; - for (const auto &bv : bvList) { + for (const auto &bv : qAsConst(bvList)) { QJsonObject bufferView; bufferView["buffer"] = QStringLiteral("buf"); bufferView["byteLength"] = int(bv.length); @@ -1236,7 +1241,7 @@ bool GLTFExporter::saveScene() m_obj["bufferViews"] = bufferViews; QJsonObject accessors; - for (const auto &acc : accList) { + for (const auto &acc : qAsConst(accList)) { QJsonObject accessor; accessor["bufferView"] = acc.bufferView; accessor["byteOffset"] = int(acc.offset); @@ -1265,7 +1270,8 @@ bool GLTFExporter::saveScene() QJsonObject prim; prim["mode"] = 4; // triangles QJsonObject attrs; - for (const auto &acc : meshInfo.accessors) { + const auto meshAccessors = meshInfo.accessors; + for (const auto &acc : meshAccessors) { if (acc.usage != QStringLiteral("INDEX")) attrs[acc.usage] = acc.name; else @@ -1282,7 +1288,7 @@ bool GLTFExporter::saveScene() m_obj["meshes"] = meshes; QJsonObject cameras; - for (auto camInfo : qAsConst(m_cameraInfo)) { + for (const auto &camInfo : qAsConst(m_cameraInfo)) { QJsonObject camera; QJsonObject proj; proj["znear"] = camInfo.znear; @@ -1394,14 +1400,16 @@ bool GLTFExporter::saveScene() QJsonObject effectObj; QJsonObject paramObj; - for (QParameter *param : effect->parameters()) + const auto effectParameters = effect->parameters(); + for (QParameter *param : effectParameters) exportParameter(paramObj, param->name(), param->value()); if (!effect->objectName().isEmpty()) effectObj["name"] = effect->objectName(); if (!paramObj.isEmpty()) effectObj["parameters"] = paramObj; QJsonArray techs; - for (auto tech : effect->techniques()) + const auto effectTechniques = effect->techniques(); + for (auto tech : effectTechniques) techs << m_techniqueIdMap.value(tech); effectObj["techniques"] = techs; effects[effectName] = effectObj; @@ -1419,13 +1427,16 @@ bool GLTFExporter::saveScene() QJsonObject paramObj; QJsonArray renderPassArr; - for (QFilterKey *filterKey : technique->filterKeys()) + const auto techniqueFilterKeys = technique->filterKeys(); + for (QFilterKey *filterKey : techniqueFilterKeys) setVarToJSonObject(filterKeyObj, filterKey->name(), filterKey->value()); - for (QRenderPass *pass : technique->renderPasses()) + const auto techniqueRenderPasses = technique->renderPasses(); + for (QRenderPass *pass : techniqueRenderPasses) renderPassArr << m_renderPassIdMap.value(pass); - for (QParameter *param : technique->parameters()) + const auto techniqueParameters = technique->parameters(); + for (QParameter *param : techniqueParameters) exportParameter(paramObj, param->name(), param->value()); const QGraphicsApiFilter *gFilter = technique->graphicsApiFilter(); @@ -1517,7 +1528,7 @@ bool GLTFExporter::saveScene() // Save shaders for custom materials QJsonObject shaders; - for (const auto &si : m_shaderInfo) { + for (const auto &si : qAsConst(m_shaderInfo)) { QJsonObject shaderObj; shaderObj["uri"] = si.uri; shaders[si.name] = shaderObj; @@ -1885,7 +1896,8 @@ void GLTFExporter::exportRenderStates(QJsonObject &jsonObj, const QRenderPass *p { QJsonArray enableStates; QJsonObject funcObj; - for (QRenderState *state : pass->renderStates()) { + const auto renderStates = pass->renderStates(); + for (QRenderState *state : renderStates) { QJsonArray arr; if (qobject_cast<QAlphaCoverage *>(state)) { enableStates << GL_SAMPLE_ALPHA_TO_COVERAGE; diff --git a/src/quick3d/imports/scene3d/scene3ditem.cpp b/src/quick3d/imports/scene3d/scene3ditem.cpp index 4371e60b4..2c20fa789 100644 --- a/src/quick3d/imports/scene3d/scene3ditem.cpp +++ b/src/quick3d/imports/scene3d/scene3ditem.cpp @@ -241,11 +241,13 @@ void Scene3DItem::setWindowSurface(QObject *rootObject) } } -void Scene3DItem::setItemArea(QSize area) +void Scene3DItem::setItemAreaAndDevicePixelRatio(QSize area, qreal devicePixelRatio) { Qt3DRender::QRenderSurfaceSelector *surfaceSelector = Qt3DRender::QRenderSurfaceSelectorPrivate::find(m_entity); - if (surfaceSelector) + if (surfaceSelector) { surfaceSelector->setExternalRenderTargetSize(area); + surfaceSelector->setSurfacePixelRatio(devicePixelRatio); + } } bool Scene3DItem::isHoverEnabled() const diff --git a/src/quick3d/imports/scene3d/scene3ditem_p.h b/src/quick3d/imports/scene3d/scene3ditem_p.h index 39e679961..4106ff459 100644 --- a/src/quick3d/imports/scene3d/scene3ditem_p.h +++ b/src/quick3d/imports/scene3d/scene3ditem_p.h @@ -88,7 +88,7 @@ public: bool multisample() const; void setMultisample(bool enable); - Q_INVOKABLE void setItemArea(QSize area); + Q_INVOKABLE void setItemAreaAndDevicePixelRatio(QSize area, qreal devicePixelRatio); bool isHoverEnabled() const; enum CameraAspectRatioMode { diff --git a/src/quick3d/imports/scene3d/scene3drenderer.cpp b/src/quick3d/imports/scene3d/scene3drenderer.cpp index 01977f72b..37ae8e48b 100644 --- a/src/quick3d/imports/scene3d/scene3drenderer.cpp +++ b/src/quick3d/imports/scene3d/scene3drenderer.cpp @@ -59,9 +59,9 @@ namespace Qt3DRender { namespace { -inline QMetaMethod setItemAreaMethod() +inline QMetaMethod setItemAreaAndDevicePixelRatioMethod() { - const int idx = Scene3DItem::staticMetaObject.indexOfMethod("setItemArea(QSize)"); + const int idx = Scene3DItem::staticMetaObject.indexOfMethod("setItemAreaAndDevicePixelRatio(QSize,qreal)"); Q_ASSERT(idx != -1); return Scene3DItem::staticMetaObject.method(idx); } @@ -275,8 +275,9 @@ void Scene3DRenderer::render() if (sizeHasChanged) { // We are in the QSGRenderThread (doing a direct call would result in a race) - static const QMetaMethod setItemArea = setItemAreaMethod(); - setItemArea.invoke(m_item, Qt::QueuedConnection, Q_ARG(QSize, boundingRectSize)); + static const QMetaMethod setItemAreaAndDevicePixelRatio = setItemAreaAndDevicePixelRatioMethod(); + setItemAreaAndDevicePixelRatio.invoke(m_item, Qt::QueuedConnection, Q_ARG(QSize, boundingRectSize), + Q_ARG(qreal, m_window->effectiveDevicePixelRatio())); } // Rebuild FBO and textures if never created or a resize has occurred diff --git a/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp b/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp index b99f6ae75..21f58e56d 100644 --- a/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp +++ b/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp @@ -135,7 +135,8 @@ void Quick3DNodeInstantiatorPrivate::regenerate() } for (int i = 0; i < m_instanceModel->count(); i++) { - QObject *object = m_instanceModel->object(i, m_async); + QObject *object = m_instanceModel->object(i, m_async ? + QQmlIncubator::Asynchronous : QQmlIncubator::AsynchronousIfNested); // If the item was already created we won't get a createdItem if (object) _q_createdItem(i, object); @@ -202,7 +203,8 @@ void Quick3DNodeInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &change m_objects = m_objects.mid(0, index) + movedObjects + m_objects.mid(index); } else for (int i = 0; i < insert.count; ++i) { int modelIndex = index + i; - QObject *obj = m_instanceModel->object(modelIndex, m_async); + QObject *obj = m_instanceModel->object(modelIndex, m_async ? + QQmlIncubator::Asynchronous : QQmlIncubator::AsynchronousIfNested); if (obj) _q_createdItem(modelIndex, obj); } diff --git a/src/render/backend/entity.cpp b/src/render/backend/entity.cpp index 95304007a..914ac2ec3 100644 --- a/src/render/backend/entity.cpp +++ b/src/render/backend/entity.cpp @@ -279,7 +279,7 @@ QVector<Entity *> Entity::children() const { QVector<Entity *> childrenVector; childrenVector.reserve(m_childrenHandles.size()); - for (HEntity handle : m_childrenHandles) { + for (const HEntity &handle : m_childrenHandles) { Entity *child = m_nodeManagers->renderNodesManager()->data(handle); if (child != nullptr) childrenVector.append(child); diff --git a/src/render/backend/entity_p.h b/src/render/backend/entity_p.h index 4ba46d40a..a4600f219 100644 --- a/src/render/backend/entity_p.h +++ b/src/render/backend/entity_p.h @@ -124,16 +124,16 @@ public: void removeRecursiveLayerId(const Qt3DCore::QNodeId layerId); void clearRecursiveLayerIds() { m_recursiveLayerComponents.clear(); } - template<class Backend, uint INDEXBITS> - Qt3DCore::QHandle<Backend, INDEXBITS> componentHandle() const + template<class Backend> + Qt3DCore::QHandle<Backend> componentHandle() const { - return Qt3DCore::QHandle<Backend, INDEXBITS>(); + return Qt3DCore::QHandle<Backend>(); } - template<class Backend, uint INDEXBITS> - QVector<Qt3DCore::QHandle<Backend, INDEXBITS> > componentsHandle() const + template<class Backend> + QVector<Qt3DCore::QHandle<Backend> > componentsHandle() const { - return QVector<Qt3DCore::QHandle<Backend, INDEXBITS> >(); + return QVector<Qt3DCore::QHandle<Backend> >(); } template<class Backend> diff --git a/src/render/backend/handle_types_p.h b/src/render/backend/handle_types_p.h index bb5836ab4..4062aadeb 100644 --- a/src/render/backend/handle_types_p.h +++ b/src/render/backend/handle_types_p.h @@ -99,42 +99,42 @@ class Armature; class Skeleton; class Joint; -typedef Qt3DCore::QHandle<RenderTargetOutput, 16> HAttachment; -typedef Qt3DCore::QHandle<CameraLens, 8> HCamera; -typedef Qt3DCore::QHandle<FilterKey, 16> HFilterKey; -typedef Qt3DCore::QHandle<Effect, 16> HEffect; -typedef Qt3DCore::QHandle<Entity, 16> HEntity; -typedef Qt3DCore::QHandle<FrameGraphNode *, 8> HFrameGraphNode; -typedef Qt3DCore::QHandle<Layer, 16> HLayer; -typedef Qt3DCore::QHandle<LevelOfDetail, 16> HLevelOfDetail; -typedef Qt3DCore::QHandle<Material, 16> HMaterial; -typedef Qt3DCore::QHandle<QMatrix4x4, 16> HMatrix; -typedef Qt3DCore::QHandle<OpenGLVertexArrayObject, 16> HVao; -typedef Qt3DCore::QHandle<Shader, 16> HShader; -typedef Qt3DCore::QHandle<ShaderBuilder, 16> HShaderBuilder; -typedef Qt3DCore::QHandle<Technique, 16> HTechnique; -typedef Qt3DCore::QHandle<Texture, 16> HTexture; -typedef Qt3DCore::QHandle<Transform, 16> HTransform; -typedef Qt3DCore::QHandle<RenderTarget, 8> HTarget; -typedef Qt3DCore::QHandle<RenderPass, 16> HRenderPass; -typedef Qt3DCore::QHandle<QTextureImageData, 16> HTextureData; -typedef Qt3DCore::QHandle<Parameter, 16> HParameter; -typedef Qt3DCore::QHandle<ShaderData, 16> HShaderData; -typedef Qt3DCore::QHandle<TextureImage, 16> HTextureImage; -typedef Qt3DCore::QHandle<Buffer, 16> HBuffer; -typedef Qt3DCore::QHandle<Attribute, 20> HAttribute; -typedef Qt3DCore::QHandle<Geometry, 16> HGeometry; -typedef Qt3DCore::QHandle<GeometryRenderer, 16> HGeometryRenderer; -typedef Qt3DCore::QHandle<ObjectPicker, 16> HObjectPicker; -typedef Qt3DCore::QHandle<BoundingVolumeDebug, 16> HBoundingVolumeDebug; -typedef Qt3DCore::QHandle<Light, 16> HLight; -typedef Qt3DCore::QHandle<EnvironmentLight, 16> HEnvironmentLight; -typedef Qt3DCore::QHandle<ComputeCommand, 16> HComputeCommand; -typedef Qt3DCore::QHandle<GLBuffer, 16> HGLBuffer; -typedef Qt3DCore::QHandle<RenderStateNode, 16> HRenderState; -typedef Qt3DCore::QHandle<Armature, 16> HArmature; -typedef Qt3DCore::QHandle<Skeleton, 16> HSkeleton; -typedef Qt3DCore::QHandle<Joint, 16> HJoint; +typedef Qt3DCore::QHandle<RenderTargetOutput> HAttachment; +typedef Qt3DCore::QHandle<CameraLens> HCamera; +typedef Qt3DCore::QHandle<FilterKey> HFilterKey; +typedef Qt3DCore::QHandle<Effect> HEffect; +typedef Qt3DCore::QHandle<Entity> HEntity; +typedef Qt3DCore::QHandle<FrameGraphNode *> HFrameGraphNode; +typedef Qt3DCore::QHandle<Layer> HLayer; +typedef Qt3DCore::QHandle<LevelOfDetail> HLevelOfDetail; +typedef Qt3DCore::QHandle<Material> HMaterial; +typedef Qt3DCore::QHandle<QMatrix4x4> HMatrix; +typedef Qt3DCore::QHandle<OpenGLVertexArrayObject> HVao; +typedef Qt3DCore::QHandle<Shader> HShader; +typedef Qt3DCore::QHandle<ShaderBuilder> HShaderBuilder; +typedef Qt3DCore::QHandle<Technique> HTechnique; +typedef Qt3DCore::QHandle<Texture> HTexture; +typedef Qt3DCore::QHandle<Transform> HTransform; +typedef Qt3DCore::QHandle<RenderTarget> HTarget; +typedef Qt3DCore::QHandle<RenderPass> HRenderPass; +typedef Qt3DCore::QHandle<QTextureImageData> HTextureData; +typedef Qt3DCore::QHandle<Parameter> HParameter; +typedef Qt3DCore::QHandle<ShaderData> HShaderData; +typedef Qt3DCore::QHandle<TextureImage> HTextureImage; +typedef Qt3DCore::QHandle<Buffer> HBuffer; +typedef Qt3DCore::QHandle<Attribute> HAttribute; +typedef Qt3DCore::QHandle<Geometry> HGeometry; +typedef Qt3DCore::QHandle<GeometryRenderer> HGeometryRenderer; +typedef Qt3DCore::QHandle<ObjectPicker> HObjectPicker; +typedef Qt3DCore::QHandle<BoundingVolumeDebug> HBoundingVolumeDebug; +typedef Qt3DCore::QHandle<Light> HLight; +typedef Qt3DCore::QHandle<EnvironmentLight> HEnvironmentLight; +typedef Qt3DCore::QHandle<ComputeCommand> HComputeCommand; +typedef Qt3DCore::QHandle<GLBuffer> HGLBuffer; +typedef Qt3DCore::QHandle<RenderStateNode> HRenderState; +typedef Qt3DCore::QHandle<Armature> HArmature; +typedef Qt3DCore::QHandle<Skeleton> HSkeleton; +typedef Qt3DCore::QHandle<Joint> HJoint; } // namespace Render diff --git a/src/render/backend/layer_p.h b/src/render/backend/layer_p.h index d01d190e9..1513157f9 100644 --- a/src/render/backend/layer_p.h +++ b/src/render/backend/layer_p.h @@ -80,7 +80,7 @@ protected: void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) override; private: - void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change); + void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) override; bool m_recursive; }; diff --git a/src/render/backend/managers_p.h b/src/render/backend/managers_p.h index f19b9261a..b811057cb 100644 --- a/src/render/backend/managers_p.h +++ b/src/render/backend/managers_p.h @@ -93,7 +93,6 @@ namespace Render { class AttachmentManager : public Qt3DCore::QResourceManager< RenderTargetOutput, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -103,7 +102,6 @@ public: class CameraManager : public Qt3DCore::QResourceManager< CameraLens, Qt3DCore::QNodeId, - 8, Qt3DCore::NonLockingPolicy> { public: @@ -113,7 +111,6 @@ public: class FilterKeyManager : public Qt3DCore::QResourceManager< FilterKey, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { @@ -124,7 +121,6 @@ public: class EffectManager : public Qt3DCore::QResourceManager< Effect, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -134,7 +130,6 @@ public: class Q_AUTOTEST_EXPORT EntityManager : public Qt3DCore::QResourceManager< Entity, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -168,7 +163,6 @@ private: class LayerManager : public Qt3DCore::QResourceManager< Layer, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -178,7 +172,6 @@ public: class LevelOfDetailManager : public Qt3DCore::QResourceManager< LevelOfDetail, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -188,7 +181,6 @@ public: class MaterialManager : public Qt3DCore::QResourceManager< Material, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -198,7 +190,6 @@ public: class MatrixManager : public Qt3DCore::QResourceManager< QMatrix4x4, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -208,7 +199,6 @@ public: class ShaderManager : public Qt3DCore::QResourceManager< Shader, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -218,7 +208,6 @@ public: class ShaderBuilderManager : public Qt3DCore::QResourceManager< ShaderBuilder, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -228,7 +217,6 @@ public: class TextureManager : public Qt3DCore::QResourceManager< Texture, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -253,7 +241,6 @@ private: class TransformManager : public Qt3DCore::QResourceManager< Transform, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -263,7 +250,6 @@ public: class VAOManager : public Qt3DCore::QResourceManager< OpenGLVertexArrayObject, VAOIdentifier, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -273,7 +259,6 @@ public: class RenderTargetManager : public Qt3DCore::QResourceManager< RenderTarget, Qt3DCore::QNodeId, - 8, Qt3DCore::NonLockingPolicy> { public: @@ -283,7 +268,6 @@ public: class RenderPassManager : public Qt3DCore::QResourceManager< RenderPass, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -294,7 +278,6 @@ public: class ParameterManager : public Qt3DCore::QResourceManager< Parameter, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -304,7 +287,6 @@ public: class ShaderDataManager : public Qt3DCore::QResourceManager< ShaderData, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -314,7 +296,6 @@ public: class GLBufferManager : public Qt3DCore::QResourceManager< GLBuffer, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { }; @@ -322,7 +303,6 @@ class GLBufferManager : public Qt3DCore::QResourceManager< class TextureImageManager : public Qt3DCore::QResourceManager< TextureImage, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { }; @@ -330,7 +310,6 @@ class TextureImageManager : public Qt3DCore::QResourceManager< class AttributeManager : public Qt3DCore::QResourceManager< Attribute, Qt3DCore::QNodeId, - 20, Qt3DCore::NonLockingPolicy> { }; @@ -338,7 +317,6 @@ class AttributeManager : public Qt3DCore::QResourceManager< class GeometryManager : public Qt3DCore::QResourceManager< Geometry, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { }; @@ -346,7 +324,6 @@ class GeometryManager : public Qt3DCore::QResourceManager< class ObjectPickerManager : public Qt3DCore::QResourceManager< ObjectPicker, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { }; @@ -355,7 +332,6 @@ class ObjectPickerManager : public Qt3DCore::QResourceManager< class BoundingVolumeDebugManager : public Qt3DCore::QResourceManager< BoundingVolumeDebug, Qt3DCore::QNodeId, - 16, Qt3DCore::ObjectLevelLockingPolicy> { }; @@ -364,7 +340,6 @@ class BoundingVolumeDebugManager : public Qt3DCore::QResourceManager< class LightManager : public Qt3DCore::QResourceManager< Light, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -374,7 +349,6 @@ public: class EnvironmentLightManager : public Qt3DCore::QResourceManager< EnvironmentLight, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -384,7 +358,6 @@ public: class ComputeCommandManager : public Qt3DCore::QResourceManager< ComputeCommand, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -394,7 +367,6 @@ public: class RenderStateManager : public Qt3DCore::QResourceManager< RenderStateNode, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { }; @@ -402,7 +374,6 @@ class RenderStateManager : public Qt3DCore::QResourceManager< class ArmatureManager : public Qt3DCore::QResourceManager< Armature, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { }; @@ -410,7 +381,6 @@ class ArmatureManager : public Qt3DCore::QResourceManager< class SkeletonManager : public Qt3DCore::QResourceManager< Skeleton, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: @@ -430,7 +400,6 @@ private: class JointManager : public Qt3DCore::QResourceManager< Joint, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp index 4bf22cf0e..0507cc0b0 100644 --- a/src/render/backend/renderer.cpp +++ b/src/render/backend/renderer.cpp @@ -948,7 +948,7 @@ void Renderer::prepareCommandsSubmission(const QVector<RenderView *> &renderView void Renderer::lookForAbandonedVaos() { const QVector<HVao> activeVaos = m_nodesManager->vaoManager()->activeHandles(); - for (HVao handle : activeVaos) { + for (const HVao &handle : activeVaos) { OpenGLVertexArrayObject *vao = m_nodesManager->vaoManager()->data(handle); // Make sure to only mark VAOs for deletion that were already created @@ -965,7 +965,7 @@ void Renderer::lookForAbandonedVaos() void Renderer::lookForDirtyBuffers() { const QVector<HBuffer> activeBufferHandles = m_nodesManager->bufferManager()->activeHandles(); - for (HBuffer handle: activeBufferHandles) { + for (const HBuffer &handle: activeBufferHandles) { Buffer *buffer = m_nodesManager->bufferManager()->data(handle); if (buffer->isDirty()) m_dirtyBuffers.push_back(handle); @@ -976,7 +976,7 @@ void Renderer::lookForDownloadableBuffers() { m_downloadableBuffers.clear(); const QVector<HBuffer> activeBufferHandles = m_nodesManager->bufferManager()->activeHandles(); - for (HBuffer handle : activeBufferHandles) { + for (const HBuffer &handle : activeBufferHandles) { Buffer *buffer = m_nodesManager->bufferManager()->data(handle); if (buffer->access() & QBuffer::Read) m_downloadableBuffers.push_back(handle); @@ -987,7 +987,7 @@ void Renderer::lookForDownloadableBuffers() void Renderer::lookForDirtyTextures() { const QVector<HTexture> activeTextureHandles = m_nodesManager->textureManager()->activeHandles(); - for (HTexture handle: activeTextureHandles) { + for (const HTexture &handle: activeTextureHandles) { Texture *texture = m_nodesManager->textureManager()->data(handle); // Dirty meaning that something has changed on the texture // either properties, parameters, generator or a texture image @@ -1002,7 +1002,7 @@ void Renderer::lookForDirtyShaders() if (isRunning()) { const QVector<HTechnique> activeTechniques = m_nodesManager->techniqueManager()->activeHandles(); const QVector<HShaderBuilder> activeBuilders = m_nodesManager->shaderBuilderManager()->activeHandles(); - for (HTechnique techniqueHandle : activeTechniques) { + for (const HTechnique &techniqueHandle : activeTechniques) { Technique *technique = m_nodesManager->techniqueManager()->data(techniqueHandle); // If api of the renderer matches the one from the technique if (technique->isCompatibleWithRenderer()) { @@ -1013,7 +1013,7 @@ void Renderer::lookForDirtyShaders() Shader *shader = m_nodesManager->shaderManager()->data(shaderHandle); ShaderBuilder *shaderBuilder = nullptr; - for (HShaderBuilder builderHandle : activeBuilders) { + for (const HShaderBuilder &builderHandle : activeBuilders) { ShaderBuilder *builder = m_nodesManager->shaderBuilderManager()->data(builderHandle); if (builder->shaderProgramId() == shader->peerId()) { shaderBuilder = builder; @@ -1076,7 +1076,7 @@ void Renderer::updateGLResources() { Profiling::GLTimeRecorder recorder(Profiling::BufferUpload); const QVector<HBuffer> dirtyBufferHandles = std::move(m_dirtyBuffers); - for (HBuffer handle: dirtyBufferHandles) { + for (const HBuffer &handle: dirtyBufferHandles) { Buffer *buffer = m_nodesManager->bufferManager()->data(handle); // Forces creation if it doesn't exit // Also note the binding point doesn't really matter here, we just upload data @@ -1092,7 +1092,7 @@ void Renderer::updateGLResources() Profiling::GLTimeRecorder recorder(Profiling::ShaderUpload); const QVector<HShader> dirtyShaderHandles = std::move(m_dirtyShaders); ShaderManager *shaderManager = m_nodesManager->shaderManager(); - for (HShader handle: dirtyShaderHandles) { + for (const HShader &handle: dirtyShaderHandles) { Shader *shader = shaderManager->data(handle); // Compile shader m_graphicsContext->loadShader(shader, shaderManager); @@ -1102,7 +1102,7 @@ void Renderer::updateGLResources() { Profiling::GLTimeRecorder recorder(Profiling::TextureUpload); const QVector<HTexture> activeTextureHandles = std::move(m_dirtyTextures); - for (HTexture handle: activeTextureHandles) { + for (const HTexture &handle: activeTextureHandles) { Texture *texture = m_nodesManager->textureManager()->data(handle); // Upload/Update texture updateTexture(texture); @@ -1136,7 +1136,7 @@ void Renderer::updateTexture(Texture *texture) // TO DO: Update the vector once per frame (or in a job) const QVector<HAttachment> activeRenderTargetOutputs = m_nodesManager->attachmentManager()->activeHandles(); // A texture is unique if it's being reference by a render target output - for (const HAttachment attachmentHandle : activeRenderTargetOutputs) { + for (const HAttachment &attachmentHandle : activeRenderTargetOutputs) { RenderTargetOutput *attachment = m_nodesManager->attachmentManager()->data(attachmentHandle); if (attachment->textureUuid() == texture->peerId()) { isUnique = true; @@ -1222,7 +1222,7 @@ void Renderer::downloadGLBuffers() { lookForDownloadableBuffers(); const QVector<HBuffer> downloadableHandles = std::move(m_downloadableBuffers); - for (HBuffer handle : downloadableHandles) { + for (const HBuffer &handle : downloadableHandles) { Buffer *buffer = m_nodesManager->bufferManager()->data(handle); QByteArray content = m_graphicsContext->downloadBufferContent(buffer); m_sendBufferCaptureJob->addRequest(QPair<Buffer*, QByteArray>(buffer, content)); @@ -1939,7 +1939,7 @@ void Renderer::cleanGraphicsResources() m_abandonedVaosMutex.lock(); const QVector<HVao> abandonedVaos = std::move(m_abandonedVaos); m_abandonedVaosMutex.unlock(); - for (HVao vaoHandle : abandonedVaos) { + for (const HVao &vaoHandle : abandonedVaos) { // might have already been destroyed last frame, but added by the cleanup job before, so // check if the VAO is really still existent OpenGLVertexArrayObject *vao = m_nodesManager->vaoManager()->data(vaoHandle); diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp index 549d6e054..4f13d630d 100644 --- a/src/render/backend/renderview.cpp +++ b/src/render/backend/renderview.cpp @@ -340,6 +340,8 @@ struct SubRangeSorter { static void sortSubRange(CommandIt begin, const CommandIt end) { + Q_UNUSED(begin); + Q_UNUSED(end); Q_UNREACHABLE(); } }; @@ -580,14 +582,15 @@ QVector<RenderCommand *> RenderView::buildDrawRenderCommands(const QVector<Entit for (Entity *entity : entities) { GeometryRenderer *geometryRenderer = nullptr; - HGeometryRenderer geometryRendererHandle = entity->componentHandle<GeometryRenderer, 16>(); + HGeometryRenderer geometryRendererHandle = entity->componentHandle<GeometryRenderer>(); + // There is a geometry renderer with geometry if ((geometryRenderer = m_manager->geometryRendererManager()->data(geometryRendererHandle)) != nullptr && geometryRenderer->isEnabled() && !geometryRenderer->geometryId().isNull()) { const Qt3DCore::QNodeId materialComponentId = entity->componentUuid<Material>(); - const HMaterial materialHandle = entity->componentHandle<Material, 16>(); + const HMaterial materialHandle = entity->componentHandle<Material>(); const QVector<RenderPassParameterData> renderPassData = m_parameters.value(materialComponentId); HGeometry geometryHandle = m_manager->lookupHandle<Geometry, GeometryManager, HGeometry>(geometryRenderer->geometryId()); Geometry *geometry = m_manager->data<Geometry, GeometryManager>(geometryHandle); diff --git a/src/render/framegraph/blitframebuffer.cpp b/src/render/framegraph/blitframebuffer.cpp index 70401e6d1..b9ff4bea3 100644 --- a/src/render/framegraph/blitframebuffer.cpp +++ b/src/render/framegraph/blitframebuffer.cpp @@ -69,9 +69,9 @@ void BlitFramebuffer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) } else if (propertyChange->propertyName() == QByteArrayLiteral("destinationRenderTarget")) { m_destinationRenderTargetId = propertyChange->value().value<QNodeId>(); } else if (propertyChange->propertyName() == QByteArrayLiteral("sourceRect")) { - m_sourceRect = propertyChange->value().value<QRect>(); + m_sourceRect = propertyChange->value().toRect(); } else if (propertyChange->propertyName() == QByteArrayLiteral("destinationRect")) { - m_destinationRect = propertyChange->value().value<QRect>(); + m_destinationRect = propertyChange->value().toRect(); } else if (propertyChange->propertyName() == QByteArrayLiteral("sourceAttachmentPoint")) { m_sourceAttachmentPoint = propertyChange->value().value<Qt3DRender::QRenderTargetOutput::AttachmentPoint>(); } else if (propertyChange->propertyName() == QByteArrayLiteral("destinationAttachmentPoint")) { diff --git a/src/render/framegraph/qblitframebuffer.h b/src/render/framegraph/qblitframebuffer.h index 809fb98a3..77b74ab53 100644 --- a/src/render/framegraph/qblitframebuffer.h +++ b/src/render/framegraph/qblitframebuffer.h @@ -42,7 +42,7 @@ #include <Qt3DRender/qframegraphnode.h> #include <Qt3DRender/qrendertargetoutput.h> -#include <QRect> +#include <QtCore/QRect> QT_BEGIN_NAMESPACE diff --git a/src/render/framegraph/qbuffercapture.h b/src/render/framegraph/qbuffercapture.h index d77266828..ab8c7d2c2 100644 --- a/src/render/framegraph/qbuffercapture.h +++ b/src/render/framegraph/qbuffercapture.h @@ -42,7 +42,7 @@ #include <Qt3DRender/QFrameGraphNode> #include <Qt3DRender/QBuffer> -#include <QByteArray> +#include <QtCore/QByteArray> QT_BEGIN_NAMESPACE diff --git a/src/render/framegraph/qclearbuffers.h b/src/render/framegraph/qclearbuffers.h index b03543e47..7077b3f24 100644 --- a/src/render/framegraph/qclearbuffers.h +++ b/src/render/framegraph/qclearbuffers.h @@ -42,8 +42,8 @@ #include <Qt3DRender/qframegraphnode.h> #include <Qt3DRender/qrendertargetoutput.h> -#include <QColor> -#include <QFlags> +#include <QtGui/QColor> +#include <QtCore/QFlags> QT_BEGIN_NAMESPACE diff --git a/src/render/framegraph/qframegraphnode.h b/src/render/framegraph/qframegraphnode.h index e78625d0d..1a15c4df6 100644 --- a/src/render/framegraph/qframegraphnode.h +++ b/src/render/framegraph/qframegraphnode.h @@ -42,7 +42,7 @@ #include <Qt3DCore/qnode.h> #include <Qt3DRender/qt3drender_global.h> -#include <QObject> +#include <QtCore/QObject> QT_BEGIN_NAMESPACE diff --git a/src/render/framegraph/qlayerfilter.h b/src/render/framegraph/qlayerfilter.h index 29a35b08e..3ccbdac54 100644 --- a/src/render/framegraph/qlayerfilter.h +++ b/src/render/framegraph/qlayerfilter.h @@ -41,7 +41,7 @@ #define QT3DRENDER_QLAYERFILTER_H #include <Qt3DRender/qframegraphnode.h> -#include <QStringList> +#include <QtCore/QStringList> QT_BEGIN_NAMESPACE diff --git a/src/render/framegraph/qrendercapture.cpp b/src/render/framegraph/qrendercapture.cpp index 28bc41b91..7d40c33dc 100644 --- a/src/render/framegraph/qrendercapture.cpp +++ b/src/render/framegraph/qrendercapture.cpp @@ -253,7 +253,7 @@ QRenderCapturePrivate::QRenderCapturePrivate() QRenderCapturePrivate::~QRenderCapturePrivate() { Q_Q(QRenderCapture); - for (QRenderCaptureReply *reply : m_waitingReplies) + for (QRenderCaptureReply *reply : qAsConst(m_waitingReplies)) reply->disconnect(q); } diff --git a/src/render/framegraph/qrendercapture.h b/src/render/framegraph/qrendercapture.h index 80eeabe64..119d6a6f3 100644 --- a/src/render/framegraph/qrendercapture.h +++ b/src/render/framegraph/qrendercapture.h @@ -38,7 +38,7 @@ #define QRENDERCAPTURE_H #include <Qt3DRender/QFrameGraphNode> -#include <QImage> +#include <QtGui/QImage> QT_BEGIN_NAMESPACE diff --git a/src/render/framegraph/qrenderpassfilter.h b/src/render/framegraph/qrenderpassfilter.h index 9296517e8..ffb305e14 100644 --- a/src/render/framegraph/qrenderpassfilter.h +++ b/src/render/framegraph/qrenderpassfilter.h @@ -42,7 +42,7 @@ #include <Qt3DRender/qt3drender_global.h> #include <Qt3DRender/qframegraphnode.h> -#include <QString> +#include <QtCore/QString> QT_BEGIN_NAMESPACE diff --git a/src/render/framegraph/qviewport.h b/src/render/framegraph/qviewport.h index 47b4f3094..1f6ac8310 100644 --- a/src/render/framegraph/qviewport.h +++ b/src/render/framegraph/qviewport.h @@ -41,8 +41,8 @@ #define QT3DRENDER_QVIEWPORT_H #include <Qt3DRender/qframegraphnode.h> -#include <QRectF> -#include <QColor> +#include <QtCore/QRectF> +#include <QtGui/QColor> QT_BEGIN_NAMESPACE diff --git a/src/render/framegraph/renderpassfilternode_p.h b/src/render/framegraph/renderpassfilternode_p.h index 53cbf9570..398d42049 100644 --- a/src/render/framegraph/renderpassfilternode_p.h +++ b/src/render/framegraph/renderpassfilternode_p.h @@ -62,7 +62,7 @@ namespace Qt3DRender { class QFilterKey; class QRenderPassFilter; -template <typename T, uint INDEXBITS> +template <typename T> class QHandle; namespace Render { diff --git a/src/render/framegraph/techniquefilternode_p.h b/src/render/framegraph/techniquefilternode_p.h index ba5be5852..d7e6c1508 100644 --- a/src/render/framegraph/techniquefilternode_p.h +++ b/src/render/framegraph/techniquefilternode_p.h @@ -65,7 +65,7 @@ namespace Qt3DRender { class QFilterKey; class QTechniqueFilter; -template <typename T, uint INDEXBITS> +template <typename T> class QHandle; namespace Render { diff --git a/src/render/frontend/qcamera.h b/src/render/frontend/qcamera.h index 5c86ea122..e31615741 100644 --- a/src/render/frontend/qcamera.h +++ b/src/render/frontend/qcamera.h @@ -43,9 +43,9 @@ #include <Qt3DCore/qentity.h> #include <Qt3DRender/qt3drender_global.h> #include <Qt3DRender/qcameralens.h> -#include <QMatrix4x4> -#include <QQuaternion> -#include <QVector3D> +#include <QtGui/QMatrix4x4> +#include <QtGui/QQuaternion> +#include <QtGui/QVector3D> QT_BEGIN_NAMESPACE diff --git a/src/render/frontend/qcameralens.h b/src/render/frontend/qcameralens.h index 586e2022f..d478561ee 100644 --- a/src/render/frontend/qcameralens.h +++ b/src/render/frontend/qcameralens.h @@ -43,9 +43,9 @@ #include <Qt3DCore/qcomponent.h> #include <Qt3DRender/qt3drender_global.h> -#include <QMatrix4x4> -#include <QQuaternion> -#include <QVector3D> +#include <QtGui/QMatrix4x4> +#include <QtGui/QQuaternion> +#include <QtGui/QVector3D> QT_BEGIN_NAMESPACE diff --git a/src/render/frontend/qlayer.h b/src/render/frontend/qlayer.h index c57a6fe03..27910f190 100644 --- a/src/render/frontend/qlayer.h +++ b/src/render/frontend/qlayer.h @@ -42,7 +42,7 @@ #include <Qt3DCore/qcomponent.h> #include <Qt3DRender/qt3drender_global.h> -#include <QStringList> +#include <QtCore/QStringList> QT_BEGIN_NAMESPACE diff --git a/src/render/frontend/qlevelofdetail.h b/src/render/frontend/qlevelofdetail.h index 24d5942ab..fb74659dd 100644 --- a/src/render/frontend/qlevelofdetail.h +++ b/src/render/frontend/qlevelofdetail.h @@ -44,7 +44,7 @@ #include <Qt3DRender/qt3drender_global.h> #include <Qt3DRender/qlevelofdetailboundingsphere.h> -#include <QVector3D> +#include <QtGui/QVector3D> QT_BEGIN_NAMESPACE diff --git a/src/render/frontend/qlevelofdetailboundingsphere.h b/src/render/frontend/qlevelofdetailboundingsphere.h index b35df95e8..43ba422a8 100644 --- a/src/render/frontend/qlevelofdetailboundingsphere.h +++ b/src/render/frontend/qlevelofdetailboundingsphere.h @@ -43,7 +43,7 @@ #include <Qt3DCore/qcomponent.h> #include <Qt3DRender/qt3drender_global.h> -#include <QVector3D> +#include <QtGui/QVector3D> QT_BEGIN_NAMESPACE diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp index 10ce15108..ba9fd4451 100644 --- a/src/render/frontend/qrenderaspect.cpp +++ b/src/render/frontend/qrenderaspect.cpp @@ -469,7 +469,7 @@ QVector<Qt3DCore::QAspectJobPtr> QRenderAspect::jobsToExecute(qint64 time) // another synchronizing job for skeleton loading const QVector<Render::HSkeleton> skeletonsToLoad = manager->skeletonManager()->dirtySkeletons(Render::SkeletonManager::SkeletonDataDirty); - for (const auto skeletonHandle : skeletonsToLoad) { + for (const auto &skeletonHandle : skeletonsToLoad) { auto loadSkeletonJob = Render::LoadSkeletonJobPtr::create(skeletonHandle); loadSkeletonJob->setNodeManagers(manager); textureLoadingSync->addDependency(loadSkeletonJob); diff --git a/src/render/geometry/buffermanager_p.h b/src/render/geometry/buffermanager_p.h index 4805955bd..df97a5193 100644 --- a/src/render/geometry/buffermanager_p.h +++ b/src/render/geometry/buffermanager_p.h @@ -63,7 +63,6 @@ namespace Render { class Q_AUTOTEST_EXPORT BufferManager : public Qt3DCore::QResourceManager< Buffer, Qt3DCore::QNodeId, - 16, Qt3DCore::ObjectLevelLockingPolicy> { public: diff --git a/src/render/geometry/geometryrenderermanager_p.h b/src/render/geometry/geometryrenderermanager_p.h index e3b313569..becf1bcc1 100644 --- a/src/render/geometry/geometryrenderermanager_p.h +++ b/src/render/geometry/geometryrenderermanager_p.h @@ -63,7 +63,6 @@ namespace Render { class Q_AUTOTEST_EXPORT GeometryRendererManager : public Qt3DCore::QResourceManager< GeometryRenderer, Qt3DCore::QNodeId, - 16, Qt3DCore::ObjectLevelLockingPolicy> { public: diff --git a/src/render/geometry/gltfskeletonloader.cpp b/src/render/geometry/gltfskeletonloader.cpp index 76601836a..b4e33babb 100644 --- a/src/render/geometry/gltfskeletonloader.cpp +++ b/src/render/geometry/gltfskeletonloader.cpp @@ -59,7 +59,7 @@ void jsonArrayToSqt(const QJsonArray &jsonArray, Qt3DCore::Sqt &sqt) QMatrix4x4 m; float *data = m.data(); int i = 0; - for (const auto element : jsonArray) + for (const auto &element : jsonArray) *(data + i++) = static_cast<float>(element.toDouble()); decomposeQMatrix4x4(m, sqt); diff --git a/src/render/geometry/qbuffer.h b/src/render/geometry/qbuffer.h index 09fe54e10..f04c98a11 100644 --- a/src/render/geometry/qbuffer.h +++ b/src/render/geometry/qbuffer.h @@ -42,7 +42,7 @@ #include <Qt3DCore/qnode.h> #include <Qt3DRender/qt3drender_global.h> -#include <QSharedPointer> +#include <QtCore/QSharedPointer> QT_BEGIN_NAMESPACE diff --git a/src/render/geometry/qbufferdatagenerator.h b/src/render/geometry/qbufferdatagenerator.h index 702f396d4..004eb26eb 100644 --- a/src/render/geometry/qbufferdatagenerator.h +++ b/src/render/geometry/qbufferdatagenerator.h @@ -42,7 +42,7 @@ #include <Qt3DRender/qt3drender_global.h> #include <Qt3DRender/qabstractfunctor.h> -#include <QSharedPointer> +#include <QtCore/QSharedPointer> QT_BEGIN_NAMESPACE diff --git a/src/render/geometry/qgeometryfactory.h b/src/render/geometry/qgeometryfactory.h index d5d88a45d..2e4d5c821 100644 --- a/src/render/geometry/qgeometryfactory.h +++ b/src/render/geometry/qgeometryfactory.h @@ -42,7 +42,7 @@ #include <Qt3DRender/qt3drender_global.h> #include <Qt3DRender/qabstractfunctor.h> -#include <QSharedPointer> +#include <QtCore/QSharedPointer> QT_BEGIN_NAMESPACE diff --git a/src/render/geometry/qmesh.cpp b/src/render/geometry/qmesh.cpp index 9a1f10bc5..834284547 100644 --- a/src/render/geometry/qmesh.cpp +++ b/src/render/geometry/qmesh.cpp @@ -286,7 +286,7 @@ QGeometry *MeshLoaderFunctor::operator()() } QScopedPointer<QGeometryLoaderInterface> loader; - for (QString e: qAsConst(ext)) { + for (const QString &e: qAsConst(ext)) { loader.reset(qLoadPlugin<QGeometryLoaderInterface, QGeometryLoaderFactory>(geometryLoader(), e)); if (loader) break; diff --git a/src/render/geometry/qmesh.h b/src/render/geometry/qmesh.h index fab76a249..51fdab63a 100644 --- a/src/render/geometry/qmesh.h +++ b/src/render/geometry/qmesh.h @@ -42,7 +42,7 @@ #include <Qt3DRender/qt3drender_global.h> #include <Qt3DRender/qgeometryrenderer.h> -#include <QUrl> +#include <QtCore/QUrl> QT_BEGIN_NAMESPACE diff --git a/src/render/geometry/skeleton.cpp b/src/render/geometry/skeleton.cpp index 075936f37..615b76c88 100644 --- a/src/render/geometry/skeleton.cpp +++ b/src/render/geometry/skeleton.cpp @@ -365,7 +365,8 @@ void Skeleton::processJointHierarchy(Qt3DCore::QNodeId jointId, skeletonData.jointIndices.insert(jointHandle, jointIndex); // Recurse to the children - for (const auto childJointId : joint->childJointIds()) + const auto childIds = joint->childJointIds(); + for (const auto childJointId : childIds) processJointHierarchy(childJointId, jointIndex, skeletonData); } diff --git a/src/render/io/qsceneloader.h b/src/render/io/qsceneloader.h index dbfed1a41..c69a4ad98 100644 --- a/src/render/io/qsceneloader.h +++ b/src/render/io/qsceneloader.h @@ -43,7 +43,7 @@ #include <Qt3DCore/qcomponent.h> #include <Qt3DCore/qscenechange.h> #include <Qt3DRender/qt3drender_global.h> -#include <QUrl> +#include <QtCore/QUrl> QT_BEGIN_NAMESPACE diff --git a/src/render/io/scenemanager.cpp b/src/render/io/scenemanager.cpp index 784751857..cdf8aae87 100644 --- a/src/render/io/scenemanager.cpp +++ b/src/render/io/scenemanager.cpp @@ -44,10 +44,10 @@ QT_BEGIN_NAMESPACE namespace Qt3DRender { namespace Render { -SceneManager::SceneManager() : Qt3DCore::QResourceManager<Scene, - Qt3DCore::QNodeId, - 8, - Qt3DCore::ObjectLevelLockingPolicy>() +SceneManager::SceneManager() + : Qt3DCore::QResourceManager<Scene, + Qt3DCore::QNodeId, + Qt3DCore::ObjectLevelLockingPolicy>() , m_service(nullptr) { } diff --git a/src/render/io/scenemanager_p.h b/src/render/io/scenemanager_p.h index fa2350226..624b32499 100644 --- a/src/render/io/scenemanager_p.h +++ b/src/render/io/scenemanager_p.h @@ -85,7 +85,6 @@ typedef QSharedPointer<SceneDownloader> SceneDownloaderPtr; class Q_AUTOTEST_EXPORT SceneManager : public Qt3DCore::QResourceManager< Scene, Qt3DCore::QNodeId, - 8, Qt3DCore::ObjectLevelLockingPolicy> { public: diff --git a/src/render/jobs/filterlayerentityjob.cpp b/src/render/jobs/filterlayerentityjob.cpp index f727e0820..0ed2ed559 100644 --- a/src/render/jobs/filterlayerentityjob.cpp +++ b/src/render/jobs/filterlayerentityjob.cpp @@ -71,7 +71,7 @@ void updateEntityLayers(NodeManagers *manager) const QVector<HEntity> handles = entityManager->activeHandles(); // Clear list of recursive layerIds - for (const HEntity handle : handles) { + for (const HEntity &handle : handles) { Entity *entity = entityManager->data(handle); entity->clearRecursiveLayerIds(); } @@ -79,7 +79,7 @@ void updateEntityLayers(NodeManagers *manager) LayerManager *layerManager = manager->layerManager(); // Set recursive layerIds on children - for (const HEntity handle : handles) { + for (const HEntity &handle : handles) { Entity *entity = entityManager->data(handle); const Qt3DCore::QNodeIdVector entityLayers = entity->componentsUuid<Layer>(); @@ -200,7 +200,7 @@ void FilterLayerEntityJob::filterLayerAndEntity() QVector<Entity *> entitiesToFilter; entitiesToFilter.reserve(handles.size()); - for (const HEntity handle : handles) { + for (const HEntity &handle : handles) { Entity *entity = entityManager->data(handle); if (entity->isTreeEnabled()) @@ -210,7 +210,7 @@ void FilterLayerEntityJob::filterLayerAndEntity() FrameGraphManager *frameGraphManager = m_manager->frameGraphManager(); LayerManager *layerManager = m_manager->layerManager(); - for (const Qt3DCore::QNodeId layerFilterId : m_layerFilterIds) { + for (const Qt3DCore::QNodeId layerFilterId : qAsConst(m_layerFilterIds)) { LayerFilterNode *layerFilter = static_cast<LayerFilterNode *>(frameGraphManager->lookupNode(layerFilterId)); Qt3DCore::QNodeIdVector layerIds = layerFilter->layerIds(); @@ -261,7 +261,7 @@ void FilterLayerEntityJob::selectAllEntities() const QVector<HEntity> handles = entityManager->activeHandles(); m_filteredEntities.reserve(handles.size()); - for (const HEntity handle : handles) { + for (const HEntity &handle : handles) { Entity *e = entityManager->data(handle); if (e->isTreeEnabled()) m_filteredEntities.push_back(e); diff --git a/src/render/jobs/filterproximitydistancejob.cpp b/src/render/jobs/filterproximitydistancejob.cpp index 5067eeba2..a25e88508 100644 --- a/src/render/jobs/filterproximitydistancejob.cpp +++ b/src/render/jobs/filterproximitydistancejob.cpp @@ -93,7 +93,7 @@ void FilterProximityDistanceJob::selectAllEntities() const QVector<HEntity> handles = entityManager->activeHandles(); m_filteredEntities.reserve(handles.size()); - for (const HEntity handle : handles) { + for (const HEntity &handle : handles) { Entity *e = entityManager->data(handle); m_filteredEntities.push_back(e); } diff --git a/src/render/jobs/lightgatherer.cpp b/src/render/jobs/lightgatherer.cpp index e62544f15..b76cd4d73 100644 --- a/src/render/jobs/lightgatherer.cpp +++ b/src/render/jobs/lightgatherer.cpp @@ -61,7 +61,7 @@ void LightGatherer::run() const QVector<HEntity> handles = m_manager->activeHandles(); int envLightCount = 0; - for (const HEntity handle : handles) { + for (const HEntity &handle : handles) { Entity *node = m_manager->data(handle); const QVector<Light *> lights = node->renderComponents<Light>(); if (!lights.isEmpty()) diff --git a/src/render/jobs/materialparametergathererjob.cpp b/src/render/jobs/materialparametergathererjob.cpp index 9c7209cec..bae516c7e 100644 --- a/src/render/jobs/materialparametergathererjob.cpp +++ b/src/render/jobs/materialparametergathererjob.cpp @@ -79,7 +79,7 @@ MaterialParameterGathererJob::MaterialParameterGathererJob() // improvement void MaterialParameterGathererJob::run() { - for (const HMaterial materialHandle : qAsConst(m_handles)) { + for (const HMaterial &materialHandle : qAsConst(m_handles)) { Material *material = m_manager->materialManager()->data(materialHandle); if (Q_UNLIKELY(!material->isEnabled())) diff --git a/src/render/jobs/pickboundingvolumejob.cpp b/src/render/jobs/pickboundingvolumejob.cpp index df78f8f0a..ed6944d31 100644 --- a/src/render/jobs/pickboundingvolumejob.cpp +++ b/src/render/jobs/pickboundingvolumejob.cpp @@ -169,7 +169,7 @@ bool PickBoundingVolumeJob::runHelper() m_oneHoverAtLeast = false; const auto activeHandles = m_manager->objectPickerManager()->activeHandles(); - for (auto handle : activeHandles) { + for (const auto &handle : activeHandles) { auto picker = m_manager->objectPickerManager()->data(handle); m_oneEnabledAtLeast |= picker->isEnabled(); m_oneHoverAtLeast |= picker->isHoverEnabled(); @@ -330,14 +330,14 @@ void PickBoundingVolumeJob::dispatchPickEvents(const QMouseEvent &event, for (const QCollisionQueryResult::Hit &hit : qAsConst(sphereHits)) { Entity *entity = m_manager->renderNodesManager()->lookupResource(hit.m_entityId); - HObjectPicker objectPickerHandle = entity->componentHandle<ObjectPicker, 16>(); + HObjectPicker objectPickerHandle = entity->componentHandle<ObjectPicker>(); // If the Entity which actually received the hit doesn't have // an object picker component, we need to check the parent if it has one ... while (objectPickerHandle.isNull() && entity != nullptr) { entity = entity->parent(); if (entity != nullptr) - objectPickerHandle = entity->componentHandle<ObjectPicker, 16>(); + objectPickerHandle = entity->componentHandle<ObjectPicker>(); } ObjectPicker *objectPicker = m_manager->objectPickerManager()->data(objectPickerHandle); @@ -492,7 +492,7 @@ RayCasting::QRay3D PickBoundingVolumeJob::rayForViewportAndCamera(const QSize &a void PickBoundingVolumeJob::clearPreviouslyHoveredPickers() { - for (const HObjectPicker pickHandle : qAsConst(m_hoveredPickersToClear)) { + for (const HObjectPicker &pickHandle : qAsConst(m_hoveredPickersToClear)) { ObjectPicker *pick = m_manager->objectPickerManager()->data(pickHandle); if (pick) pick->onExited(); diff --git a/src/render/jobs/pickboundingvolumeutils.cpp b/src/render/jobs/pickboundingvolumeutils.cpp index cc81de812..f547eabec 100644 --- a/src/render/jobs/pickboundingvolumeutils.cpp +++ b/src/render/jobs/pickboundingvolumeutils.cpp @@ -426,7 +426,7 @@ AbstractCollisionGathererFunctor::~AbstractCollisionGathererFunctor() HitList AbstractCollisionGathererFunctor::operator ()(const Entity *entity) const { - HObjectPicker objectPickerHandle = entity->componentHandle<ObjectPicker, 16>(); + HObjectPicker objectPickerHandle = entity->componentHandle<ObjectPicker>(); // If the Entity which actually received the hit doesn't have // an object picker component, we need to check the parent if it has one ... @@ -434,7 +434,7 @@ HitList AbstractCollisionGathererFunctor::operator ()(const Entity *entity) cons while (objectPickerHandle.isNull() && parentEntity != nullptr) { parentEntity = parentEntity->parent(); if (parentEntity != nullptr) - objectPickerHandle = parentEntity->componentHandle<ObjectPicker, 16>(); + objectPickerHandle = parentEntity->componentHandle<ObjectPicker>(); } ObjectPicker *objectPicker = m_manager->objectPickerManager()->data(objectPickerHandle); @@ -568,7 +568,7 @@ bool HierarchicalEntityPicker::collectHits(Entity *root) QRayCastingService rayCasting; std::vector<std::pair<Entity *, bool>> worklist; - worklist.push_back({root, !root->componentHandle<ObjectPicker, 16>().isNull()}); + worklist.push_back({root, !root->componentHandle<ObjectPicker>().isNull()}); while (!worklist.empty()) { auto current = worklist.back(); @@ -588,8 +588,9 @@ bool HierarchicalEntityPicker::collectHits(Entity *root) } // and pick children - for (auto child: current.first->children()) - worklist.push_back({child, current.second || !child->componentHandle<ObjectPicker, 16>().isNull()}); + const auto children = current.first->children(); + for (auto child: children) + worklist.push_back({child, current.second || !child->componentHandle<ObjectPicker>().isNull()}); } return !m_hits.empty(); diff --git a/src/render/jobs/updatemeshtrianglelistjob.cpp b/src/render/jobs/updatemeshtrianglelistjob.cpp index dd3934948..1c61d1c90 100644 --- a/src/render/jobs/updatemeshtrianglelistjob.cpp +++ b/src/render/jobs/updatemeshtrianglelistjob.cpp @@ -81,7 +81,7 @@ void UpdateMeshTriangleListJob::run() const QVector<HGeometryRenderer> handles = geomRenderermanager->activeHandles(); - for (const HGeometryRenderer handle : handles) { + for (const HGeometryRenderer &handle : handles) { // Look if for the GeometryRender/Geometry the attributes and or buffers are dirty // in which case we need to recompute the triangle list const GeometryRenderer *geomRenderer = geomRenderermanager->data(handle); diff --git a/src/render/jobs/updateshaderdatatransformjob.cpp b/src/render/jobs/updateshaderdatatransformjob.cpp index 243edb4f7..c29a827e3 100644 --- a/src/render/jobs/updateshaderdatatransformjob.cpp +++ b/src/render/jobs/updateshaderdatatransformjob.cpp @@ -83,7 +83,7 @@ void UpdateShaderDataTransformJob::run() EntityManager *manager = m_manager->renderNodesManager(); const QVector<HEntity> handles = manager->activeHandles(); - for (const HEntity handle : handles) { + for (const HEntity &handle : handles) { Entity *node = manager->data(handle); // Update transform properties in ShaderDatas and Lights const QVector<ShaderData *> shaderDatas = node->renderComponents<ShaderData>(); diff --git a/src/render/jobs/updateskinningpalettejob.cpp b/src/render/jobs/updateskinningpalettejob.cpp index 9cb80c42b..41ec573ce 100644 --- a/src/render/jobs/updateskinningpalettejob.cpp +++ b/src/render/jobs/updateskinningpalettejob.cpp @@ -63,7 +63,7 @@ void UpdateSkinningPaletteJob::run() // Update the local pose transforms of JointInfo's in Skeletons from // the set of dirty joints. - for (const auto jointHandle : m_dirtyJoints) { + for (const auto &jointHandle : qAsConst(m_dirtyJoints)) { Joint *joint = m_nodeManagers->jointManager()->data(jointHandle); Q_ASSERT(joint); Skeleton *skeleton = m_nodeManagers->skeletonManager()->data(joint->owningSkeleton()); @@ -79,7 +79,7 @@ void UpdateSkinningPaletteJob::run() // Update the skeleton for each dirty armature auto armatureManager = m_nodeManagers->armatureManager(); auto skeletonManager = m_nodeManagers->skeletonManager(); - for (const auto armatureHandle : qAsConst(dirtyArmatures)) { + for (const auto &armatureHandle : qAsConst(dirtyArmatures)) { auto armature = armatureManager->data(armatureHandle); Q_ASSERT(armature); @@ -99,11 +99,12 @@ void UpdateSkinningPaletteJob::findDirtyArmatures(Entity *entity, // TODO: Be smarter about limiting which armatures we update. For e.g. only // those with skeletons that have changed and only those that are within view // of one or more renderviews. - const auto armatureHandle = entity->componentHandle<Armature, 16>(); + const auto armatureHandle = entity->componentHandle<Armature>(); if (!armatureHandle.isNull() && !armatures.contains(armatureHandle)) armatures.push_back(armatureHandle); - for (const auto child : entity->children()) + const auto children = entity->children(); + for (const auto child : children) findDirtyArmatures(child, armatures); } diff --git a/src/render/jobs/updateworldboundingvolumejob.cpp b/src/render/jobs/updateworldboundingvolumejob.cpp index 8696f4ca6..40dd919bc 100644 --- a/src/render/jobs/updateworldboundingvolumejob.cpp +++ b/src/render/jobs/updateworldboundingvolumejob.cpp @@ -59,7 +59,7 @@ void UpdateWorldBoundingVolumeJob::run() { const QVector<HEntity> handles = m_manager->activeHandles(); - for (const HEntity handle : handles) { + for (const HEntity &handle : handles) { Entity *node = m_manager->data(handle); *(node->worldBoundingVolume()) = node->localBoundingVolume()->transformed(*(node->worldTransform())); *(node->worldBoundingVolumeWithChildren()) = *(node->worldBoundingVolume()); // expanded in UpdateBoundingVolumeJob diff --git a/src/render/lights/qabstractlight.h b/src/render/lights/qabstractlight.h index 23d2d5f7e..b5dd89222 100644 --- a/src/render/lights/qabstractlight.h +++ b/src/render/lights/qabstractlight.h @@ -43,8 +43,8 @@ #include <Qt3DRender/qt3drender_global.h> #include <Qt3DCore/qcomponent.h> -#include <QVector3D> -#include <QColor> +#include <QtGui/QVector3D> +#include <QtGui/QColor> QT_BEGIN_NAMESPACE diff --git a/src/render/materialsystem/qfilterkey.h b/src/render/materialsystem/qfilterkey.h index 38951a638..23c2dd342 100644 --- a/src/render/materialsystem/qfilterkey.h +++ b/src/render/materialsystem/qfilterkey.h @@ -42,7 +42,7 @@ #include <Qt3DRender/qt3drender_global.h> #include <Qt3DCore/qnode.h> -#include <QVariant> +#include <QtCore/QVariant> QT_BEGIN_NAMESPACE diff --git a/src/render/materialsystem/qgraphicsapifilter.h b/src/render/materialsystem/qgraphicsapifilter.h index 488d8bd4b..f1d6956b3 100644 --- a/src/render/materialsystem/qgraphicsapifilter.h +++ b/src/render/materialsystem/qgraphicsapifilter.h @@ -40,10 +40,10 @@ #ifndef QT3DRENDER_QGRAPHICSAPIFILTER_H #define QT3DRENDER_QGRAPHICSAPIFILTER_H -#include <QObject> -#include <QStringList> +#include <QtCore/QObject> +#include <QtCore/QStringList> #include <Qt3DRender/qt3drender_global.h> -#include <QSurfaceFormat> +#include <QtGui/QSurfaceFormat> QT_BEGIN_NAMESPACE diff --git a/src/render/materialsystem/qmaterial.h b/src/render/materialsystem/qmaterial.h index 6cc3dd910..9d1895294 100644 --- a/src/render/materialsystem/qmaterial.h +++ b/src/render/materialsystem/qmaterial.h @@ -40,7 +40,7 @@ #ifndef QT3DRENDER_QMATERIAL_H #define QT3DRENDER_QMATERIAL_H -#include <QVariant> +#include <QtCore/QVariant> #include <Qt3DCore/qcomponent.h> #include <Qt3DRender/qt3drender_global.h> diff --git a/src/render/materialsystem/qparameter.h b/src/render/materialsystem/qparameter.h index b9f7aca36..169543e24 100644 --- a/src/render/materialsystem/qparameter.h +++ b/src/render/materialsystem/qparameter.h @@ -40,7 +40,7 @@ #ifndef QT3DRENDER_QPARAMETER_H #define QT3DRENDER_QPARAMETER_H -#include <QVariant> +#include <QtCore/QVariant> #include <Qt3DCore/qnode.h> #include <Qt3DRender/qt3drender_global.h> diff --git a/src/render/materialsystem/qrenderpass.h b/src/render/materialsystem/qrenderpass.h index 174da7267..14bd34b37 100644 --- a/src/render/materialsystem/qrenderpass.h +++ b/src/render/materialsystem/qrenderpass.h @@ -47,7 +47,7 @@ #include <Qt3DRender/qrenderstate.h> #include <Qt3DRender/qfilterkey.h> -#include <QHash> +#include <QtCore/QHash> QT_BEGIN_NAMESPACE diff --git a/src/render/materialsystem/qshaderdata.h b/src/render/materialsystem/qshaderdata.h index c35f1d6af..5e57d11a4 100644 --- a/src/render/materialsystem/qshaderdata.h +++ b/src/render/materialsystem/qshaderdata.h @@ -42,7 +42,7 @@ #include <Qt3DCore/qcomponent.h> #include <Qt3DRender/qt3drender_global.h> -#include <QVector> +#include <QtCore/QVector> QT_BEGIN_NAMESPACE diff --git a/src/render/materialsystem/qtechnique.h b/src/render/materialsystem/qtechnique.h index 19f8e8c56..c0c0d0ade 100644 --- a/src/render/materialsystem/qtechnique.h +++ b/src/render/materialsystem/qtechnique.h @@ -44,8 +44,8 @@ #include <Qt3DCore/qnode.h> #include <Qt3DRender/qrenderpass.h> #include <Qt3DRender/qfilterkey.h> -#include <QVector> -#include <QSharedPointer> +#include <QtCore/QVector> +#include <QtCore/QSharedPointer> QT_BEGIN_NAMESPACE diff --git a/src/render/materialsystem/shaderbuilder.cpp b/src/render/materialsystem/shaderbuilder.cpp index da1e6a713..283866d68 100644 --- a/src/render/materialsystem/shaderbuilder.cpp +++ b/src/render/materialsystem/shaderbuilder.cpp @@ -162,9 +162,9 @@ void ShaderBuilder::setEnabledLayers(const QStringList &layers) m_enabledLayers = layers; - for (const auto type : m_graphs.keys()) { - if (!m_graphs.value(type).isEmpty()) - m_dirtyTypes.insert(type); + for (QHash<ShaderType, QUrl>::const_iterator it = m_graphs.cbegin(); it != m_graphs.cend(); ++it) { + if (!it.value().isEmpty()) + m_dirtyTypes.insert(it.key()); } } @@ -179,9 +179,9 @@ void ShaderBuilder::setGraphicsApi(const GraphicsApiFilterData &graphicsApi) return; m_graphicsApi = graphicsApi; - for (const auto type : m_graphs.keys()) { - if (!m_graphs.value(type).isEmpty()) - m_dirtyTypes.insert(type); + for (QHash<ShaderType, QUrl>::const_iterator it = m_graphs.cbegin(); it != m_graphs.cend(); ++it) { + if (!it.value().isEmpty()) + m_dirtyTypes.insert(it.key()); } } diff --git a/src/render/materialsystem/techniquemanager_p.h b/src/render/materialsystem/techniquemanager_p.h index 5b390f94b..8108d5f5b 100644 --- a/src/render/materialsystem/techniquemanager_p.h +++ b/src/render/materialsystem/techniquemanager_p.h @@ -63,7 +63,6 @@ namespace Render { class Q_AUTOTEST_EXPORT TechniqueManager : public Qt3DCore::QResourceManager< Technique, Qt3DCore::QNodeId, - 16, Qt3DCore::NonLockingPolicy> { public: diff --git a/src/render/picking/qpickevent.h b/src/render/picking/qpickevent.h index 3fbee0d30..7d854043e 100644 --- a/src/render/picking/qpickevent.h +++ b/src/render/picking/qpickevent.h @@ -40,9 +40,9 @@ #ifndef QT3DRENDER_QPICKEVENT_H #define QT3DRENDER_QPICKEVENT_H -#include <QObject> -#include <QVector3D> -#include <QPointF> +#include <QtCore/QObject> +#include <QtGui/QVector3D> +#include <QtCore/QPointF> #include <Qt3DRender/qt3drender_global.h> QT_BEGIN_NAMESPACE diff --git a/src/render/renderstates/qstenciloperationarguments.h b/src/render/renderstates/qstenciloperationarguments.h index db80ecc19..9705c9822 100644 --- a/src/render/renderstates/qstenciloperationarguments.h +++ b/src/render/renderstates/qstenciloperationarguments.h @@ -40,7 +40,7 @@ #ifndef QT3DRENDER_QSTENCILOPERATIONARGUMENTS_H #define QT3DRENDER_QSTENCILOPERATIONARGUMENTS_H -#include <QObject> +#include <QtCore/QObject> #include <Qt3DRender/qt3drender_global.h> QT_BEGIN_NAMESPACE diff --git a/src/render/renderstates/qstenciltestarguments.h b/src/render/renderstates/qstenciltestarguments.h index f20885d03..35447d477 100644 --- a/src/render/renderstates/qstenciltestarguments.h +++ b/src/render/renderstates/qstenciltestarguments.h @@ -40,7 +40,7 @@ #ifndef QT3DRENDER_QSTENCILTESTARGUMENTS_H #define QT3DRENDER_QSTENCILTESTARGUMENTS_H -#include <QObject> +#include <QtCore/QObject> #include <Qt3DRender/qt3drender_global.h> QT_BEGIN_NAMESPACE diff --git a/src/render/texture/qtexture.cpp b/src/render/texture/qtexture.cpp index b9e1d83fe..4254a977f 100644 --- a/src/render/texture/qtexture.cpp +++ b/src/render/texture/qtexture.cpp @@ -887,6 +887,8 @@ QTextureImageDataPtr TextureLoadingHelper::loadTextureData(QIODevice *data, cons if (img.load(data, suffix.toLatin1())) { textureData = QTextureImageDataPtr::create(); textureData->setImage(mirrored ? img.mirrored() : img); + } else { + qWarning() << "Failed to load textureImage data using QImage"; } break; } @@ -935,7 +937,7 @@ QTextureDataPtr QTextureFromSourceGenerator::operator ()() } for (QString s: qAsConst(ext)) { - textureData = TextureLoadingHelper::loadTextureData(&buffer, suffix, true, m_mirrored); + textureData = TextureLoadingHelper::loadTextureData(&buffer, s, true, m_mirrored); if (textureData && textureData->data().length() > 0) break; } diff --git a/src/render/texture/qtexturegenerator.h b/src/render/texture/qtexturegenerator.h index faa9e1c7b..10f0cde57 100644 --- a/src/render/texture/qtexturegenerator.h +++ b/src/render/texture/qtexturegenerator.h @@ -43,7 +43,7 @@ #include <Qt3DRender/qabstractfunctor.h> #include <Qt3DRender/qabstracttexture.h> #include <Qt3DRender/qtexturewrapmode.h> -#include <QSharedPointer> +#include <QtCore/QSharedPointer> QT_BEGIN_NAMESPACE diff --git a/src/render/texture/qtextureimage.h b/src/render/texture/qtextureimage.h index cc86dfae1..d3fccde70 100644 --- a/src/render/texture/qtextureimage.h +++ b/src/render/texture/qtextureimage.h @@ -40,7 +40,7 @@ #ifndef QT3DRENDER_QTEXTUREIMAGE_H #define QT3DRENDER_QTEXTUREIMAGE_H -#include <QUrl> +#include <QtCore/QUrl> #include <Qt3DRender/qabstracttextureimage.h> QT_BEGIN_NAMESPACE diff --git a/src/render/texture/qtextureimagedatagenerator.h b/src/render/texture/qtextureimagedatagenerator.h index 5213f3929..0e7e6c782 100644 --- a/src/render/texture/qtextureimagedatagenerator.h +++ b/src/render/texture/qtextureimagedatagenerator.h @@ -41,7 +41,7 @@ #define QT3DRENDER_QTEXTUREIMAGEDATAGENERATOR_H #include <Qt3DRender/qabstractfunctor.h> -#include <QSharedPointer> +#include <QtCore/QSharedPointer> // TO DO TexImageDataPtr -> QImageDataPtr + d_ptr // We might also get rid of the layer, face, mipmap level from diff --git a/src/render/texture/qtexturewrapmode.h b/src/render/texture/qtexturewrapmode.h index 7349e654c..36af013a8 100644 --- a/src/render/texture/qtexturewrapmode.h +++ b/src/render/texture/qtexturewrapmode.h @@ -41,7 +41,7 @@ #define QT3DRENDER_QTEXTUREWRAPMODE_H #include <Qt3DRender/qt3drender_global.h> -#include <QObject> +#include <QtCore/QObject> QT_BEGIN_NAMESPACE diff --git a/src/render/texture/texture.cpp b/src/render/texture/texture.cpp index b4587d3e0..7e9f5c168 100644 --- a/src/render/texture/texture.cpp +++ b/src/render/texture/texture.cpp @@ -323,7 +323,7 @@ void Texture::updateFromData(QTextureDataPtr data) bool Texture::isValid() const { - for (const auto handle : m_textureImages) { + for (const auto &handle : m_textureImages) { TextureImage *img = m_textureImageManager->data(handle); if (img == nullptr) return false; |