From 31c9dbc881d420674571206ed0a55e4ae5a9181e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 27 Apr 2018 11:23:07 +0100 Subject: [PATCH] Fixed particle update bug where a ParticleSystem wouldn't start when loaded during the frame loop due to the _last_frame value not being set. --- src/osgParticle/ParticleSystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osgParticle/ParticleSystem.cpp b/src/osgParticle/ParticleSystem.cpp index d10fd42d3..42cf4f053 100644 --- a/src/osgParticle/ParticleSystem.cpp +++ b/src/osgParticle/ParticleSystem.cpp @@ -211,8 +211,6 @@ void osgParticle::ParticleSystem::update(double dt, osg::NodeVisitor& nv) void osgParticle::ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) const { - if (_particles.size() <= 0) return; - ScopedReadLock lock(_readWriteMutex); osg::State& state = *renderInfo.getState(); @@ -221,6 +219,8 @@ void osgParticle::ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo // this particle system is culled _last_frame = state.getFrameStamp()->getFrameNumber(); + if (_particles.size() <= 0) return; + // update the dirty flag of delta time, so next time a new request for delta time // will automatically cause recomputing _dirty_dt = true;