| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 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 QT3DANIMATION_QVERTEXBLENDANIMATION_H |
| 5 | #define QT3DANIMATION_QVERTEXBLENDANIMATION_H |
| 6 | |
| 7 | #include <Qt3DRender/qgeometryrenderer.h> |
| 8 | #include <Qt3DAnimation/qabstractanimation.h> |
| 9 | #include <Qt3DAnimation/qmorphtarget.h> |
| 10 | |
| 11 | #include <Qt3DAnimation/qt3danimation_global.h> |
| 12 | |
| 13 | QT_BEGIN_NAMESPACE |
| 14 | |
| 15 | namespace Qt3DAnimation { |
| 16 | |
| 17 | class QVertexBlendAnimationPrivate; |
| 18 | |
| 19 | class Q_3DANIMATIONSHARED_EXPORT QVertexBlendAnimation : public QAbstractAnimation |
| 20 | { |
| 21 | Q_OBJECT |
| 22 | Q_PROPERTY(QList<float> targetPositions READ targetPositions WRITE setTargetPositions NOTIFY targetPositionsChanged) |
| 23 | Q_PROPERTY(float interpolator READ interpolator NOTIFY interpolatorChanged) |
| 24 | Q_PROPERTY(Qt3DRender::QGeometryRenderer *target READ target WRITE setTarget NOTIFY targetChanged) |
| 25 | Q_PROPERTY(QString targetName READ targetName WRITE setTargetName NOTIFY targetNameChanged) |
| 26 | |
| 27 | public: |
| 28 | explicit QVertexBlendAnimation(QObject *parent = nullptr); |
| 29 | |
| 30 | QList<float> targetPositions() const; |
| 31 | float interpolator() const; |
| 32 | Qt3DRender::QGeometryRenderer *target() const; |
| 33 | QString targetName() const; |
| 34 | |
| 35 | void setMorphTargets(const QList<Qt3DAnimation::QMorphTarget *> &targets); |
| 36 | void addMorphTarget(Qt3DAnimation::QMorphTarget *target); |
| 37 | void removeMorphTarget(Qt3DAnimation::QMorphTarget *target); |
| 38 | |
| 39 | QList<Qt3DAnimation::QMorphTarget *> morphTargetList(); |
| 40 | |
| 41 | public Q_SLOTS: |
| 42 | void setTargetPositions(const QList<float> &targetPositions); |
| 43 | void setTarget(Qt3DRender::QGeometryRenderer *target); |
| 44 | void setTargetName(const QString name); |
| 45 | |
| 46 | Q_SIGNALS: |
| 47 | void targetPositionsChanged(const QList<float> &targetPositions); |
| 48 | void interpolatorChanged(float interpolator); |
| 49 | void targetChanged(Qt3DRender::QGeometryRenderer *target); |
| 50 | void targetNameChanged(const QString &name); |
| 51 | |
| 52 | private: |
| 53 | |
| 54 | void updateAnimation(float position); |
| 55 | |
| 56 | Q_DECLARE_PRIVATE(QVertexBlendAnimation) |
| 57 | }; |
| 58 | |
| 59 | } // Qt3DAnimation |
| 60 | |
| 61 | QT_END_NAMESPACE |
| 62 | |
| 63 | #endif // QT3DANIMATION_QVERTEXBLENDANIMATION_H |
| 64 | |