root/OpenSceneGraph/trunk/src/osgWrappers/deprecated-dotosg/osg/TexGenNode.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
  • Property svn:keywords set to Author Date Id Revision
Line 
1#include "osg/TexGenNode"
2
3#include "osgDB/Registry"
4#include "osgDB/Input"
5#include "osgDB/Output"
6
7using namespace osg;
8using namespace osgDB;
9
10// forward declare functions to use later.
11bool TexGenNode_readLocalData(Object& obj, Input& fr);
12bool TexGenNode_writeLocalData(const Object& obj, Output& fw);
13
14// register the read and write functions with the osgDB::Registry.
15REGISTER_DOTOSGWRAPPER(TexGenNode)
16(
17    new osg::TexGenNode,
18    "TexGenNode",
19    "Object Node TexGenNode Group",
20    &TexGenNode_readLocalData,
21    &TexGenNode_writeLocalData
22);
23
24bool TexGenNode_readLocalData(Object& obj, Input& fr)
25{
26    bool iteratorAdvanced = false;
27
28    TexGenNode& texGenNode = static_cast<TexGenNode&>(obj);
29
30    unsigned int textureUnit = 0;
31    if (fr[0].matchWord("TextureUnit") && fr[1].getUInt(textureUnit))
32    {
33
34        texGenNode.setTextureUnit(textureUnit);
35
36        fr+=2;
37        iteratorAdvanced = true;
38    }
39
40
41    osg::ref_ptr<StateAttribute> sa=0;
42    while((sa=fr.readStateAttribute())!=0)
43    {
44        TexGen* texgen = dynamic_cast<TexGen*>(sa.get());
45        if (texgen) texGenNode.setTexGen(texgen);
46        iteratorAdvanced = true;
47    }
48
49    return iteratorAdvanced;
50}
51
52
53bool TexGenNode_writeLocalData(const Object& obj, Output& fw)
54{
55    const TexGenNode& texGenNode = static_cast<const TexGenNode&>(obj);
56
57    fw.indent()<<"TextureUnit "<<texGenNode.getTextureUnit()<<std::endl;
58
59    if (texGenNode.getTexGen())
60    {
61        fw.writeObject(*texGenNode.getTexGen());
62    }
63
64    return true;
65}
Note: See TracBrowser for help on using the browser.