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

Revision 13041, 1.5 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
1#include <osg/Shape>
2#include <osg/Notify>
3#include <osg/io_utils>
4
5#include <osgDB/Registry>
6#include <osgDB/Input>
7#include <osgDB/ParameterOutput>
8
9using namespace osg;
10using namespace osgDB;
11
12
13//////////////////////////////////////////////////////////////////////////////
14
15// forward declare functions to use later.
16bool Sphere_readLocalData(Object& obj, Input& fr);
17bool Sphere_writeLocalData(const Object& obj, Output& fw);
18
19//register the read and write functions with the osgDB::Registry.
20REGISTER_DOTOSGWRAPPER(Sphere)
21(
22    new osg::Sphere,
23    "Sphere",
24    "Object Sphere",
25    &Sphere_readLocalData,
26    &Sphere_writeLocalData,
27    DotOsgWrapper::READ_AND_WRITE
28);
29
30bool Sphere_readLocalData(Object& obj, Input& fr)
31{
32    bool iteratorAdvanced = false;
33
34    Sphere& sphere = static_cast<Sphere&>(obj);
35
36    if (fr.matchSequence("Center %f %f %f"))
37    {
38        osg::Vec3 center;
39        fr[1].getFloat(center.x());
40        fr[2].getFloat(center.y());
41        fr[3].getFloat(center.z());
42        sphere.setCenter(center);
43        fr+=4;
44        iteratorAdvanced = true;
45    }
46
47    if (fr.matchSequence("Radius %f"))
48    {
49        float radius;
50        fr[1].getFloat(radius);
51        sphere.setRadius(radius);
52        fr+=2;
53        iteratorAdvanced = true;
54    }
55
56
57    return iteratorAdvanced;
58}
59
60bool Sphere_writeLocalData(const Object& obj, Output& fw)
61{
62    const Sphere& sphere = static_cast<const Sphere&>(obj);
63
64    fw.indent()<<"Center "<<sphere.getCenter()<<std::endl;
65    fw.indent()<<"Radius "<<sphere.getRadius()<<std::endl;
66
67    return true;
68}
Note: See TracBrowser for help on using the browser.