root/OpenSceneGraph/trunk/src/osgWrappers/deprecated-dotosg/osg/ClusterCullingCallback.cpp @ 13041

Revision 13041, 2.2 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#include <osg/ClusterCullingCallback>
2#include <osg/io_utils>
3
4#include <osgDB/Registry>
5#include <osgDB/Input>
6#include <osgDB/Output>
7
8using namespace osg;
9using namespace osgDB;
10
11bool  ClusterCullingCallback_readLocalData(osg::Object &obj, osgDB::Input &fr);
12bool  ClusterCullingCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw); // register the read and write functions with the osgDB::Registry.
13
14REGISTER_DOTOSGWRAPPER(ClusterCullingCallback)
15(
16    new ClusterCullingCallback,
17    "ClusterCullingCallback",
18    "Object ClusterCullingCallback",
19    &ClusterCullingCallback_readLocalData,
20    &ClusterCullingCallback_writeLocalData
21);
22
23bool ClusterCullingCallback_readLocalData(osg::Object &obj, osgDB::Input &fr)
24{
25    ClusterCullingCallback* ccc = dynamic_cast<ClusterCullingCallback*>(&obj);
26    if (!ccc) return false;
27
28    bool iteratorAdvanced = false;
29
30    osg::Vec3 vec;
31    if (fr[0].matchWord("controlPoint") &&
32        fr[1].getFloat(vec[0]) && fr[2].getFloat(vec[1]) && fr[3].getFloat(vec[2]))
33    {
34        ccc->setControlPoint(vec);
35        fr += 4;
36        iteratorAdvanced = true;
37    }
38
39    if (fr[0].matchWord("normal") &&
40        fr[1].getFloat(vec[0]) && fr[2].getFloat(vec[1]) && fr[3].getFloat(vec[2]))
41    {
42        ccc->setNormal(vec);
43        fr += 4;
44        iteratorAdvanced = true;
45    }
46
47    float value;
48    if (fr[0].matchWord("radius") && fr[1].getFloat(value))
49    {
50        ccc->setRadius(value);
51        fr += 2;
52        iteratorAdvanced = true;
53    }
54
55    if (fr[0].matchWord("deviation") && fr[1].getFloat(value))
56    {
57        ccc->setDeviation(value);
58        fr += 2;
59        iteratorAdvanced = true;
60    }
61
62    return iteratorAdvanced;
63}
64
65bool ClusterCullingCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
66{
67    const ClusterCullingCallback* ccc = dynamic_cast<const ClusterCullingCallback*>(&obj);
68    if (!ccc) return false;
69
70    int prec = fw.precision();
71    fw.precision(15);
72
73    fw.indent() << "controlPoint " << ccc->getControlPoint() << std::endl;
74    fw.indent() << "normal " << ccc->getNormal() << std::endl;
75    fw.indent() << "radius " << ccc->getRadius() << std::endl;
76    fw.indent() << "deviation " << ccc->getDeviation() << std::endl;
77
78    fw.precision(prec);
79
80    return true;
81}
Note: See TracBrowser for help on using the browser.