Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

Using the Qt Quick Particle System

Note that to use elements from the particles module, you will need to import the types with the following line:

 import QtQuick.Particles 2.0

The ParticleSystem

This particle system contains four main types of QML Elements: ParticleSystem, Painters, Emitters and Affectors.

The ParticleSystem element ties all the other elements together, and manages the shared timeline. Painters, Emitters and Affectors must all have the same ParticleSystem to be able to interact with each other.

You may have as many ParticleSystems as you want subject to this constraint, so the logical separation is to have one ParticleSystem for all the elements that you want to interact, or just one if the number of elements is small and they are easily kept under control..

Logical Particles

All the particle system elements act on "logical particles". Every particle has a logical representation inside the particle system, and this is what the elements act upon. Not every logical particle needs to be visualized, and some logical particles could lead to multiple visual particles being drawn on screen.

Particle Groups

Every logical particle is a member of a particle group, and each group is identified by a name. If no other group has been specified, a logical particle belongs to the group with the name "" (the empty string), which acts the same as any other group. Groups are used for two purposes, for controlling particles and because they can have stochastic state transitions.

Groups control particles because you can never access an individual particle with any of the particle system elements. All elements act on groups as a whole, and so any particles that need to behave differently from each other (aside from the usual stochastic parameter variation) will need to be in different groups.

Particles can also change groups dynamically. When this happens the particles trajectory is unaltered, but it can be acted upon by different ParticlePainters or Affectors. Particles can either have their group changed by an Affector, or stochastic state transitions can be defined in a ParticleGroup element.

Generally, groups should only be defined in a ParticleGroup if they require stochastic state transitions. Otherwise, it is sufficient to have the groups be defined simply by the strings used in the particle/particles properties of the elements.

Emitters

Emitters emit logical particles into the system. These particles have a trajectory and lifespan, but no visualization. These particles are emitted from the location of the Emitter.

TrailEmitters are a special type of emitter which emits particles from the location of other logicial particles. Any logical particle of the followed type within the bounds of a TrailEmitter will cause particle emission from its location, as if there were an Emitter on it with the same properties as the TrailEmitter.

ParticlePainters

Painters are the elements that visualize logical particles. For each logical particle in the groups assigned to it, which are within its bounds (or outside, if you do not set the clip property on the element) it will be visualized in a manner dependent on the type of ParticlePainter. The base type of ParticlePainter does not draw anything. ImageParticle renders an image at the particle location. CustomParticle allows you to write your own shaders to render the particles, passing in the logical particle state as vertex data. ItemParticle allows you to visualize logical particles using arbitrary QML delegates. ModelParticle is similar, but coordinates model data amongst the delegates in a similar manner to the view classes.

As the ParticlePainter is the QML element visualizing the particles in the scene, it is its Z value which is important when trying to place particles above or below other elements visually.

Affectors

Affectors are an optional component of a particle system. They can perform a variety of manipulations to the simulation, such as altering the trajectory of particles or prematurely ending their life in the simulation. For performance reasons, it is recommended not to use Affectors in high-volume particle systems.

Stochastic Parameters

As particle systems benefit from stochastic control of parameters across a large number of instances, several stochastic helper types are used by the particle system. If you do not wish to have any stochastic variation in these parameters, then do not specify any variation in these elements.

Directions

Directions can be specified by angle and magnitude, or by x and y components. While any direction can be specified with either method, there is a significant difference between varying the x and y components and varying the angle and magnitude. Varying the x and y components will lead to a rectangular area around the specified point, while varying the angle will lead to an arc centered on the specified point.

Shapes

The particle system contains several elements which represent shapes. These elements do not visualize shapes, and are used for the purpose of selecting a random point within the shape. If you want a specific point with no randomness, use a 0 width and 0 height shape (which is the default). Otherwise you can use the shape elements provides to specify an area, so that the result can use a random point selected from that area.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web