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

Revision 13041, 2.3 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/ClearNode>
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
11// forward declare functions to use later.
12bool ClearNode_readLocalData(Object& obj, Input& fr);
13bool ClearNode_writeLocalData(const Object& obj, Output& fw);
14
15// register the read and write functions with the osgDB::Registry.
16
17REGISTER_DOTOSGWRAPPER(EarthSky)
18(
19    new osg::ClearNode,
20    "EarthSky",
21    "Object Node EarthSky Group",
22    &ClearNode_readLocalData,
23    &ClearNode_writeLocalData
24);
25
26REGISTER_DOTOSGWRAPPER(ClearNode)
27(
28    new osg::ClearNode,
29    "ClearNode",
30    "Object Node ClearNode Group",
31    &ClearNode_readLocalData,
32    &ClearNode_writeLocalData
33);
34
35bool ClearNode_readLocalData(Object& obj, Input& fr)
36{
37    bool iteratorAdvanced = false;
38
39    ClearNode& es = static_cast<ClearNode&>(obj);
40
41    if (fr.matchSequence("requiresClear"))
42    {
43        if (fr[1].matchWord("TRUE"))
44        {
45            es.setRequiresClear(true);
46            iteratorAdvanced = true;
47            fr+=2;
48        }
49        else if (fr[1].matchWord("FALSE"))
50        {
51            es.setRequiresClear(false);
52            iteratorAdvanced = true;
53            fr+=2;
54        }
55    }
56
57    osg::Vec4 vec4(0.0f,0.0f,0.0f,1.0f);
58
59    if (fr[0].matchWord("clearColor") &&
60        fr[1].getFloat(vec4[0]) &&
61        fr[2].getFloat(vec4[1]) &&
62        fr[3].getFloat(vec4[2]) &&
63        fr[4].getFloat(vec4[3]))
64    {
65        es.setClearColor(vec4);
66        fr+=5;
67        iteratorAdvanced = true;
68    }
69
70    if (fr[0].matchWord("clearMask"))
71    {
72        if (fr[1].isUInt())
73        {
74            unsigned int value=0;
75            fr[1].getUInt(value);
76            es.setClearMask(static_cast<GLbitfield>(value));
77            iteratorAdvanced = true;
78            fr+=2;
79        }
80    }
81
82    return iteratorAdvanced;
83}
84
85
86bool ClearNode_writeLocalData(const Object& obj, Output& fw)
87{
88    const ClearNode& es = static_cast<const ClearNode&>(obj);
89
90    fw.indent() << "requiresClear ";
91    if (es.getRequiresClear())
92    {
93        fw<<"TRUE"<< std::endl;
94    }
95    else
96    {
97        fw<<"FALSE"<< std::endl;
98    }
99
100    fw.indent() << "clearColor "<<es.getClearColor()<< std::endl;
101    fw.indent() << "clearMask "<<static_cast<unsigned int>(es.getClearMask())<< std::endl;
102
103    return true;
104}
Note: See TracBrowser for help on using the browser.