Hi Robert, Ok. You're right. This fix (temporarily)
float numNewParticles = std:: min (static_cast <float> (dt * getRateRange (). get_random ()), getRateRange (). maximum); will be added in next version? Maxim. 2010/9/17 Robert Osfield <[email protected]> > Hi Maxim, > > On Fri, Sep 17, 2010 at 3:59 PM, Maxim Gammer <[email protected]> wrote: > > Hi Robert, > > Yes, you variant works well. It will be included in the next version? > > > I have just checked in the following: > > inline int RandomRateCounter::numParticlesToCreate(double dt) const > { > // compute the number of new particles, clamping it to 1 > second of particles at the maximum rate > float numNewParticles = std::min(static_cast<float>(dt * > getRateRange().get_random()), getRateRange().maximum); > > // add the number of new particles to value carried over from > the previous call > _np += numNewParticles; > > // round down the number of particles. > int n = static_cast<int>(_np); > > // take away the number of rounded number of particles leaving > the decimal place > // this is done so that two frames of 0.5's will results in > first frame 0 new particles, second frame 1 > _np -= n; > > // return the rounded number of particles to be created > return n; > } > > I'm not entirely happy with it but at least it should avoid massive > numbers of particles when particle systems come back on screen. > > The real problem that we are seeing still is that particle systems are > particle systems aren't being regularly updated whilst off-screen, or > at least what it appears to be the problem when testing the > osgparticle - if I move the particle off screen for a few seconds and > then pull them back I get an odd gap in the particle system. I've not > dug into the implementation closely enough to review exactly what is a > happening, perhaps this could be addressed as an optional behviour > i.e. keep particle systems running fully even when offscreen. > > Robert. > _______________________________________________ > osg-submissions mailing list > [email protected] > > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > -- Maxim Gammer
_______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
