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

Revision 13041, 2.3 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
1
2#include <osgParticle/ExplosionOperator>
3
4#include <osgDB/Registry>
5#include <osgDB/Input>
6#include <osgDB/Output>
7
8#include <osg/Vec3>
9
10#include <iostream>
11
12bool  ExplosionOperator_readLocalData(osg::Object &obj, osgDB::Input &fr);
13bool  ExplosionOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
14
15REGISTER_DOTOSGWRAPPER(ExplosionOperator_Proxy)
16(
17    new osgParticle::ExplosionOperator,
18    "ExplosionOperator",
19    "Object Operator ExplosionOperator",
20    ExplosionOperator_readLocalData,
21    ExplosionOperator_writeLocalData
22);
23
24bool ExplosionOperator_readLocalData(osg::Object &obj, osgDB::Input &fr)
25{
26    osgParticle::ExplosionOperator &ep = static_cast<osgParticle::ExplosionOperator &>(obj);
27    bool itAdvanced = false;
28
29    osg::Vec3 a;
30    if (fr[0].matchWord("center")) {
31        if (fr[1].getFloat(a.x()) && fr[2].getFloat(a.y()) && fr[3].getFloat(a.z())) {
32            ep.setCenter(a);
33            fr += 4;
34            itAdvanced = true;
35        }
36    }
37
38    float value = 0.0f;
39    if (fr[0].matchWord("radius")) {
40        if (fr[1].getFloat(value)) {
41            ep.setRadius(value);
42            fr += 2;
43            itAdvanced = true;
44        }
45    }
46
47    if (fr[0].matchWord("magnitude")) {
48        if (fr[1].getFloat(value)) {
49            ep.setMagnitude(value);
50            fr += 2;
51            itAdvanced = true;
52        }
53    }
54
55    if (fr[0].matchWord("epsilon")) {
56        if (fr[1].getFloat(value)) {
57            ep.setEpsilon(value);
58            fr += 2;
59            itAdvanced = true;
60        }
61    }
62
63    if (fr[0].matchWord("sigma")) {
64        if (fr[1].getFloat(value)) {
65            ep.setSigma(value);
66            fr += 2;
67            itAdvanced = true;
68        }
69    }
70
71    return itAdvanced;
72}
73
74bool ExplosionOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
75{
76    const osgParticle::ExplosionOperator &ep = static_cast<const osgParticle::ExplosionOperator &>(obj);
77    osg::Vec3 a = ep.getCenter();
78    fw.indent() << "center " << a.x() << " " << a.y() << " " << a.z() << std::endl;
79
80    fw.indent() << "radius " << ep.getRadius() << std::endl;
81    fw.indent() << "magnitude " << ep.getMagnitude() << std::endl;
82    fw.indent() << "epsilon " << ep.getEpsilon() << std::endl;
83    fw.indent() << "sigma " << ep.getSigma() << std::endl;
84    return true;
85}
Note: See TracBrowser for help on using the browser.