From Tom Jolley, "There was some unnecessary creation and deletion of Particle objects in

include/osgParticle/ParticleSystem.  I replaced

   Particle(ptemplate? *ptemplate: _def_ptemp)

with

   ptemplate? *ptemplate: _def_ptemp

in a couple of places.  This should make particle creation and reuse go
a little faster without all that memory allocation and copying."
This commit is contained in:
Robert Osfield 2007-01-12 21:44:28 +00:00
parent 785fd5c0d9
commit 007cc9f4ac

View File

@ -372,7 +372,7 @@ namespace osgParticle
Particle* P = _deadparts.top();
// create a new (alive) particle in the same place
*P = Particle(ptemplate? *ptemplate: _def_ptemp);
*P = ptemplate? *ptemplate: _def_ptemp;
// remove the pointer from the death stack
_deadparts.pop();
@ -381,7 +381,7 @@ namespace osgParticle
} else {
// add a new particle to the vector
_particles.push_back(Particle(ptemplate? *ptemplate: _def_ptemp));
_particles.push_back(ptemplate? *ptemplate: _def_ptemp);
return &_particles.back();
}
}