| 1 | // Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QT3DRENDER_RENDER_LOADSKELETONJOB_P_H |
| 5 | #define QT3DRENDER_RENDER_LOADSKELETONJOB_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists for the convenience |
| 12 | // of other Qt classes. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <Qt3DCore/qaspectjob.h> |
| 19 | |
| 20 | #include <QtCore/qsharedpointer.h> |
| 21 | #include <Qt3DRender/private/skeletondata_p.h> |
| 22 | #include <Qt3DRender/private/handle_types_p.h> |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | namespace Qt3DCore { |
| 27 | class QJoint; |
| 28 | } |
| 29 | |
| 30 | namespace Qt3DRender { |
| 31 | namespace Render { |
| 32 | |
| 33 | class NodeManagers; |
| 34 | class LoadSkeletonJobPrivate; |
| 35 | |
| 36 | class LoadSkeletonJob : public Qt3DCore::QAspectJob |
| 37 | { |
| 38 | public: |
| 39 | explicit LoadSkeletonJob(const HSkeleton &handle); |
| 40 | |
| 41 | void setNodeManagers(NodeManagers *nodeManagers) { m_nodeManagers = nodeManagers; } |
| 42 | |
| 43 | protected: |
| 44 | void run() override; |
| 45 | void loadSkeleton(Skeleton *skeleton); |
| 46 | void loadSkeletonFromUrl(Skeleton *skeleton); |
| 47 | void loadSkeletonFromData(Skeleton *skeleton); |
| 48 | Qt3DCore::QJoint *createFrontendJoints(const SkeletonData &skeletonData) const; |
| 49 | Qt3DCore::QJoint *createFrontendJoint(const QString &jointName, |
| 50 | const Qt3DCore::Sqt &localPose, |
| 51 | const QMatrix4x4 &inverseBindMatrix) const; |
| 52 | void processJointHierarchy(Qt3DCore::QNodeId jointId, |
| 53 | int parentJointIndex, |
| 54 | SkeletonData &skeletonData); |
| 55 | |
| 56 | HSkeleton m_handle; |
| 57 | NodeManagers *m_nodeManagers; |
| 58 | |
| 59 | private: |
| 60 | Q_DECLARE_PRIVATE(LoadSkeletonJob) |
| 61 | }; |
| 62 | |
| 63 | typedef QSharedPointer<LoadSkeletonJob> LoadSkeletonJobPtr; |
| 64 | |
| 65 | } // namespace Render |
| 66 | } // namespace Qt3DRender |
| 67 | |
| 68 | QT_END_NAMESPACE |
| 69 | |
| 70 | #endif // QT3DRENDER_RENDER_LOADSKELETONJOB_P_H |
| 71 | |