root/OpenSceneGraph/trunk/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleSystemUpdater.cpp @ 13041

Revision 13041, 1.3 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1
2#include <osgParticle/ParticleSystemUpdater>
3
4#include <osg/ref_ptr>
5#include <osgDB/Registry>
6#include <osgDB/Input>
7#include <osgDB/Output>
8
9bool  PSU_readLocalData(osg::Object &obj, osgDB::Input &fr);
10bool  PSU_writeLocalData(const osg::Object &obj, osgDB::Output &fr);
11
12REGISTER_DOTOSGWRAPPER(PSU_Proxy)
13(
14    new osgParticle::ParticleSystemUpdater,
15    "ParticleSystemUpdater",
16    "Object Node ParticleSystemUpdater",
17    PSU_readLocalData,
18    PSU_writeLocalData
19);
20
21bool PSU_readLocalData(osg::Object &obj, osgDB::Input &fr)
22{
23    osgParticle::ParticleSystemUpdater &myobj = static_cast<osgParticle::ParticleSystemUpdater &>(obj);
24    bool itAdvanced = false;
25
26    osg::ref_ptr<osgParticle::ParticleSystem> proto = new osgParticle::ParticleSystem;
27    osgParticle::ParticleSystem *ps = static_cast<osgParticle::ParticleSystem *>(fr.readObjectOfType(*proto));
28    if (ps) {
29        myobj.addParticleSystem(ps);
30        itAdvanced = true;
31    }
32
33    return itAdvanced;
34}
35
36bool PSU_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
37{
38    const osgParticle::ParticleSystemUpdater &myobj = static_cast<const osgParticle::ParticleSystemUpdater &>(obj);
39
40    for (unsigned int i=0; i<myobj.getNumParticleSystems(); ++i) {
41        fw.writeObject(*myobj.getParticleSystem(i));
42    }
43
44    return true;
45}
Note: See TracBrowser for help on using the browser.