Hi Maxim, On Fri, Sep 17, 2010 at 3:37 PM, Maxim Gammer <[email protected]> wrote: > I tried, this variant is very good: > > inline int RandomRateCounter::numParticlesToCreate(double dt) const > { > float numNewParticles = std::min(dt * getRateRange().get_random(), > getRateRange().maximum); > > _np += numNewParticles; > int n = static_cast<int>(_np); > _np -= n; > return n; > } > > > but the string _np -= n; need replaced at _np = 0; > another long period of time will be created the maximum number of particles
I'm not clear on what you mean about the _np, could you post the full header that you found to work well for you, this way I can be 100% clear on what you mean. BTW, look at the _np +=..; _bp -=..; code is about carry over any point value over to the next query so that one query of 0.5, followed by another 0.5 results in no particles on the first frame, but one particle in the next. The most carry over would only ever by <1.0. So I a bit surprised by the need to rest _np to 0. Cheers, Robert. _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
