1 #include <osg/BlendColor>
2 #include <osg/io_utils>
3 
4 #include <osgDB/Registry>
5 #include <osgDB/Input>
6 #include <osgDB/Output>
7 
8 using namespace osg;
9 using namespace osgDB;
10 
11 // forward declare functions to use later.
12 bool BlendColor_readLocalData(Object& obj, Input& fr);
13 bool BlendColor_writeLocalData(const Object& obj, Output& fw);
14 
15 // register the read and write functions with the osgDB::Registry.
16 
17 REGISTER_DOTOSGWRAPPER(BlendColor)
18 (
19     new osg::BlendColor,
20     "BlendColor",
21     "Object StateAttribute BlendColor",
22     &BlendColor_readLocalData,
23     &BlendColor_writeLocalData
24 );
25 
BlendColor_readLocalData(Object & obj,Input & fr)26 bool BlendColor_readLocalData(Object& obj, Input& fr)
27 {
28     bool iteratorAdvanced = false;
29 
30     BlendColor& bc = static_cast<BlendColor&>(obj);
31 
32     if (fr.matchSequence("constantColor %f %f %f %f"))
33     {
34         osg::Vec4 color;
35         fr[1].getFloat(color[0]);
36         fr[2].getFloat(color[1]);
37         fr[3].getFloat(color[2]);
38         fr[4].getFloat(color[3]);
39 
40         bc.setConstantColor(color);
41         fr+=5;
42         iteratorAdvanced = true;
43     }
44 
45     return iteratorAdvanced;
46 }
47 
BlendColor_writeLocalData(const Object & obj,Output & fw)48 bool BlendColor_writeLocalData(const Object& obj, Output& fw)
49 {
50     const BlendColor& bc = static_cast<const BlendColor&>(obj);
51 
52     fw.indent() << "constantColor " << bc.getConstantColor() << std::endl;
53 
54     return true;
55 }
56 
57 
58