Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquick3dparticlespritesequence_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QQUICK3DPARTICLESPRITESEQUENCE_H
7#define QQUICK3DPARTICLESPRITESEQUENCE_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QObject>
21#include <QQmlEngine>
22#include <QtQml/qqmlparserstatus.h>
23#include <QtQuick3DParticles/qtquick3dparticlesglobal.h>
24#include <private/qglobal_p.h>
25
27
28class QQuick3DParticleSpriteParticle;
29
30class Q_QUICK3DPARTICLES_EXPORT QQuick3DParticleSpriteSequence : public QObject, public QQmlParserStatus
31{
32 Q_OBJECT
33 Q_PROPERTY(int frameCount READ frameCount WRITE setFrameCount NOTIFY frameCountChanged)
34 Q_PROPERTY(int frameIndex READ frameIndex WRITE setFrameIndex NOTIFY frameIndexChanged)
35 Q_PROPERTY(bool interpolate READ interpolate WRITE setInterpolate NOTIFY interpolateChanged)
36 Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
37 Q_PROPERTY(int durationVariation READ durationVariation WRITE setDurationVariation NOTIFY durationVariationChanged)
38 Q_PROPERTY(bool randomStart READ randomStart WRITE setRandomStart NOTIFY randomStartChanged)
39 Q_PROPERTY(AnimationDirection animationDirection READ animationDirection WRITE setAnimationDirection NOTIFY animationDirectionChanged)
40
41 QML_NAMED_ELEMENT(SpriteSequence3D)
42 Q_INTERFACES(QQmlParserStatus)
43 QML_ADDED_IN_VERSION(6, 2)
44
45public:
46 enum AnimationDirection
47 {
48 Normal = 0,
49 Reverse,
50 Alternate,
51 AlternateReverse,
52 SingleFrame
53 };
54 Q_ENUM(AnimationDirection)
55
56 QQuick3DParticleSpriteSequence(QObject *parent = nullptr);
57 ~QQuick3DParticleSpriteSequence() override;
58
59 int frameCount() const;
60 int frameIndex() const;
61 bool interpolate() const;
62 int duration() const;
63 int durationVariation() const;
64 bool randomStart() const;
65 AnimationDirection animationDirection() const;
66
67public Q_SLOTS:
68 void setFrameCount(int frameCount);
69 void setFrameIndex(int frameIndex);
70 void setInterpolate(bool interpolate);
71 void setDuration(int duration);
72 void setDurationVariation(int durationVariation);
73 void setRandomStart(bool randomStart);
74 void setAnimationDirection(QQuick3DParticleSpriteSequence::AnimationDirection animationDirection);
75
76Q_SIGNALS:
77 void frameCountChanged();
78 void frameIndexChanged();
79 void interpolateChanged();
80 void durationChanged();
81 void durationVariationChanged();
82 void randomStartChanged();
83 void animationDirectionChanged();
84
85protected:
86 // From QQmlParserStatus
87 void componentComplete() override;
88 void classBegin() override {}
89
90private:
91 friend class QQuick3DParticleSpriteParticle;
92 friend class QQuick3DParticleSystem;
93
94 void markNodesDirty();
95 float firstFrame(int index, bool singleFrame);
96
97 QQuick3DParticleSpriteParticle *m_parentParticle = nullptr;
98 int m_frameCount = 1;
99 int m_frameIndex = 0;
100 bool m_interpolate = true;
101 int m_duration = -1;
102 int m_durationVariation = 0;
103 bool m_randomStart = false;
104 AnimationDirection m_animationDirection = AnimationDirection::Normal;
105};
106
107QT_END_NAMESPACE
108
109#endif // QQUICK3DPARTICLESPRITESEQUENCE_H
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:27
Combined button and popup list for selecting options.
static QVector3D reflect(const QVector3D &I, QVector3D &N)
static QMatrix4x4 rotationFromNormal(const QVector3D &n)