62 for (
int i=0;
i<m_gridSize;
i++)
67 for (
int i=0;
i<m_gridSize;
i++)
68 free(m_vectorField[
i]);
73void QQuickTurbulenceAffector::initializeGrid()
79 if (m_gridSize !=
arg) {
81 for (
int i=0;
i<m_gridSize;
i++)
86 for (
int i=0;
i<m_gridSize;
i++)
87 free(m_vectorField[
i]);
93 m_field = (
qreal**)malloc(m_gridSize *
sizeof(
qreal*));
94 for (
int i=0;
i<m_gridSize;
i++)
95 m_field[
i] = (
qreal*)malloc(m_gridSize *
sizeof(
qreal));
97 for (
int i=0;
i<m_gridSize;
i++)
106 for (
int i=0;
i<m_gridSize;
i++)
107 for (
int j=0;
j<m_gridSize;
j++)
109 for (
int i=0;
i<m_gridSize;
i++){
110 for (
int j=0;
j<m_gridSize;
j++){
111 m_vectorField[
i][
j].
setX(boundsRespectingField(
i-1,
j) - boundsRespectingField(
i,
j));
112 m_vectorField[
i][
j].
setY(boundsRespectingField(
i,
j) - boundsRespectingField(
i,
j-1));
117qreal QQuickTurbulenceAffector::boundsRespectingField(
int x,
int y)
127 return m_field[
x][
y];
130void QQuickTurbulenceAffector::ensureInit()
148 QRect boundsRect(0,0,m_gridSize,m_gridSize);
156 if (!boundsRect.contains(
pos,
true))
160 fx += m_vectorField[
pos.x()][
pos.y()].
x() * m_strength;
161 fy += m_vectorField[
pos.x()][
pos.y()].
y() * m_strength;
173#include "moc_qquickturbulence_p.cpp"
QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
constexpr void setY(qreal y) noexcept
Sets the y coordinate of this point to the given finite y coordinate.
constexpr void setX(qreal x) noexcept
Sets the x coordinate of this point to the given finite x coordinate.
\inmodule QtCore\reentrant
static QString urlToLocalFileOrQrc(const QString &)
If url is a local file returns a path suitable for passing to \l{QFile}.
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
qreal x
\qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item...
qreal y
Defines the item's y position relative to its parent.
qreal width
This property holds the width of this item.
qreal height
This property holds the height of this item.
void postAffect(QQuickParticleData *datum)
QQuickParticleSystem * m_system
bool shouldAffect(QQuickParticleData *datum)
QVarLengthArray< QQuickParticleGroupData *, 32 > groupData
void affectSystem(qreal dt) override
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
QQuickTurbulenceAffector(QQuickItem *parent=nullptr)
\qmltype Turbulence \instantiates QQuickTurbulenceAffector \inqmlmodule QtQuick.Particles\inherits Af...
~QQuickTurbulenceAffector()
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
bool isEmpty() const
Returns true if the URL has no data; otherwise returns false.
Combined button and popup list for selecting options.
constexpr const T & qMax(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
constexpr int qGray(int r, int g, int b)
#define QStringLiteral(str)