1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QQUICK3DPARTICLEDATA_H
5#define QQUICK3DPARTICLEDATA_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 purely as an
12// implementation detail. 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 <QVector3D>
19#include <private/qglobal_p.h>
20
21QT_BEGIN_NAMESPACE
22
23struct Color4ub {
24 uchar r = 255;
25 uchar g = 255;
26 uchar b = 255;
27 uchar a = 255;
28};
29
30struct Vector3b {
31 qint8 x = 0;
32 qint8 y = 0;
33 qint8 z = 0;
34};
35
36// Current particle data, only used for currently modified data, so one per system
37struct QQuick3DParticleDataCurrent
38{
39 QVector3D position;
40 QVector3D velocity;
41 QVector3D rotation;
42 QVector3D scale;
43 Color4ub color;
44};
45
46// Particle data per particle
47// Not modified after emits
48struct QQuick3DParticleData
49{
50 QVector3D startPosition;
51 QVector3D startVelocity;
52 // Use Vector3b to reduce the memory usage, rotations work with less accuracy.
53 // These need to be qint8 and not quint8 as rotations can go either direction.
54 Vector3b startRotation;
55 Vector3b startRotationVelocity;
56 Color4ub startColor;
57 // Seconds, system time when this particle was emitted
58 float startTime = -1.0f;
59 // Seconds, particle lifetime
60 float lifetime = 0.0f;
61 // Unified scaling among axes
62 float startSize = 1.0f;
63 float endSize = 1.0f;
64 // Seconds, sprite sequence animation total time
65 float animationTime = -1.0f;
66 // Index/id of the particle. Used to get unique random values.
67 // Might not be necessary, check later
68 int index = 0;
69 // Size: 12+12+3+3+4+4+4+4+4+4 = 54 bytes
70};
71
72// Data structure for storing bursts
73struct QQuick3DParticleEmitBurstData {
74 int amount = 0;
75 int time = 0;
76 int duration = 0;
77 QVector3D position;
78};
79
80QT_END_NAMESPACE
81
82#endif // QQUICK3DPARTICLEDATA_H
83

source code of qtquick3d/src/quick3dparticles/qquick3dparticledata_p.h