21 , m_initialScale(1.0f, 1.0f, 1.0f)
31void QQuick3DParticleModelParticle::handleMaxAmountChanged(
int amount)
67 return m_delegate.
data();
105 m_inverted = inverted;
115 return m_sortedInstances;
123 std::sort(m_sortData.
begin(), m_sortData.
end(), [&](
const SortData &
a,
const SortData &
b) {
124 return a.age < b.age;
127 std::sort(m_sortData.
begin(), m_sortData.
end(), [&](
const SortData &
a,
const SortData &
b) {
128 return a.age > b.age;
134 for (
auto &
e : m_sortData)
142 bool m_ageSorting =
false;
143 bool m_inverted =
false;
148 if (m_instanceTable) {
202 return m_instanceTable;
205void QQuick3DParticleModelParticle::clearInstanceTable()
208 m_instanceTable->
clear();
217void QQuick3DParticleModelParticle::commitInstance()
219 if (m_instanceTable) {
221 m_instanceTable->
commit();
227 auto *asModel = qobject_cast<QQuick3DModel *>(node);
229 asModel->setInstancing(instanceTable);
230 asModel->setDepthBias(
bias);
232 const auto children = node->childItems();
233 for (
auto *
child : children) {
234 auto *childNode = qobject_cast<QQuick3DNode *>(
child);
240void QQuick3DParticleModelParticle::updateDepthBias(
float bias)
245void QQuick3DParticleModelParticle::regenerate()
253 if (!m_instanceTable) {
259 m_instanceTable->
clear();
267 m_node = qobject_cast<QQuick3DNode *>(
obj);
270 auto *particleSystem =
system();
280 if (!
system() && qobject_cast<QQuick3DParticleSystem *>(parentItem()))
281 setSystem(qobject_cast<QQuick3DParticleSystem *>(parentItem()));
290 if (change == ItemParentHasChanged)
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
void clear()
Clears the contents of the byte array and makes it null.
void resize(qsizetype size)
Sets the size of the byte array to size bytes.
QByteArray & append(char c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QColor class provides colors based on RGB, HSV or CMYK values.
qsizetype size() const noexcept
QList< T > & fill(parameter_type t, qsizetype size=-1)
void resize(qsizetype size)
void append(parameter_type t)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void setParent(QObject *parent)
Makes the object a child of parent.
bool isNull() const
Returns true if the referenced object has been destroyed or if there is no referenced object; otherwi...
The QQmlComponent class encapsulates a QML component definition.
QQmlContext * creationContext() const
Returns the QQmlContext the component was created in.
virtual QObject * create(QQmlContext *context=nullptr)
Create an object instance from this component, within the specified context.
\inmodule QtQuick3D \inherits QQuick3DObject
void setHasTransparency(bool hasTransparency)
void markDirty()
Mark that the instance data has changed and must be uploaded again.
void setDepthSortingEnabled(bool enabled)
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 ...
void setParentItem(QQuick3DObject *parentItem)
virtual void itemChange(ItemChange, const ItemChangeData &)
bool isComponentComplete() const
QByteArray getInstanceBuffer(int *instanceCount) override
Implement this function to return the contents of the instance table.
void setSorting(bool enable, bool inverted=false)
QQuick3DParticleInstanceTable()
void addInstance(const QVector3D &position, const QVector3D &scale, const QVector3D &eulerRotation, const QColor &color, float age)
void setDelegate(QQmlComponent *delegate)
void instanceTableChanged()
QQuick3DInstancing * instanceTable
void itemChange(ItemChange change, const ItemChangeData &value) override
QQuick3DParticleModelParticle(QQuick3DNode *parent=nullptr)
\qmltype ModelParticle3D \inherits Particle3D \inqmlmodule QtQuick3D.Particles3D
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
QList< QQuick3DParticleData > m_particleData
void setSystem(QQuick3DParticleSystem *system)
QQuick3DParticleSystem * system() const
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
The QVector3D class represents a vector or vertex in 3D space.
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLenum GLenum GLenum GLenum scale
static void setInstancing(QQuick3DNode *node, QQuick3DInstancing *instanceTable, float bias)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent