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

Revision 13041, 1.7 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/BounceOperator>
3
4#include <osgDB/Registry>
5#include <osgDB/Input>
6#include <osgDB/Output>
7
8#include <osg/Vec3>
9
10#include <iostream>
11
12bool  BounceOperator_readLocalData(osg::Object &obj, osgDB::Input &fr);
13bool  BounceOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
14
15REGISTER_DOTOSGWRAPPER(BounceOperator_Proxy)
16(
17    new osgParticle::BounceOperator,
18    "BounceOperator",
19    "Object Operator DomainOperator BounceOperator",
20    BounceOperator_readLocalData,
21    BounceOperator_writeLocalData
22);
23
24bool BounceOperator_readLocalData(osg::Object &obj, osgDB::Input &fr)
25{
26    osgParticle::BounceOperator &bp = static_cast<osgParticle::BounceOperator &>(obj);
27    bool itAdvanced = false;
28
29    float value = 0.0f;
30    if (fr[0].matchWord("friction")) {
31        if (fr[1].getFloat(value)) {
32            bp.setFriction(value);
33            fr += 2;
34            itAdvanced = true;
35        }
36    }
37
38    if (fr[0].matchWord("resilience")) {
39        if (fr[1].getFloat(value)) {
40            bp.setResilience(value);
41            fr += 2;
42            itAdvanced = true;
43        }
44    }
45
46    if (fr[0].matchWord("cutoff")) {
47        if (fr[1].getFloat(value)) {
48            bp.setCutoff(value);
49            fr += 2;
50            itAdvanced = true;
51        }
52    }
53
54    return itAdvanced;
55}
56
57bool BounceOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
58{
59    const osgParticle::BounceOperator &bp = static_cast<const osgParticle::BounceOperator &>(obj);
60    fw.indent() << "friction " << bp.getFriction() << std::endl;
61    fw.indent() << "resilience " << bp.getResilience() << std::endl;
62    fw.indent() << "cutoff " << bp.getCutoff() << std::endl;
63    return true;
64}
Note: See TracBrowser for help on using the browser.