root/OpenSceneGraph/trunk/src/osgWrappers/deprecated-dotosg/osgFX/IO_AnisotropicLighting.cpp @ 13041

Revision 13041, 1.7 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 <osgFX/AnisotropicLighting>
2
3#include <osgDB/Registry>
4#include <osgDB/Input>
5#include <osgDB/Output>
6
7bool AnisotropicLighting_readLocalData(osg::Object &obj, osgDB::Input &fr);
8bool AnisotropicLighting_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
9
10REGISTER_DOTOSGWRAPPER(AnisotropicLighting_Proxy)
11(
12    new osgFX::AnisotropicLighting,
13    "osgFX::AnisotropicLighting",
14    "Object Node Group osgFX::Effect osgFX::AnisotropicLighting",
15    AnisotropicLighting_readLocalData,
16    AnisotropicLighting_writeLocalData
17);
18
19bool AnisotropicLighting_readLocalData(osg::Object &obj, osgDB::Input &fr)
20{
21    osgFX::AnisotropicLighting &myobj = static_cast<osgFX::AnisotropicLighting &>(obj);
22    bool itAdvanced = false;
23
24    if (fr[0].matchWord("lightNumber")) {
25        int n;
26        if (fr[1].getInt(n)) {
27            myobj.setLightNumber(n);
28            fr += 2;
29            itAdvanced = true;
30        }
31    }
32
33    if (fr[0].matchWord("lightingMapFileName") && fr[1].isString()) {
34        osg::Image *lmap = fr.readImage(fr[1].getStr());
35        if (lmap) {
36            myobj.setLightingMap(lmap);
37        }
38        fr += 2;
39        itAdvanced = true;
40    }
41
42    return itAdvanced;
43}
44
45bool AnisotropicLighting_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
46{
47    const osgFX::AnisotropicLighting &myobj = static_cast<const osgFX::AnisotropicLighting &>(obj);
48
49    fw.indent() << "lightNumber " << myobj.getLightNumber() << "\n";
50
51    const osg::Image *lmap = myobj.getLightingMap();
52    if (lmap) {
53        if (!lmap->getFileName().empty()) {
54            fw.indent() << "lightingMapFileName \"" << lmap->getFileName() << "\"\n";
55        }
56    }
57
58    return true;
59}
Note: See TracBrowser for help on using the browser.