| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include <math.h> |
| 5 | #include "qquickv4particledata_p.h" |
| 6 | #include <QDebug> |
| 7 | #include <private/qv4engine_p.h> |
| 8 | #include <private/qv4functionobject_p.h> |
| 9 | #include <QtCore/private/qnumeric_p.h> |
| 10 | |
| 11 | QT_BEGIN_NAMESPACE |
| 12 | |
| 13 | /*! |
| 14 | \qmltype Particle |
| 15 | \inqmlmodule QtQuick.Particles |
| 16 | \brief Represents particles manipulated by emitters and affectors. |
| 17 | \ingroup qtquick-particles |
| 18 | |
| 19 | Particle elements are always managed internally by the ParticleSystem and cannot be created in QML. |
| 20 | However, sometimes they are exposed via signals so as to allow arbitrary changes to the particle state |
| 21 | */ |
| 22 | |
| 23 | /*! |
| 24 | \qmlproperty real QtQuick.Particles::Particle::initialX |
| 25 | The x coordinate of the particle at the beginning of its lifetime. |
| 26 | |
| 27 | The method of simulation prefers to have the initial values changed, rather |
| 28 | than determining and changing the value at a given time. Change initial |
| 29 | values in CustomEmitters instead of the current values. |
| 30 | */ |
| 31 | |
| 32 | /*! |
| 33 | \qmlproperty real QtQuick.Particles::Particle::initialVX |
| 34 | The x velocity of the particle at the beginning of its lifetime. |
| 35 | |
| 36 | The method of simulation prefers to have the initial values changed, rather |
| 37 | than determining and changing the value at a given time. Change initial |
| 38 | values in CustomEmitters instead of the current values. |
| 39 | */ |
| 40 | |
| 41 | /*! |
| 42 | \qmlproperty real QtQuick.Particles::Particle::initialAX |
| 43 | The x acceleration of the particle at the beginning of its lifetime. |
| 44 | |
| 45 | The method of simulation prefers to have the initial values changed, rather |
| 46 | than determining and changing the value at a given time. Change initial |
| 47 | values in CustomEmitters instead of the current values. |
| 48 | */ |
| 49 | |
| 50 | /*! |
| 51 | \qmlproperty real QtQuick.Particles::Particle::initialY |
| 52 | The y coordinate of the particle at the beginning of its lifetime. |
| 53 | |
| 54 | The method of simulation prefers to have the initial values changed, rather |
| 55 | than determining and changing the value at a given time. Change initial |
| 56 | values in CustomEmitters instead of the current values. |
| 57 | */ |
| 58 | |
| 59 | /*! |
| 60 | \qmlproperty real QtQuick.Particles::Particle::initialVY |
| 61 | The y velocity of the particle at the beginning of its lifetime. |
| 62 | |
| 63 | The method of simulation prefers to have the initial values changed, rather |
| 64 | than determining and changing the value at a given time. Change initial |
| 65 | values in CustomEmitters instead of the current values. |
| 66 | */ |
| 67 | |
| 68 | /*! |
| 69 | \qmlproperty real QtQuick.Particles::Particle::initialAY |
| 70 | The y acceleration of the particle at the beginning of its lifetime. |
| 71 | |
| 72 | The method of simulation prefers to have the initial values changed, rather |
| 73 | than determining and changing the value at a given time. Change initial |
| 74 | values in CustomEmitters instead of the current values. |
| 75 | */ |
| 76 | |
| 77 | /*! |
| 78 | \qmlproperty real QtQuick.Particles::Particle::x |
| 79 | The current x coordinate of the particle. |
| 80 | */ |
| 81 | |
| 82 | /*! |
| 83 | \qmlproperty real QtQuick.Particles::Particle::vx |
| 84 | The current x velocity of the particle. |
| 85 | */ |
| 86 | |
| 87 | /*! |
| 88 | \qmlproperty real QtQuick.Particles::Particle::ax |
| 89 | The current x acceleration of the particle. |
| 90 | */ |
| 91 | |
| 92 | /*! |
| 93 | \qmlproperty real QtQuick.Particles::Particle::y |
| 94 | The current y coordinate of the particle. |
| 95 | */ |
| 96 | |
| 97 | /*! |
| 98 | \qmlproperty real QtQuick.Particles::Particle::vy |
| 99 | The current y velocity of the particle. |
| 100 | */ |
| 101 | |
| 102 | /*! |
| 103 | \qmlproperty real QtQuick.Particles::Particle::ay |
| 104 | The current y acceleration of the particle. |
| 105 | */ |
| 106 | |
| 107 | /*! |
| 108 | \qmlproperty real QtQuick.Particles::Particle::t |
| 109 | The time, in seconds since the beginning of the simulation, that the particle was born. |
| 110 | */ |
| 111 | |
| 112 | |
| 113 | /*! |
| 114 | \qmlproperty real QtQuick.Particles::Particle::startSize |
| 115 | The size in pixels that the particle image is at the start |
| 116 | of its life. |
| 117 | */ |
| 118 | |
| 119 | |
| 120 | /*! |
| 121 | \qmlproperty real QtQuick.Particles::Particle::endSize |
| 122 | The size in pixels that the particle image is at the end |
| 123 | of its life. If this value is less than 0, then it is |
| 124 | disregarded and the particle will have its startSize for the |
| 125 | entire lifetime. |
| 126 | */ |
| 127 | |
| 128 | /*! |
| 129 | \qmlproperty real QtQuick.Particles::Particle::lifeSpan |
| 130 | The time in seconds that the particle will live for. |
| 131 | */ |
| 132 | |
| 133 | /*! |
| 134 | \qmlproperty real QtQuick.Particles::Particle::rotation |
| 135 | Degrees clockwise that the particle image is rotated at |
| 136 | the beginning of its life. |
| 137 | */ |
| 138 | |
| 139 | /*! |
| 140 | \qmlproperty real QtQuick.Particles::Particle::rotationVelocity |
| 141 | Degrees clockwise per second that the particle image is rotated at while alive. |
| 142 | */ |
| 143 | /*! |
| 144 | \qmlproperty bool QtQuick.Particles::Particle::autoRotate |
| 145 | If autoRotate is true, then the particle's rotation will be |
| 146 | set so that it faces the direction of travel, plus any |
| 147 | rotation from the rotation or rotationVelocity properties. |
| 148 | */ |
| 149 | |
| 150 | /*! |
| 151 | \qmlproperty bool QtQuick.Particles::Particle::update |
| 152 | |
| 153 | Inside an Affector, the changes made to the particle will only be |
| 154 | applied if update is set to true. |
| 155 | */ |
| 156 | /*! |
| 157 | \qmlproperty real QtQuick.Particles::Particle::xDeformationVectorX |
| 158 | |
| 159 | The x component of the deformation vector along the X axis. ImageParticle |
| 160 | can draw particles across non-square shapes. It will draw the texture rectangle |
| 161 | across the parallelogram drawn with the x and y deformation vectors. |
| 162 | */ |
| 163 | |
| 164 | /*! |
| 165 | \qmlproperty real QtQuick.Particles::Particle::yDeformationVectorX |
| 166 | |
| 167 | The y component of the deformation vector along the X axis. ImageParticle |
| 168 | can draw particles across non-square shapes. It will draw the texture rectangle |
| 169 | across the parallelogram drawn with the x and y deformation vectors. |
| 170 | */ |
| 171 | |
| 172 | /*! |
| 173 | \qmlproperty real QtQuick.Particles::Particle::xDeformationVectorY |
| 174 | |
| 175 | The x component of the deformation vector along the X axis. ImageParticle |
| 176 | can draw particles across non-square shapes. It will draw the texture rectangle |
| 177 | across the parallelogram drawn with the x and y deformation vectors. |
| 178 | */ |
| 179 | |
| 180 | /*! |
| 181 | \qmlproperty real QtQuick.Particles::Particle::yDeformationVectorY |
| 182 | |
| 183 | The y component of the deformation vector along the Y axis. ImageParticle |
| 184 | can draw particles across non-square shapes. It will draw the texture rectangle |
| 185 | across the parallelogram drawn with the x and y deformation vectors. |
| 186 | */ |
| 187 | |
| 188 | /*! |
| 189 | \qmlproperty real QtQuick.Particles::Particle::red |
| 190 | |
| 191 | ImageParticle can draw colorized particles. When it does so, red is used |
| 192 | as the red channel of the color applied to the source image. |
| 193 | |
| 194 | Values are from 0.0 to 1.0. |
| 195 | */ |
| 196 | |
| 197 | /*! |
| 198 | \qmlproperty real QtQuick.Particles::Particle::green |
| 199 | |
| 200 | ImageParticle can draw colorized particles. When it does so, green is used |
| 201 | as the green channel of the color applied to the source image. |
| 202 | |
| 203 | Values are from 0.0 to 1.0. |
| 204 | */ |
| 205 | |
| 206 | /*! |
| 207 | \qmlproperty real QtQuick.Particles::Particle::blue |
| 208 | |
| 209 | ImageParticle can draw colorized particles. When it does so, blue is used |
| 210 | as the blue channel of the color applied to the source image. |
| 211 | |
| 212 | Values are from 0.0 to 1.0. |
| 213 | */ |
| 214 | |
| 215 | /*! |
| 216 | \qmlproperty real QtQuick.Particles::Particle::alpha |
| 217 | |
| 218 | ImageParticle can draw colorized particles. When it does so, alpha is used |
| 219 | as the alpha channel of the color applied to the source image. |
| 220 | |
| 221 | Values are from 0.0 to 1.0. |
| 222 | */ |
| 223 | /*! |
| 224 | \qmlproperty real QtQuick.Particles::Particle::lifeLeft |
| 225 | The time in seconds that the particle has left to live at |
| 226 | the current point in time. |
| 227 | */ |
| 228 | /*! |
| 229 | \qmlproperty real QtQuick.Particles::Particle::currentSize |
| 230 | The currentSize of the particle, interpolating between startSize and endSize based on the currentTime. |
| 231 | */ |
| 232 | |
| 233 | QT_END_NAMESPACE |
| 234 | |