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

Revision 13041, 1.8 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/Emitter>
3
4#include <iostream>
5
6#include <osgDB/Registry>
7#include <osgDB/Input>
8#include <osgDB/Output>
9
10extern bool  read_particle(osgDB::Input &fr, osgParticle::Particle &P);
11extern void  write_particle(const osgParticle::Particle &P, osgDB::Output &fw);
12
13bool  Emitter_readLocalData(osg::Object &obj, osgDB::Input &fr);
14bool  Emitter_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
15
16REGISTER_DOTOSGWRAPPER(Emitter_Proxy)
17(
18    0,
19    "Emitter",
20    "Object Node ParticleProcessor Emitter",
21    Emitter_readLocalData,
22    Emitter_writeLocalData
23);
24
25bool Emitter_readLocalData(osg::Object &obj, osgDB::Input &fr)
26{
27    osgParticle::Emitter &myobj = static_cast<osgParticle::Emitter &>(obj);
28    bool itAdvanced = false;
29
30    if (fr[0].matchWord("useDefaultTemplate")) {
31        if (fr[1].matchWord("TRUE")) {
32            myobj.setUseDefaultTemplate(true);
33            fr += 2;
34            itAdvanced = true;
35        }
36        if (fr[1].matchWord("FALSE")) {
37            myobj.setUseDefaultTemplate(false);
38            fr += 2;
39            itAdvanced = true;
40        }
41    }
42
43    if (fr[0].matchWord("particleTemplate")) {
44        ++fr;
45        itAdvanced = true;
46        osgParticle::Particle P;
47        if (read_particle(fr, P)) {
48            myobj.setParticleTemplate(P);
49        }
50    }
51
52    return itAdvanced;
53}
54
55bool Emitter_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
56{
57    const osgParticle::Emitter &myobj = static_cast<const osgParticle::Emitter &>(obj);
58
59    fw.indent() << "useDefaultTemplate ";
60    if (!myobj.getUseDefaultTemplate()) {
61        fw << "FALSE" << std::endl;
62        fw.indent() << "particleTemplate ";
63        write_particle(myobj.getParticleTemplate(), fw);
64        fw << std::endl;
65    } else {
66        fw << "TRUE" << std::endl;
67    }
68
69    return true;
70}
Note: See TracBrowser for help on using the browser.