From 344908faad2270e7b57ae16f27e5f579862d1cd9 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 21 Nov 2008 12:30:12 +0000 Subject: [PATCH] Made the ParticleSystemUpdate::addParticleSystem, removeParticleSystem, replaceParticleSystem and setParticleSystem methods all virtual to allow them to be overriden. --- include/osgParticle/ParticleSystemUpdater | 63 ++--------------------- src/osgParticle/ParticleSystemUpdater.cpp | 53 +++++++++++++++++++ 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/include/osgParticle/ParticleSystemUpdater b/include/osgParticle/ParticleSystemUpdater index 5ab10886b..05b581e1f 100644 --- a/include/osgParticle/ParticleSystemUpdater +++ b/include/osgParticle/ParticleSystemUpdater @@ -44,19 +44,19 @@ namespace osgParticle META_Node(osgParticle,ParticleSystemUpdater); /// Add a particle system to the list. - inline bool addParticleSystem(ParticleSystem* ps); + virtual bool addParticleSystem(ParticleSystem* ps); /// Remove a particle system from the list (by pointer). - inline bool removeParticleSystem(ParticleSystem* ps); + virtual bool removeParticleSystem(ParticleSystem* ps); /// Remove a particle system(s) from the list (by index). - inline bool removeParticleSystem(unsigned int i, unsigned int numParticleSystemsToRemove=1); + virtual bool removeParticleSystem(unsigned int i, unsigned int numParticleSystemsToRemove=1); /// Replace ParticleSystem with another ParticleSystem. - inline bool replaceParticleSystem(ParticleSystem* origPS, ParticleSystem* newPS); + virtual bool replaceParticleSystem(ParticleSystem* origPS, ParticleSystem* newPS); /// set a particle system by index. - inline bool setParticleSystem( unsigned int i, ParticleSystem* ps ); + virtual bool setParticleSystem( unsigned int i, ParticleSystem* ps ); /// Return the number of particle systems on the list. inline unsigned int getNumParticleSystems() const; @@ -95,59 +95,6 @@ namespace osgParticle // INLINE FUNCTIONS - inline bool ParticleSystemUpdater::addParticleSystem(ParticleSystem* ps) - { - _psv.push_back(ps); - return true; - } - - inline bool ParticleSystemUpdater::removeParticleSystem(ParticleSystem* ps) - { - unsigned int i = getParticleSystemIndex( ps ); - if( i >= _psv.size() ) return false; - removeParticleSystem( i ); - return true; - } - - inline bool ParticleSystemUpdater::removeParticleSystem(unsigned int pos, unsigned int numParticleSystemsToRemove) - { - if( (pos < _psv.size()) && (numParticleSystemsToRemove > 0) ) - { - unsigned int endOfRemoveRange = pos + numParticleSystemsToRemove; - if( endOfRemoveRange > _psv.size() ) - { - osg::notify(osg::DEBUG_INFO)<<"Warning: ParticleSystem::removeParticleSystem(i,numParticleSystemsToRemove) has been passed an excessive number"<(_psv.size()); diff --git a/src/osgParticle/ParticleSystemUpdater.cpp b/src/osgParticle/ParticleSystemUpdater.cpp index 7785f5890..04aa1990f 100644 --- a/src/osgParticle/ParticleSystemUpdater.cpp +++ b/src/osgParticle/ParticleSystemUpdater.cpp @@ -66,3 +66,56 @@ osg::BoundingSphere osgParticle::ParticleSystemUpdater::computeBound() const return osg::BoundingSphere(); } +bool osgParticle::ParticleSystemUpdater::addParticleSystem(ParticleSystem* ps) +{ + _psv.push_back(ps); + return true; +} + +bool osgParticle::ParticleSystemUpdater::removeParticleSystem(ParticleSystem* ps) +{ + unsigned int i = getParticleSystemIndex( ps ); + if( i >= _psv.size() ) return false; + + removeParticleSystem( i ); + return true; +} + +bool osgParticle::ParticleSystemUpdater::removeParticleSystem(unsigned int pos, unsigned int numParticleSystemsToRemove) +{ + if( (pos < _psv.size()) && (numParticleSystemsToRemove > 0) ) + { + unsigned int endOfRemoveRange = pos + numParticleSystemsToRemove; + if( endOfRemoveRange > _psv.size() ) + { + osg::notify(osg::DEBUG_INFO)<<"Warning: ParticleSystem::removeParticleSystem(i,numParticleSystemsToRemove) has been passed an excessive number"<