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

Revision 13041, 2.1 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// forward declare functions to use later.
15bool Cone_readLocalData(Object& obj, Input& fr);
16bool Cone_writeLocalData(const Object& obj, Output& fw);
17
18//register the read and write functions with the osgDB::Registry.
19REGISTER_DOTOSGWRAPPER(Cone)
20(
21    new osg::Cone,
22    "Cone",
23    "Object Cone",
24    &Cone_readLocalData,
25    &Cone_writeLocalData,
26    DotOsgWrapper::READ_AND_WRITE
27);
28
29bool Cone_readLocalData(Object& obj, Input& fr)
30{
31    bool iteratorAdvanced = false;
32
33    Cone& cone = static_cast<Cone&>(obj);
34
35    if (fr.matchSequence("Center %f %f %f"))
36    {
37        osg::Vec3 center;
38        fr[1].getFloat(center.x());
39        fr[2].getFloat(center.y());
40        fr[3].getFloat(center.z());
41        cone.setCenter(center);
42        fr+=4;
43        iteratorAdvanced = true;
44    }
45
46    if (fr.matchSequence("Radius %f"))
47    {
48        float radius;
49        fr[1].getFloat(radius);
50        cone.setRadius(radius);
51        fr+=2;
52        iteratorAdvanced = true;
53    }
54
55    if (fr.matchSequence("Height %f"))
56    {
57        float height;
58        fr[1].getFloat(height);
59        cone.setHeight(height);
60        fr+=2;
61        iteratorAdvanced = true;
62    }
63
64    if (fr.matchSequence("Rotation %f %f %f %f"))
65    {
66        osg::Quat rotation;
67        fr[1].getFloat(rotation.x());
68        fr[2].getFloat(rotation.y());
69        fr[3].getFloat(rotation.z());
70        fr[4].getFloat(rotation.w());
71        cone.setRotation(rotation);
72        fr+=5;
73        iteratorAdvanced = true;
74    }
75
76    return iteratorAdvanced;
77}
78
79bool Cone_writeLocalData(const Object& obj, Output& fw)
80{
81    const Cone& cone = static_cast<const Cone&>(obj);
82
83    fw.indent()<<"Center "<<cone.getCenter()<<std::endl;
84    fw.indent()<<"Radius "<<cone.getRadius()<<std::endl;
85    fw.indent()<<"Height "<<cone.getHeight()<<std::endl;
86    fw.indent()<<"Rotation "<<cone.getRotation()<<std::endl;
87
88    return true;
89}
Note: See TracBrowser for help on using the browser.