Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qssgrenderparticles_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
4#ifndef QSSG_RENDER_PARTICLES_H
5#define QSSG_RENDER_PARTICLES_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 <QtQuick3DRuntimeRender/private/qssgrendernode_p.h>
19#include <QtQuick3DRuntimeRender/private/qssgrendercustommaterial_p.h>
20#include <QtQuick3DRuntimeRender/private/qssgrenderlight_p.h>
21#include <QtQuick3DUtils/private/qssgrenderbasetypes_p.h>
22
24
25struct QSSGRenderImage;
27
28struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGParticleSimple
29{
31 float size;
33 float age;
35 // total 48 bytes
36};
37
38Q_STATIC_ASSERT_X(sizeof(QSSGParticleSimple) == 48, "size of QSSGParticleSimple must be 48");
39
40struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGParticleAnimated
41{
43 float size;
45 float age;
48 // Padding for full 4 * 16 bytes, take into use as needed.
49 // See particleSize in vertex shader
51 // total 64 bytes
52};
53
54Q_STATIC_ASSERT_X(sizeof(QSSGParticleAnimated) == 64, "size of QSSGParticleAnimated must be 64");
55
56struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGTriangleParticle
57{
58 QVector3D position; // particle position
59 float size;
61 float age;
63 QVector3D center; // center of the origin triangle
64 float fill;
65 // total 64 bytes
66};
67
68Q_STATIC_ASSERT_X(sizeof(QSSGTriangleParticle) == 64, "size of QSSGTriangleParticle must be 64");
69
70struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGLineParticle
71{
73 float size;
77 float age;
78 float length;
80 // total 64 bytes
81};
82
83Q_STATIC_ASSERT_X(sizeof(QSSGLineParticle) == 64, "size of QSSGLineParticle must be 64");
84
85struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGParticleBuffer
86{
87 void resize(int particleCount, int particleSize = sizeof(QSSGParticleSimple));
88 void resizeLine(int particleCount, int segmentCount);
89 void setBounds(const QSSGBounds3& bounds);
90
91 char *pointer();
92 const char *pointer() const;
93 int particlesPerSlice() const;
94 int sliceStride() const;
95 int particleCount() const;
96 int sliceCount() const;
97 QSize size() const;
98 QByteArray data() const;
99 QSSGBounds3 bounds() const;
100 int bufferSize() const;
101 int serial() const;
102 int segments() const;
103
104private:
105 int m_particlesPerSlice = 0;
106 int m_sliceStride = 0;
107 int m_particleCount = 0;
108 int m_serial = 0;
109 int m_segments = 0;
110 QSize m_size;
111 QByteArray m_particleBuffer;
112 QSSGBounds3 m_bounds;
113};
114
115struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderParticles : public QSSGRenderNode
116{
117 enum class BlendMode : quint8
118 {
119 SourceOver = 0,
120 Screen,
121 Multiply
122 };
123 enum class FeatureLevel : quint8
124 {
125 Simple = 0,
126 Mapped,
127 Animated,
128 SimpleVLight,
129 MappedVLight,
130 AnimatedVLight,
131 Line,
132 LineMapped,
133 LineAnimated,
134 LineVLight,
135 LineMappedVLight,
136 LineAnimatedVLight,
137 };
138
139 Q_DISABLE_COPY(QSSGRenderParticles)
140
141 QSSGParticleBuffer m_particleBuffer;
142
144
145 QSSGRenderParticles::BlendMode m_blendMode = BlendMode::SourceOver;
146 QSSGRenderImage *m_sprite = nullptr;
147 int m_spriteImageCount = 1;
148 float m_depthBiasSq = 0.0f; // Squared as our sorting is based on the squared distance!
149 float m_sizeModifier = 0.0f;
150 float m_alphaFade = 0.0f;
151 float m_texcoordScale = 1.0f;
152 bool m_blendImages = true;
153 bool m_billboard = true;
154 bool m_hasTransparency = true;
155 bool m_depthSorting = false;
156 QSSGRenderImage *m_colorTable = nullptr;
158 bool m_castsReflections = true;
159
162};
163
164
166
167#endif
\inmodule QtCore
Definition qbytearray.h:57
Class representing 3D range or axis aligned bounding box.
\inmodule QtCore
Definition qsize.h:25
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:31
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
The QVector4D class represents a vector or vertex in 4D space.
Definition qvectornd.h:330
a resize(100000)
Combined button and popup list for selecting options.
#define Q_STATIC_ASSERT_X(Condition, Message)
Definition qassert.h:111
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat f
GLsizei const void * pointer
Definition qopenglext.h:384
GLuint segments
static int segmentCount(const QPainterPath &path, qreal pathLength)
unsigned char quint8
Definition qtypes.h:46