In this section, we add to the project the emitter, which will create particles at a specified rate.
An example of this is
The example is based on the
03-Particles/01-SingleParticle project, implemented in the previous section. We implement the emitter right inside the
testApp class. In the class declaration, replace the following line with declaration of a single particle
Particle p; with an array of particles:
vector<Particle> p; //Particles
We will delete inactive particles from any parts of the
p array. So for computational efficiency, it is preferable to use the
deque class instead of
vector. But for simplicity, in this example, we use
vector. It works fast enough for our purposes in the example. ...