Exemple #1
0
bool View_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgViewer::View &view = dynamic_cast<const osgViewer::View&>(obj);

    osg::notify(osg::NOTICE) << "View_writeLocalData" << std::endl;

    if (view.getCamera())
    {
        fw.writeObject(*view.getCamera());
    }

    if (view.getNumSlaves() != 0)
    {
        fw.indent() << "Slaves {" << std::endl;
        fw.moveIn();

        for (unsigned int i = 0; i < view.getNumSlaves(); ++i)
        {
            const osg::Camera *camera = view.getSlave(i)._camera.get();
            if (camera)
            {
                fw.writeObject(*camera);
            }
        }

        fw.moveOut();
        fw.indent() << "}" << std::endl;
    }

    return true;
}
bool VolumeTile_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
{
    const osgVolume::VolumeTile& volumeTile = static_cast<const osgVolume::VolumeTile&>(obj);

    int prec = fw.precision();
    fw.precision(15);

    if (volumeTile.getLocator())
    {
        fw.writeObject(*volumeTile.getLocator());
    }

    if (volumeTile.getLayer())
    {
        fw.writeObject(*volumeTile.getLayer());
    }

    if (volumeTile.getVolumeTechnique())
    {
        fw.writeObject(*volumeTile.getVolumeTechnique());
    }    

    fw.precision(prec);
    
    return true;
}
bool ParticleEffect_writeLocalData(const osg::Object& object, osgDB::Output& fw)
{
    const osgParticle::ParticleEffect& effect = static_cast<const osgParticle::ParticleEffect&>(object);
    fw.indent()<<"textFileName "<<fw.wrapString(effect.getTextureFileName())<<std::endl;
    fw.indent()<<"position "<<effect.getPosition()<<std::endl;
    fw.indent()<<"scale "<<effect.getScale()<<std::endl;
    fw.indent()<<"intensity "<<effect.getIntensity()<<std::endl;
    fw.indent()<<"startTime "<<effect.getStartTime()<<std::endl;
    fw.indent()<<"emitterDuration "<<effect.getEmitterDuration()<<std::endl;
    fw.indent()<<"particleDuration "<<effect.getParticleDuration()<<std::endl;

    osgParticle::rangef rf = effect.getDefaultParticleTemplate().getSizeRange();
    fw.indent() << "particleSizeRange " << rf.minimum << " " << rf.maximum << std::endl;

    rf = effect.getDefaultParticleTemplate().getAlphaRange();
    fw.indent() << "particleAlphaRange " << rf.minimum << " " << rf.maximum << std::endl;

    osgParticle::rangev4 rv4 = effect.getDefaultParticleTemplate().getColorRange();
    fw.indent() << "particleColorRange ";
    fw << rv4.minimum.x() << " " << rv4.minimum.y() << " " << rv4.minimum.z() << " " << rv4.minimum.w() << " ";
    fw << rv4.maximum.x() << " " << rv4.maximum.y() << " " << rv4.maximum.z() << " " << rv4.maximum.w() << std::endl;

    fw.indent()<<"wind "<<effect.getWind()<<std::endl;

    fw.indent()<<"useLocalParticleSystem ";
    if (effect.getUseLocalParticleSystem()) fw<<"TRUE"<<std::endl;
    else
    {
        fw<<"FALSE"<<std::endl;
        fw.writeObject(*effect.getParticleSystem());
    }

    return true;
}
Exemple #4
0
bool Layer_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgVolume::Layer &layer = static_cast<const osgVolume::Layer&>(obj);

    if (layer.getLocator())
    {
        fw.writeObject(*layer.getLocator());
    }

    if (layer.getProperty())
    {
        fw.writeObject(*layer.getProperty());
    }

    return true;
}
Exemple #5
0
bool CompositeLayer_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
{
    const osgTerrain::CompositeLayer& layer = static_cast<const osgTerrain::CompositeLayer&>(obj);

    for(unsigned int i=0; i<layer.getNumLayers();++i)
    {
        if (layer.getLayer(i))
        {
            const osgTerrain::ProxyLayer* proxyLayer = dynamic_cast<const osgTerrain::ProxyLayer*>(layer.getLayer(i));
            if (proxyLayer)
            {
                if (!proxyLayer->getFileName().empty())
                {
                    const osgTerrain::Locator* locator = proxyLayer->getLocator();
                    if (locator && !locator->getDefinedInFile())
                    {
                        fw.writeObject(*locator);
                    }

                    if (proxyLayer->getMinLevel()!=0)
                    {
                        fw.indent()<<"MinLevel "<<proxyLayer->getMinLevel()<<std::endl;
                    }

                    if (proxyLayer->getMaxLevel()!=MAXIMUM_NUMBER_OF_LEVELS)
                    {
                        fw.indent()<<"MaxLevel "<<proxyLayer->getMaxLevel()<<std::endl;
                    }

                    fw.indent()<<"ProxyLayer "<<proxyLayer->getCompoundName()<<std::endl;
                }
            }
            else
            {
                fw.writeObject(*(layer.getLayer(i)));
            }
        }
        else if (!layer.getFileName(i).empty())
        {
            fw.indent()<<"file "<<layer.getCompoundName(i)<<std::endl;
        }
    }



    return true;
}
bool TransferFunctionProperty_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
{
    const osgVolume::TransferFunctionProperty& tfp = static_cast<const osgVolume::TransferFunctionProperty&>(obj);

    const osg::TransferFunction* tf = tfp.getTransferFunction();
    if (tf) fw.writeObject(*tf);

    return true;
}
Exemple #7
0
bool BumpMapping_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgFX::BumpMapping &myobj = static_cast<const osgFX::BumpMapping &>(obj);

    fw.indent() << "lightNumber " << myobj.getLightNumber() << "\n";
    fw.indent() << "diffuseUnit " << myobj.getDiffuseTextureUnit() << "\n";
    fw.indent() << "normalMapUnit " << myobj.getNormalMapTextureUnit() << "\n";

    if (myobj.getOverrideDiffuseTexture()) {
        fw.writeObject(*myobj.getOverrideDiffuseTexture());
    }

    if (myobj.getOverrideNormalMapTexture()) {
        fw.writeObject(*myobj.getOverrideNormalMapTexture());
    }
    
    return true;
}
bool ModularProgram_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgParticle::ModularProgram &myobj = static_cast<const osgParticle::ModularProgram &>(obj);

    for (int i=0; i<myobj.numOperators(); ++i) {
        fw.writeObject(*myobj.getOperator(i));
    }

    return true;
}
bool ShadowedScene_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
{
    const osgShadow::ShadowedScene& ss = static_cast<const osgShadow::ShadowedScene &>(obj);
    
    if (ss.getShadowTechnique())
    {
        fw.writeObject(*ss.getShadowTechnique());
    }

    return true;
}
bool DatabaseBuilder_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
{
    const vpb::DatabaseBuilder& db = static_cast<const vpb::DatabaseBuilder&>(obj);

    if (db.getBuildOptions())
    {
        fw.writeObject(*db.getBuildOptions());
    }


    return true;
}
bool CompositeProperty_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
{
    const osgVolume::CompositeProperty& cp = static_cast<const osgVolume::CompositeProperty&>(obj);


    for(unsigned int i=0; i<cp.getNumProperties(); ++i)
    {
        fw.writeObject(*cp.getProperty(i));
    }

    return true;
}
Exemple #12
0
bool NodeCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const NodeCallback* nc = dynamic_cast<const NodeCallback*>(&obj);
    if (!nc) return false;

    NodeCallback* nnc = (NodeCallback*) nc;

    if (nnc->getNestedCallback())
    {
        fw.writeObject(*(nnc->getNestedCallback()));
    }

    return true;
}
Exemple #13
0
bool AnimationPathCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{


    const osg::AnimationPathCallback* apc = dynamic_cast<const osg::AnimationPathCallback*>(&obj);
    if (!apc) return false;


    fw.indent() <<"pivotPoint " <<apc->getPivotPoint()<<std::endl;
    fw.indent() <<"timeOffset " <<apc->_timeOffset<<std::endl;
    fw.indent() <<"timeMultiplier " <<apc->_timeMultiplier << std::endl;

    if (apc->getAnimationPath())
    {
        fw.writeObject(*(apc->getAnimationPath()));
    }

    return true;
}
Exemple #14
0
bool HeightFieldLayer_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
{
    const osgTerrain::HeightFieldLayer& layer = static_cast<const osgTerrain::HeightFieldLayer&>(obj);

    if (!layer.getFileName().empty())
    {
        std::string str = osgTerrain::createCompoundSetNameAndFileName(layer.getName(), layer.getFileName());
        fw.indent()<<"file "<< str << std::endl;
    }
    else
    {
        if (layer.getHeightField())
        {
            fw.writeObject(*layer.getHeightField());
        }
    }

    return true;
}
bool ParticleProcessor_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgParticle::ParticleProcessor &myobj = static_cast<const osgParticle::ParticleProcessor &>(obj);

    if (myobj.getParticleSystem()) fw.writeObject(*myobj.getParticleSystem());

    fw.indent() << "enabled ";
    if (myobj.isEnabled()) 
        fw << "TRUE" << std::endl;
    else
        fw << "FALSE" << std::endl;

    fw.indent() << "referenceFrame ";
    switch (myobj.getReferenceFrame())
    {
    case osgParticle::ParticleProcessor::ABSOLUTE_RF:
        fw << "ABSOLUTE" << std::endl;
        break;
    case osgParticle::ParticleProcessor::RELATIVE_RF:
    default:
        fw << "RELATIVE" << std::endl;
    }

    fw.indent() << "endless ";
    if (myobj.isEndless())
        fw << "TRUE" << std::endl;
    else
        fw << "FALSE" << std::endl;

    fw.indent() << "lifeTime " << myobj.getLifeTime() << std::endl;
    fw.indent() << "startTime " << myobj.getStartTime() << std::endl;
    fw.indent() << "currentTime " << myobj.getCurrentTime() << std::endl;
    fw.indent() << "resetTime " << myobj.getResetTime() << std::endl;

    return true;
}