Files
OpenSceneGraph/src/osgParticle/IO_ParticleSystemUpdater.cpp
2002-06-05 12:44:55 +00:00

46 lines
1.3 KiB
C++

#include <osgParticle/ParticleSystemUpdater>
#include <osg/ref_ptr>
#include <osgDB/Registry>
#include <osgDB/Input>
#include <osgDB/Output>
bool PSU_readLocalData(osg::Object &obj, osgDB::Input &fr);
bool PSU_writeLocalData(const osg::Object &obj, osgDB::Output &fr);
osgDB::RegisterDotOsgWrapperProxy PSU_Proxy
(
osgNew osgParticle::ParticleSystemUpdater,
"ParticleSystemUpdater",
"Object Node ParticleSystemUpdater",
PSU_readLocalData,
PSU_writeLocalData
);
bool PSU_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgParticle::ParticleSystemUpdater &myobj = static_cast<osgParticle::ParticleSystemUpdater &>(obj);
bool itAdvanced = false;
osg::ref_ptr<osgParticle::ParticleSystem> proto = osgNew osgParticle::ParticleSystem;
osgParticle::ParticleSystem *ps = static_cast<osgParticle::ParticleSystem *>(fr.readObjectOfType(*proto));
if (ps) {
myobj.addParticleSystem(ps);
itAdvanced = true;
}
return itAdvanced;
}
bool PSU_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
const osgParticle::ParticleSystemUpdater &myobj = static_cast<const osgParticle::ParticleSystemUpdater &>(obj);
for (int i=0; i<myobj.numParticleSystems(); ++i) {
fw.writeObject(*myobj.getParticleSystem(i));
}
return true;
}