diff --git a/VisualStudio/osgPlugins/osgParticle/dot_osgParticle.dsp b/VisualStudio/osgPlugins/osgParticle/dot_osgParticle.dsp index e8186182f..4b02a4512 100644 --- a/VisualStudio/osgPlugins/osgParticle/dot_osgParticle.dsp +++ b/VisualStudio/osgPlugins/osgParticle/dot_osgParticle.dsp @@ -116,6 +116,10 @@ SOURCE=..\..\..\src\osgPlugins\osgParticle\IO_ConnectedParticleSystem.cpp # End Source File # Begin Source File +SOURCE=..\..\..\src\osgPlugins\osgParticle\IO_ConstantRateCounter.cpp +# End Source File +# Begin Source File + SOURCE=..\..\..\src\osgPlugins\osgParticle\IO_Emitter.cpp # End Source File # Begin Source File diff --git a/src/osgPlugins/osgParticle/GNUmakefile b/src/osgPlugins/osgParticle/GNUmakefile index 26b483a04..32f6e7400 100644 --- a/src/osgPlugins/osgParticle/GNUmakefile +++ b/src/osgPlugins/osgParticle/GNUmakefile @@ -7,6 +7,7 @@ CXXFILES =\ IO_BoxPlacer.cpp\ IO_CenteredPlacer.cpp\ IO_ConnectedParticleSystem.cpp\ + IO_ConstantRateCounter.cpp\ IO_Emitter.cpp\ IO_FluidFrictionOperator.cpp\ IO_ForceOperator.cpp\ diff --git a/src/osgPlugins/osgParticle/IO_ConstantRateCounter.cpp b/src/osgPlugins/osgParticle/IO_ConstantRateCounter.cpp new file mode 100644 index 000000000..d1f156c86 --- /dev/null +++ b/src/osgPlugins/osgParticle/IO_ConstantRateCounter.cpp @@ -0,0 +1,56 @@ + +#include + +#include + +#include +#include +#include + +bool ConstantRateCounter_readLocalData(osg::Object &obj, osgDB::Input &fr); +bool ConstantRateCounter_writeLocalData(const osg::Object &obj, osgDB::Output &fw); + +osgDB::RegisterDotOsgWrapperProxy ConstantRateCounter_Proxy +( + new osgParticle::ConstantRateCounter, + "ConstantRateCounter", + "Object Counter ConstantRateCounter", + ConstantRateCounter_readLocalData, + ConstantRateCounter_writeLocalData +); + +bool ConstantRateCounter_readLocalData(osg::Object &obj, osgDB::Input &fr) +{ + osgParticle::ConstantRateCounter &myobj = static_cast(obj); + bool itAdvanced = false; + + if (fr[0].matchWord("minimumNumberOfParticlesToCreate")) { + int v; + if (fr[1].getInt(v)) { + myobj.setMinimumNumberOfParticlesToCreate(v); + fr += 2; + itAdvanced = true; + } + } + + if (fr[0].matchWord("numberOfParticlesPerSecondToCreate")) { + float v; + if (fr[1].getFloat(v)) { + myobj.setNumberOfParticlesPerSecondToCreate(v); + fr += 2; + itAdvanced = true; + } + } + + return itAdvanced; +} + +bool ConstantRateCounter_writeLocalData(const osg::Object &obj, osgDB::Output &fw) +{ + const osgParticle::ConstantRateCounter &myobj = static_cast(obj); + + fw.indent() << "minimumNumberOfParticlesToCreate " << myobj.getMinimumNumberOfParticlesToCreate() << std::endl; + fw.indent() << "numberOfParticlesPerSecondToCreate " << myobj.getNumberOfParticlesPerSecondToCreate() << std::endl; + + return true; +}