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

Revision 13041, 1.4 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/MultiSegmentPlacer>
3
4#include <osgDB/Registry>
5#include <osgDB/Input>
6#include <osgDB/Output>
7
8#include <osg/Vec3>
9
10#include <iostream>
11
12bool  MultiSegmentPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr);
13bool  MultiSegmentPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
14
15REGISTER_DOTOSGWRAPPER(MultiSegmentPlacer_Proxy)
16(
17    new osgParticle::MultiSegmentPlacer,
18    "MultiSegmentPlacer",
19    "Object Placer MultiSegmentPlacer",
20    MultiSegmentPlacer_readLocalData,
21    MultiSegmentPlacer_writeLocalData
22);
23
24bool MultiSegmentPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr)
25{
26    osgParticle::MultiSegmentPlacer &myobj = static_cast<osgParticle::MultiSegmentPlacer &>(obj);
27    bool itAdvanced = false;
28
29    osg::Vec3 v;
30
31    if (fr[0].matchWord("vertex")) {
32        if (fr[1].getFloat(v.x()) && fr[2].getFloat(v.y()) && fr[3].getFloat(v.z())) {
33            myobj.addVertex(v);
34            fr += 4;
35            itAdvanced = true;
36        }
37    }
38
39    return itAdvanced;
40}
41
42bool MultiSegmentPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
43{
44    const osgParticle::MultiSegmentPlacer &myobj = static_cast<const osgParticle::MultiSegmentPlacer &>(obj);
45
46    int n = myobj.numVertices();
47
48    for (int i=0; i<n; ++i) {
49        const osg::Vec3 &v = myobj.getVertex(i);
50        fw.indent() << "vertex " << v.x() << " " << v.y() << " " << v.z() << std::endl;
51    }
52
53    return true;
54}
Note: See TracBrowser for help on using the browser.