Esempio n. 1
0
bool AnisotropicLighting_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
    osgFX::AnisotropicLighting &myobj = static_cast<osgFX::AnisotropicLighting &>(obj);
    bool itAdvanced = false;

    if (fr[0].matchWord("lightNumber")) {
        int n;
        if (fr[1].getInt(n)) {
            myobj.setLightNumber(n);
            fr += 2;
            itAdvanced = true;
        }
    }

    if (fr[0].matchWord("lightingMapFileName") && fr[1].isString()) {
        osg::Image *lmap = fr.readImage(fr[1].getStr());
        if (lmap) {
            myobj.setLightingMap(lmap);
        }
        fr += 2;
        itAdvanced = true;
    }

    return itAdvanced;
}
Esempio n. 2
0
bool ImageLayer_readLocalData(osg::Object& obj, osgDB::Input &fr)
{
    osgTerrain::ImageLayer& layer = static_cast<osgTerrain::ImageLayer&>(obj);

    bool itrAdvanced = false;

    if (fr.matchSequence("file %w") || fr.matchSequence("file %s"))
    {
        std::string filename = fr[1].getStr();
        if (!filename.empty())
        {
            bool deferExternalLayerLoading = osgTerrain::TerrainTile::getTileLoadedCallback().valid() ?
                osgTerrain::TerrainTile::getTileLoadedCallback()->deferExternalLayerLoading() : false;

            layer.setFileName(filename);

            if (!deferExternalLayerLoading)
            {
                osg::ref_ptr<osg::Image> image = fr.readImage(filename.c_str());
                if (image.valid())
                {
                    layer.setImage(image.get());
                }
            }
        }

        fr += 2;
        itrAdvanced = true;
    }


    return itrAdvanced;
}