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 QT3DCORE_QJOINT_H |
5 | #define QT3DCORE_QJOINT_H |
6 | |
7 | #include <Qt3DCore/qnode.h> |
8 | #include <Qt3DCore/qt3dcore_global.h> |
9 | |
10 | #include <QtGui/qmatrix4x4.h> |
11 | #include <QtGui/qquaternion.h> |
12 | #include <QtGui/qvector3d.h> |
13 | |
14 | QT_BEGIN_NAMESPACE |
15 | |
16 | namespace Qt3DCore { |
17 | |
18 | class QJointPrivate; |
19 | |
20 | class Q_3DCORESHARED_EXPORT QJoint : public QNode |
21 | { |
22 | Q_OBJECT |
23 | Q_PROPERTY(QVector3D scale READ scale WRITE setScale NOTIFY scaleChanged) |
24 | Q_PROPERTY(QQuaternion rotation READ rotation WRITE setRotation NOTIFY rotationChanged) |
25 | Q_PROPERTY(QVector3D translation READ translation WRITE setTranslation NOTIFY translationChanged) |
26 | Q_PROPERTY(QMatrix4x4 inverseBindMatrix READ inverseBindMatrix WRITE setInverseBindMatrix NOTIFY inverseBindMatrixChanged) |
27 | Q_PROPERTY(float rotationX READ rotationX WRITE setRotationX NOTIFY rotationXChanged) |
28 | Q_PROPERTY(float rotationY READ rotationY WRITE setRotationY NOTIFY rotationYChanged) |
29 | Q_PROPERTY(float rotationZ READ rotationZ WRITE setRotationZ NOTIFY rotationZChanged) |
30 | Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) |
31 | |
32 | public: |
33 | explicit QJoint(Qt3DCore::QNode *parent = nullptr); |
34 | ~QJoint(); |
35 | |
36 | QVector3D scale() const; |
37 | QQuaternion rotation() const; |
38 | QVector3D translation() const; |
39 | QMatrix4x4 inverseBindMatrix() const; |
40 | float rotationX() const; |
41 | float rotationY() const; |
42 | float rotationZ() const; |
43 | QString name() const; |
44 | |
45 | void addChildJoint(QJoint *joint); |
46 | void removeChildJoint(QJoint *joint); |
47 | QList<QJoint *> childJoints() const; |
48 | |
49 | public Q_SLOTS: |
50 | void setScale(const QVector3D &scale); |
51 | void setRotation(const QQuaternion &rotation); |
52 | void setTranslation(const QVector3D &translation); |
53 | void setInverseBindMatrix(const QMatrix4x4 &inverseBindMatrix); |
54 | void setRotationX(float rotationX); |
55 | void setRotationY(float rotationY); |
56 | void setRotationZ(float rotationZ); |
57 | void setName(const QString &name); |
58 | void setToIdentity(); |
59 | |
60 | Q_SIGNALS: |
61 | void scaleChanged(const QVector3D &scale); |
62 | void rotationChanged(const QQuaternion &rotation); |
63 | void translationChanged(const QVector3D &translation); |
64 | void inverseBindMatrixChanged(const QMatrix4x4 &inverseBindMatrix); |
65 | void rotationXChanged(float rotationX); |
66 | void rotationYChanged(float rotationY); |
67 | void rotationZChanged(float rotationZ); |
68 | void nameChanged(const QString &name); |
69 | |
70 | private: |
71 | Q_DECLARE_PRIVATE(QJoint) |
72 | }; |
73 | |
74 | } // namespace Qt3DCore |
75 | |
76 | QT_END_NAMESPACE |
77 | |
78 | #endif // QT3DCORE_QJOINT_H |
79 | |