Tweaks from using a ReadWriteMutex& to a ReadWriteMutex* parameter to avoid

problems with osgIntrospection generation.
This commit is contained in:
Robert Osfield 2006-12-27 23:19:17 +00:00
parent b2a0b50a5a
commit 11fef2d75e
4 changed files with 6 additions and 3 deletions

View File

@ -166,7 +166,7 @@ namespace osgParticle
virtual osg::BoundingBox computeBound() const; virtual osg::BoundingBox computeBound() const;
osgDB::ReadWriteMutex& getReadWriteMutex() const { return _readWriteMutex; } osgDB::ReadWriteMutex* getReadWriteMutex() const { return &_readWriteMutex; }
protected: protected:

View File

@ -114,9 +114,12 @@ void ConnectedParticleSystem::reuseParticle(int particleIndex)
void ConnectedParticleSystem::drawImplementation(osg::State& state) const void ConnectedParticleSystem::drawImplementation(osg::State& state) const
{ {
osgDB::ScopedReadLock lock(_readWriteMutex);
const Particle* particle = (_startParticle != Particle::INVALID_INDEX) ? &_particles[_startParticle] : 0; const Particle* particle = (_startParticle != Particle::INVALID_INDEX) ? &_particles[_startParticle] : 0;
if (!particle) return; if (!particle) return;
osg::Vec4 pixelSizeVector = osg::CullingSet::computePixelSizeVector(*state.getCurrentViewport(),state.getProjectionMatrix(),state.getModelViewMatrix()); osg::Vec4 pixelSizeVector = osg::CullingSet::computePixelSizeVector(*state.getCurrentViewport(),state.getProjectionMatrix(),state.getModelViewMatrix());
float unitPixelSize = fabs(1.0/(particle->getPosition()*pixelSizeVector)); float unitPixelSize = fabs(1.0/(particle->getPosition()*pixelSizeVector));
float pixelSizeOfFirstParticle = unitPixelSize * particle->getCurrentSize(); float pixelSizeOfFirstParticle = unitPixelSize * particle->getCurrentSize();

View File

@ -64,7 +64,7 @@ void osgParticle::ParticleProcessor::traverse(osg::NodeVisitor& nv)
{ {
if (nv.getFrameStamp()) if (nv.getFrameStamp())
{ {
osgDB::ScopedWriteLock lock(_ps->getReadWriteMutex()); osgDB::ScopedWriteLock lock(*(_ps->getReadWriteMutex()));
//added- 1/17/06- bgandere@nps.edu //added- 1/17/06- bgandere@nps.edu
//a check to make sure we havent updated yet this frame //a check to make sure we havent updated yet this frame

View File

@ -40,7 +40,7 @@ void osgParticle::ParticleSystemUpdater::traverse(osg::NodeVisitor& nv)
{ {
ParticleSystem* ps = i->get(); ParticleSystem* ps = i->get();
osgDB::ScopedWriteLock lock(ps->getReadWriteMutex()); osgDB::ScopedWriteLock lock(*(ps->getReadWriteMutex()));
if (!ps->isFrozen() && (ps->getLastFrameNumber() >= (nv.getFrameStamp()->getFrameNumber() - 1) || !ps->getFreezeOnCull())) if (!ps->isFrozen() && (ps->getLastFrameNumber() >= (nv.getFrameStamp()->getFrameNumber() - 1) || !ps->getFreezeOnCull()))
{ {