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

Revision 13041, 2.0 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/OrbitOperator>
3
4#include <osgDB/Registry>
5#include <osgDB/Input>
6#include <osgDB/Output>
7
8#include <osg/Vec3>
9
10#include <iostream>
11
12bool  OrbitOperator_readLocalData(osg::Object &obj, osgDB::Input &fr);
13bool  OrbitOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
14
15REGISTER_DOTOSGWRAPPER(OrbitOperator_Proxy)
16(
17    new osgParticle::OrbitOperator,
18    "OrbitOperator",
19    "Object Operator OrbitOperator",
20    OrbitOperator_readLocalData,
21    OrbitOperator_writeLocalData
22);
23
24bool OrbitOperator_readLocalData(osg::Object &obj, osgDB::Input &fr)
25{
26    osgParticle::OrbitOperator &op = static_cast<osgParticle::OrbitOperator &>(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            op.setCenter(a);
33            fr += 4;
34            itAdvanced = true;
35        }
36    }
37
38    float value = 0.0f;
39    if (fr[0].matchWord("magnitude")) {
40        if (fr[1].getFloat(value)) {
41            op.setMagnitude(value);
42            fr += 2;
43            itAdvanced = true;
44        }
45    }
46
47    if (fr[0].matchWord("epsilon")) {
48        if (fr[1].getFloat(value)) {
49            op.setEpsilon(value);
50            fr += 2;
51            itAdvanced = true;
52        }
53    }
54
55    if (fr[0].matchWord("maxRadius")) {
56        if (fr[1].getFloat(value)) {
57            op.setMaxRadius(value);
58            fr += 2;
59            itAdvanced = true;
60        }
61    }
62
63    return itAdvanced;
64}
65
66bool OrbitOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
67{
68    const osgParticle::OrbitOperator &op = static_cast<const osgParticle::OrbitOperator &>(obj);
69    osg::Vec3 a = op.getCenter();
70    fw.indent() << "center " << a.x() << " " << a.y() << " " << a.z() << std::endl;
71
72    fw.indent() << "magnitude " << op.getMagnitude() << std::endl;
73    fw.indent() << "epsilon " << op.getEpsilon() << std::endl;
74    fw.indent() << "maxRadius " << op.getMaxRadius() << std::endl;
75    return true;
76}
Note: See TracBrowser for help on using the browser.