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

Revision 13041, 1.5 kB (checked in by robert, 3 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/LineStipple>
2
3#include <osgDB/Registry>
4#include <osgDB/Input>
5#include <osgDB/Output>
6
7using namespace osg;
8using namespace osgDB;
9using namespace std;
10
11// forward declare functions to use later.
12bool LineStipple_readLocalData(Object& obj, Input& fr);
13bool LineStipple_writeLocalData(const Object& obj, Output& fw);
14
15
16// register the read and write functions with the osgDB::Registry.
17REGISTER_DOTOSGWRAPPER(LineStipple)
18(
19    new osg::LineStipple,
20    "LineStipple",
21    "Object StateAttribute LineStipple",
22    &LineStipple_readLocalData,
23    &LineStipple_writeLocalData
24);
25
26
27bool LineStipple_readLocalData(Object& obj, Input& fr)
28{
29    bool iteratorAdvanced = false;
30
31    LineStipple& linestipple = static_cast<LineStipple&>(obj);
32
33    int ref = linestipple.getFactor();
34    if (fr[0].matchWord("factor") && fr[1].getInt(ref))
35    {
36        linestipple.setFactor(ref);
37        fr+=2;
38        iteratorAdvanced = true;
39    }
40
41    unsigned int mask = linestipple.getPattern();
42    if (fr[0].matchWord("pattern") && fr[1].getUInt(mask))
43    {
44        linestipple.setPattern(mask);
45        fr+=2;
46        iteratorAdvanced = true;
47    }
48
49    return iteratorAdvanced;
50}
51
52bool LineStipple_writeLocalData(const Object& obj,Output& fw)
53{
54    const LineStipple& linestipple = static_cast<const LineStipple&>(obj);
55
56    fw.indent() << "factor " << linestipple.getFactor() << std::endl;
57    fw.indent() << "pattern 0x" << hex << linestipple.getPattern() << dec << std::endl;
58
59    return true;
60}
Note: See TracBrowser for help on using the browser.