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
randominstancing_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the Qt API. It exists purely as an
9// implementation detail. This header file may change from version to
10// version without notice, or even be removed.
11//
12// We mean it.
13//
14
15#ifndef RANDOMINSTANCING_P_H
16#define RANDOMINSTANCING_P_H
17
18#include <QtQuick3D/QQuick3DInstancing>
19#include <private/qglobal_p.h>
20
22
24{
26
31 QML_NAMED_ELEMENT(InstanceRange)
32
33public:
35 ~QQuick3DInstanceRange() override {}
36 QVariant from() const
37 {
38 return m_from;
39 }
40 QVariant to() const
41 {
42 return m_to;
43 }
44
45 bool proportional() const
46 {
47 return m_proportional;
48 }
49
50public Q_SLOTS:
51 void setFrom(QVariant from);
52 void setTo(QVariant to);
54
57 void toChanged();
59 void changed();
60
61protected:
63 {
64 return nullptr;
65 }
66private:
67 QVariant m_from;
68 QVariant m_to;
69 bool m_proportional = false;
70};
71
74{
76
84
86
87 QML_NAMED_ELEMENT(RandomInstancing)
89
90public:
91 enum class ColorModel { RGB, HSV, HSL };
93
96
98
99 int instanceCount() const
100 {
101 return m_randomCount;
102 }
103
104 int randomSeed() const
105 {
106 return m_randomSeed;
107 }
108
110 {
111 return m_position;
112 }
113
115 {
116 return m_scale;
117 }
118
120 {
121 return m_rotation;
122 }
123
125 {
126 return m_color;
127 }
128
130 {
131 return m_customData;
132 }
133
135 {
136 return m_colorModel;
137 }
138
139public Q_SLOTS:
141 void setRandomSeed(int randomSeed);
142
149
159
160private Q_SLOTS:
161 void handleChange();
162
163private:
164 void generateInstanceTable();
165 int m_randomCount = 0;
166 int m_randomSeed = -1;
167 bool m_dirty = true;
168 QByteArray m_instanceData;
169 QQuick3DInstanceRange *m_position = nullptr;
170 QQuick3DInstanceRange *m_scale = nullptr;
171 QQuick3DInstanceRange *m_rotation = nullptr;
172 QQuick3DInstanceRange *m_color = nullptr;
173 QQuick3DInstanceRange *m_customData = nullptr;
174 ColorModel m_colorModel = ColorModel::RGB;
175};
177#endif // RANDOMINSTANCING_P_H
\inmodule QtCore
Definition qbytearray.h:57
void setProportional(bool proportional)
QSSGRenderGraphObject * updateSpatialNode(QSSGRenderGraphObject *) override
void setFrom(QVariant from)
\inmodule QtQuick3D \inherits QQuick3DObject
\qmltype Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DObject \inherits QtObject
QQuick3DObject * parent
\qmlproperty Object3D QtQuick3D::Object3D::parent This property holds the parent of the Object3D in a...
void setRandomSeed(int randomSeed)
QQuick3DInstanceRange * customData() const
QQuick3DInstanceRange * position() const
void setColor(QQuick3DInstanceRange *color)
void setCustomData(QQuick3DInstanceRange *customData)
QQuick3DInstanceRange * rotation() const
QByteArray getInstanceBuffer(int *instanceCount) override
Implement this function to return the contents of the instance table.
void setInstanceCount(int instanceCount)
void setRotation(QQuick3DInstanceRange *rotation)
ColorModel colorModel() const
void setColorModel(ColorModel colorModel)
QQuick3DInstanceRange * rotation
QQuick3DInstanceRange * color() const
QQuick3DInstanceRange * scale() const
void setScale(QQuick3DInstanceRange *scale)
QQuick3DInstanceRange * position
QQuick3DInstanceRange * customData
QQuick3DRandomInstancing(QQuick3DObject *parent=nullptr)
\qmltype InstanceRange \inherits Object3D \inqmlmodule QtQuick3D.Helpers
\inmodule QtCore \reentrant
Definition qrandom.h:21
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
n void setPosition(void) \n\
GLuint color
[2]
GLenum GLenum GLenum GLenum GLenum scale
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
#define explicit