On 22.02.2016 15:34, Robert Osfield wrote:
Hi Jannik,

I have rearranged the if statement to try and make it a bit more readable, I've also unified the two similar if statements in the ParticleProcessor.cpp and PartileSystemUpdater.cpp. Files attached, and diff below (I had to revert my git diff.tool setting to get this:-) Could you test this on your system to see if it works OK.

As a general note, it seems to me that if a ParticleSystem in a previous frame is still being rendered then osgParticle shouldn't be updating them. I have just checked and there isn't a ParticleSystem::setDataVariance(osg::Object::DYNAMIC) which is technically a bug as it doesn't double buffer it's data, it does have a Mutex which will be avoiding the most obvious race condition but design wise it's a bit dubious.
Fully agreed. The mutex will protect against crashes but there may still be bugs with certain data jumping a frame ahead or behind. IMO there are several more questionable design decisions in osgParticle, for example all the update logic being in the cullVisitor, multiple camera support being problematic, and the various particle nodes being sensitive to the order you attach them in... I'm planning to move away from osgParticle in favor of a custom particle system component later.

Regarding your patch, it didn't build for me:

/home/scrawl/Dev/osg/src/osgParticle/ParticleSystemUpdater.cpp: In member function ‘virtual void osgParticle::ParticleSystemUpdater::traverse(osg::NodeVisitor&)’: /home/scrawl/Dev/osg/src/osgParticle/ParticleSystemUpdater.cpp:47:31: error: ‘_ps’ was not declared in this scope (!_ps->getFreezeOnCull() || ((nv.getFrameStamp()->getFrameNumber()-_ps->getLastFrameNumber()) <= 2)) )

That line should have been

(!ps->getFreezeOnCull() || ((nv.getFrameStamp()->getFrameNumber()-ps->getLastFrameNumber()) <= 2)) )

Now it compiles and I can confirm that it fixes the incorrect freezing bug.

Cheers,
Jannik
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to