5#include <QRandomGenerator>
229 if (m_scale ==
scale)
263 if (m_color ==
color)
306void QQuick3DRandomInstancing::handleChange()
315 return from +
c * (to - from);
322 return from +
c * (to - from);
331 return from +
c * (to - from);
333 return {
genRandom(from.
x(), to.
x(), rgen),
genRandom(from.
y(), to.
y(), rgen),
genRandom(from.
z(), to.
z(), rgen),
genRandom(from.
w(), to.
w(), rgen) };
339 switch (colorModel) {
356 switch (colorModel) {
372 generateInstanceTable();
375 return m_instanceData;
378void QQuick3DRandomInstancing::generateInstanceTable()
381 const int count = m_randomCount;
384 if (m_randomSeed == -1)
388 m_instanceData.
resize(tableSize);
391 auto *
array =
reinterpret_cast<InstanceTableEntry*
>(m_instanceData.
data());
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
void resize(qsizetype size)
Sets the size of the byte array to size bytes.
The QColor class provides colors based on RGB, HSV or CMYK values.
void getRgbF(float *r, float *g, float *b, float *a=nullptr) const
Sets the contents pointed to by r, g, b, and a, to the red, green, blue, and alpha-channel (transpare...
static QColor fromHslF(float h, float s, float l, float a=1.0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void getHslF(float *h, float *s, float *l, float *a=nullptr) const
void getHsvF(float *h, float *s, float *v, float *a=nullptr) const
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (tra...
static QColor fromHsvF(float h, float s, float v, float a=1.0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QColor fromRgbF(float r, float g, float b, float a=1.0)
Static convenience function that returns a QColor constructed from the RGB color values,...
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
void setProportional(bool proportional)
QQuick3DInstanceRange(QQuick3DObject *parent=nullptr)
void proportionalChanged()
void setFrom(QVariant from)
\inmodule QtQuick3D \inherits QQuick3DObject
void markDirty()
Mark that the instance data has changed and must be uploaded again.
static InstanceTableEntry calculateTableEntry(const QVector3D &position, const QVector3D &scale, const QVector3D &eulerRotation, const QColor &color, const QVector4D &customData={})
Converts the position scale eulerRotation color and customData to the instance table format expected ...
\qmltype Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DObject \inherits QtObject
void setRandomSeed(int randomSeed)
void setColor(QQuick3DInstanceRange *color)
void setCustomData(QQuick3DInstanceRange *customData)
~QQuick3DRandomInstancing()
QByteArray getInstanceBuffer(int *instanceCount) override
Implement this function to return the contents of the instance table.
void setInstanceCount(int instanceCount)
QQuick3DInstanceRange * color
void setRotation(QQuick3DInstanceRange *rotation)
void setColorModel(ColorModel colorModel)
QQuick3DInstanceRange * rotation
QQuick3DInstanceRange * scale
void setPosition(QQuick3DInstanceRange *position)
void setScale(QQuick3DInstanceRange *scale)
QQuick3DInstanceRange * position
QQuick3DInstanceRange * customData
QQuick3DRandomInstancing(QQuick3DObject *parent=nullptr)
\qmltype InstanceRange \inherits Object3D \inqmlmodule QtQuick3D.Helpers
\inmodule QtCore \reentrant
static Q_DECL_CONST_FUNCTION QRandomGenerator * global()
\threadsafe
double bounded(double highest)
Generates one random double in the range between 0 (inclusive) and highest (exclusive).
The QVector3D class represents a vector or vertex in 3D space.
constexpr float y() const noexcept
Returns the y coordinate of this point.
constexpr float x() const noexcept
Returns the x coordinate of this point.
constexpr float z() const noexcept
Returns the z coordinate of this point.
The QVector4D class represents a vector or vertex in 4D space.
constexpr float x() const noexcept
Returns the x coordinate of this point.
constexpr float w() const noexcept
Returns the w coordinate of this point.
constexpr float y() const noexcept
Returns the y coordinate of this point.
constexpr float z() const noexcept
Returns the z coordinate of this point.
Combined button and popup list for selecting options.
GLint GLfloat GLfloat GLfloat v2
GLenum GLenum GLsizei count
GLenum GLenum GLenum GLenum GLenum scale
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static float genRandom(float from, float to, QRandomGenerator *rgen)
myObject disconnect()
[26]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent