Exemplo n.º 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;
}
Exemplo n.º 2
0
bool Cartoon_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgFX::Cartoon &myobj = static_cast<const osgFX::Cartoon &>(obj);

    fw.indent() << "lightNumber " << myobj.getLightNumber() << "\n";
    fw.indent() << "outlineColor " << myobj.getOutlineColor() << "\n";
    fw.indent() << "outlineLineWidth " << myobj.getOutlineLineWidth() << "\n";

    return true;
}
Exemplo n.º 3
0
bool Text3D_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgText::Text3D &text = static_cast<const osgText::Text3D &>(obj);

    fw.indent() << "characterDepth " << text.getCharacterDepth() << std::endl;

    fw.indent() << "renderMode " << convertRenderModeEnumToString(text.getRenderMode()) << std::endl;

    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;
}
bool FluidFrictionOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgParticle::FluidFrictionOperator &aop = static_cast<const osgParticle::FluidFrictionOperator &>(obj);
    fw.indent() << "fluidDensity " << aop.getFluidDensity() << std::endl;
    fw.indent() << "fluidViscosity " << aop.getFluidViscosity() << std::endl;
    fw.indent() << "overrideRadius " << aop.getOverrideRadius() << std::endl;
    
    osg::Vec3 w = aop.getWind();
    fw.indent() << "wind " << w << std::endl;
    return true;
}
Exemplo n.º 6
0
bool SegmentPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgParticle::SegmentPlacer &myobj = static_cast<const osgParticle::SegmentPlacer &>(obj);

    osg::Vec3 v = myobj.getVertexA();
    fw.indent() << "vertex_A " << v.x() << " " << v.y() << " " << v.z() << std::endl;
    v = myobj.getVertexB();
    fw.indent() << "vertex_B " << v.x() << " " << v.y() << " " << v.z() << std::endl;

    return true;
}
Exemplo n.º 7
0
bool OrbitOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgParticle::OrbitOperator &op = static_cast<const osgParticle::OrbitOperator &>(obj);
    osg::Vec3 a = op.getCenter();
    fw.indent() << "center " << a.x() << " " << a.y() << " " << a.z() << std::endl;
    
    fw.indent() << "magnitude " << op.getMagnitude() << std::endl;
    fw.indent() << "epsilon " << op.getEpsilon() << std::endl;
    fw.indent() << "maxRadius " << op.getMaxRadius() << std::endl;
    return true;
}
Exemplo n.º 8
0
bool ParticleSystem_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgParticle::ParticleSystem &myobj = static_cast<const osgParticle::ParticleSystem &>(obj);

    fw.indent() << "particleAlignment ";
    switch (myobj.getParticleAlignment()) {
        default:
        case osgParticle::ParticleSystem::BILLBOARD:
            fw << "BILLBOARD" << std::endl;
            break;
        case osgParticle::ParticleSystem::FIXED:
            fw << "FIXED" << std::endl;
            break;
    }

    fw.indent() << "particleScaleReferenceFrame ";
    switch (myobj.getParticleScaleReferenceFrame()) {
        default:
        case osgParticle::ParticleSystem::LOCAL_COORDINATES:
            fw << "LOCAL_COORDINATES" << std::endl;
            break;
        case osgParticle::ParticleSystem::WORLD_COORDINATES:
            fw << "WORLD_COORDINATES" << std::endl;
            break;
    }

    osg::Vec3 v = myobj.getAlignVectorX();
    fw.indent() << "alignVectorX " << v.x() << " " << v.y() << " " << v.z() << std::endl;
    v = myobj.getAlignVectorY();
    fw.indent() << "alignVectorY " << v.x() << " " << v.y() << " " << v.z() << std::endl;

    fw.indent() << "doublePassRendering ";
    if (myobj.getDoublePassRendering())
        fw << "TRUE" << std::endl;
    else
        fw << "FALSE" << std::endl;
        
    fw.indent() << "frozen ";
    if (myobj.isFrozen()) 
        fw << "TRUE" << std::endl;
    else
        fw << "FALSE" << std::endl;

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

    osg::BoundingBox bbox = myobj.getDefaultBoundingBox();    
    fw.indent() << "defaultBoundingBox ";
    fw << bbox.xMin() << " " << bbox.yMin() << " " << bbox.zMin() << " ";
    fw << bbox.xMax() << " " << bbox.yMax() << " " << bbox.zMax() << std::endl;

    fw.indent() << "particleTemplate ";
    write_particle(myobj.getDefaultParticleTemplate(), fw);

    return true;
}
Exemplo n.º 9
0
bool SpecularHighlights_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgFX::SpecularHighlights &myobj = static_cast<const osgFX::SpecularHighlights &>(obj);

    fw.indent() << "lightNumber " << myobj.getLightNumber() << "\n";
    fw.indent() << "textureUnit " << myobj.getTextureUnit() << "\n";
    fw.indent() << "specularColor " << myobj.getSpecularColor() << "\n";
    fw.indent() << "specularExponent " << myobj.getSpecularExponent() << "\n";

    return true;
}
Exemplo n.º 10
0
static bool writeMatrix(const osg::Matrix &matrix, osgDB::Output &fw, const char *keyword)
{
    fw.indent() << keyword << " {" << std::endl;
    fw.moveIn();
    fw.indent() << matrix(0, 0) << " " << matrix(0, 1) << " " << matrix(0, 2) << " " << matrix(0, 3) << std::endl;
    fw.indent() << matrix(1, 0) << " " << matrix(1, 1) << " " << matrix(1, 2) << " " << matrix(1, 3) << std::endl;
    fw.indent() << matrix(2, 0) << " " << matrix(2, 1) << " " << matrix(2, 2) << " " << matrix(2, 3) << std::endl;
    fw.indent() << matrix(3, 0) << " " << matrix(3, 1) << " " << matrix(3, 2) << " " << matrix(3, 3) << std::endl;
    fw.moveOut();
    fw.indent() << "}" << std::endl;
    return true;
}
Exemplo n.º 11
0
bool ConeSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgSim::ConeSector &sector = static_cast<const osgSim::ConeSector &>(obj);

    const osg::Vec3& axis = sector.getAxis();
    fw.indent()<<"axis "<<axis<<std::endl;

    float angle = sector.getAngle();
    float fadeangle = sector.getFadeAngle();
    fw.indent()<<"angle "<<angle<<" "<<fadeangle<<std::endl;
    return true;
}
Exemplo n.º 12
0
bool SectorPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgParticle::SectorPlacer &myobj = static_cast<const osgParticle::SectorPlacer &>(obj);

    osgParticle::rangef r;
    
    r = myobj.getRadiusRange();
    fw.indent() << "radiusRange " << r.minimum << " " << r.maximum << std::endl;
    r = myobj.getPhiRange();
    fw.indent() << "phiRange " << r.minimum << " " << r.maximum << std::endl;

    return true;
}
bool ObjectRecordData_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgSim::ObjectRecordData &ord = static_cast<const osgSim::ObjectRecordData&>(obj);

    fw.indent() << "flags " << ord._flags << std::endl;
    fw.indent() << "relativePriority " << ord._relativePriority << std::endl;
    fw.indent() << "transparency " << ord._transparency << std::endl;
    fw.indent() << "effectID1 " << ord._effectID1 << std::endl;
    fw.indent() << "effectID2 " << ord._effectID2 << std::endl;
    fw.indent() << "significance " << ord._significance << std::endl;

    return true;
}
Exemplo n.º 14
0
bool ExplosionOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgParticle::ExplosionOperator &ep = static_cast<const osgParticle::ExplosionOperator&>(obj);
    osg::Vec3                            a   = ep.getCenter();

    fw.indent() << "center " << a.x() << " " << a.y() << " " << a.z() << std::endl;

    fw.indent() << "radius " <<    ep.getRadius() << std::endl;
    fw.indent() << "magnitude " << ep.getMagnitude() << std::endl;
    fw.indent() << "epsilon " <<   ep.getEpsilon() << std::endl;
    fw.indent() << "sigma " <<     ep.getSigma() << std::endl;
    return true;
}
Exemplo n.º 15
0
bool DirectionalSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgSim::DirectionalSector &sector = static_cast<const osgSim::DirectionalSector &>(obj);

    const osg::Vec3& axis = sector.getDirection();
    fw.indent()<<"direction "<<axis<<std::endl;

    float horizangle = sector.getHorizLobeAngle();
    float vertangle = sector.getVertLobeAngle();
    float rollangle = sector.getLobeRollAngle();
    float fadeangle = sector.getFadeAngle();
    fw.indent()<<"angles "<<horizangle<<" "<<vertangle<<" "<<rollangle<<" "<<fadeangle<<std::endl;
    return true;
}
Exemplo n.º 16
0
bool AnisotropicLighting_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgFX::AnisotropicLighting &myobj = static_cast<const osgFX::AnisotropicLighting &>(obj);

    fw.indent() << "lightNumber " << myobj.getLightNumber() << "\n";
    
    const osg::Image *lmap = myobj.getLightingMap();
    if (lmap) {
        if (!lmap->getFileName().empty()) {
            fw.indent() << "lightingMapFileName \"" << lmap->getFileName() << "\"\n";
        }
    }

    return true;
}
Exemplo n.º 17
0
bool BoxPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgParticle::BoxPlacer &myobj = static_cast<const osgParticle::BoxPlacer &>(obj);

    osgParticle::rangef r;

    r = myobj.getXRange();
    fw.indent() << "xRange " << r.minimum << " " << r.maximum << std::endl;
    r = myobj.getYRange();
    fw.indent() << "yRange " << r.minimum << " " << r.maximum << std::endl;
    r = myobj.getZRange();
    fw.indent() << "zRange " << r.minimum << " " << r.maximum << std::endl;

    return true;
}
Exemplo n.º 18
0
bool AzimElevationSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{

    const osgSim::AzimElevationSector &sector = static_cast<const osgSim::AzimElevationSector &>(obj);

    float minElevation = sector.getMinElevation();
    float maxElevation = sector.getMaxElevation();
    float fadeAngle = sector.getFadeAngle();
    fw.indent()<<"elevationRange "<<minElevation<< " "<<maxElevation<< " "<<fadeAngle<<std::endl;

    float minAzimuth, maxAzimuth;
    sector.getAzimuthRange(minAzimuth, maxAzimuth, fadeAngle);
    fw.indent()<<"azimuthRange "<<minAzimuth<< " "<<maxAzimuth<< " "<<fadeAngle<<std::endl;
    return true;
}
Exemplo n.º 19
0
bool Emitter_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgParticle::Emitter &myobj = static_cast<const osgParticle::Emitter &>(obj);

    fw.indent() << "useDefaultTemplate ";
    if (!myobj.getUseDefaultTemplate()) {
        fw << "FALSE" << std::endl;
        fw.indent() << "particleTemplate ";
        write_particle(myobj.getParticleTemplate(), fw);
        fw << std::endl;
    } else {
        fw << "TRUE" << std::endl;
    }

    return true;
}
Exemplo n.º 20
0
bool Creation_writeLocalData( const osg::Object& obj, osgDB::Output& fw )
{
    const osgbDynamics::CreationRecord& cr = static_cast< const osgbDynamics::CreationRecord& >( obj );

    fw.indent() << "Version " << 1 << std::endl;
    fw.indent() << "COM " << cr._com << std::endl;
    fw.indent() << "Use COM " << std::boolalpha << cr._comSet << std::endl;
    fw.indent() << "Scale " << cr._scale << std::endl;
    fw.indent() << "Collision shape " << (unsigned int)( cr._shapeType ) << std::endl;
    fw.indent() << "Mass " << cr._mass << std::endl;
    fw.indent() << "Cylinder axis " << cr._axis << std::endl;
    fw.indent() << "Reduction level " << cr._reductionLevel << std::endl;
    fw.indent() << "Overall " << std::boolalpha << cr._overall << std::endl;

    return( true );
}
Exemplo n.º 21
0
bool Locator_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
{
    const osgVolume::Locator& locator = static_cast<const osgVolume::Locator&>(obj);

    const osg::Matrixd& matrix = locator.getTransform();
    fw.indent() << "Transform {" << std::endl;
    fw.moveIn();
    fw.indent() << matrix(0,0) << " " << matrix(0,1) << " " << matrix(0,2) << " " << matrix(0,3) << std::endl;
    fw.indent() << matrix(1,0) << " " << matrix(1,1) << " " << matrix(1,2) << " " << matrix(1,3) << std::endl;
    fw.indent() << matrix(2,0) << " " << matrix(2,1) << " " << matrix(2,2) << " " << matrix(2,3) << std::endl;
    fw.indent() << matrix(3,0) << " " << matrix(3,1) << " " << matrix(3,2) << " " << matrix(3,3) << std::endl;
    fw.moveOut();
    fw.indent() << "}"<< std::endl;

    return true;
}
Exemplo n.º 22
0
bool osgWidget_Box_writeData(const osg::Object& obj, osgDB::Output& fw) {
	const osgWidget::Box& model = static_cast<const osgWidget::Box&>(obj);
	
	fw.indent() << fw.wrapString("Box stuff...") << std::endl;

	return true;
}
Exemplo n.º 23
0
bool EphemerisModel_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
{
    const osgEphemeris::EphemerisModel &em = static_cast<const osgEphemeris::EphemerisModel &>(obj);
    fw.indent() << "Latitude " << em.getLatitude() << std::endl;
    fw.indent() << "Longitude " << em.getLongitude() << std::endl;
    fw.indent() << "SkyDomeRadius " << em.getSkyDomeRadius() << std::endl;
    fw.indent() << "AutoDateTime " << (em.getAutoDateTime()?"True":"False") << std::endl;
    fw.indent() << "MoveWithEyePoint " << (em.getMoveWithEyePoint()?"True":"False") << std::endl;
    fw.indent() << "SunLightNumber " << em.getSunLightNum() << std::endl;

    const osgEphemeris::EphemerisUpdateCallback *updateCallback = em.getEphemerisUpdateCallback();
    if( updateCallback != 0L )
        fw.indent() << "UpdateCallback " << updateCallback->getName() << std::endl;

    return true;
}
Exemplo n.º 24
0
bool AccelOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgParticle::AccelOperator &aop = static_cast<const osgParticle::AccelOperator &>(obj);
    osg::Vec3 a = aop.getAcceleration();
    fw.indent() << "acceleration " << a.x() << " " << a.y() << " " << a.z() << std::endl;
    return true;
}
Exemplo n.º 25
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;
}
Exemplo n.º 26
0
bool osgWidget_WindowManager_writeData(const osg::Object& /*obj*/, osgDB::Output& fw)
{
	// const osgWidget::WindowManager& model = static_cast<const osgWidget::WindowManager&>(obj);
	
	fw.indent() << fw.wrapString("WindowManager stuff...") << std::endl;

	return true;
}
bool ClusterCullingCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const ClusterCullingCallback* ccc = dynamic_cast<const ClusterCullingCallback*>(&obj);
    if (!ccc) return false; 

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

    fw.indent() << "controlPoint " << ccc->getControlPoint() << std::endl;
    fw.indent() << "normal " << ccc->getNormal() << std::endl;
    fw.indent() << "radius " << ccc->getRadius() << std::endl;
    fw.indent() << "deviation " << ccc->getDeviation() << std::endl;
 
    fw.precision(prec);

    return true;
}
Exemplo n.º 28
0
bool SwitchLayer_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
    const osgTerrain::SwitchLayer &layer = static_cast<const osgTerrain::SwitchLayer&>(obj);

    fw.indent() << "ActiveLayer " << layer.getActiveLayer() << std::endl;

    return true;
}
Exemplo n.º 29
0
bool ScalarProperty_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
{
    const osgVolume::ScalarProperty& sp = static_cast<const osgVolume::ScalarProperty&>(obj);

    fw.indent()<<"value "<<sp.getValue()<<std::endl;

    return true;
}
Exemplo n.º 30
0
bool osgWidget_NullWidget_writeData(const osg::Object& /*obj*/, osgDB::Output &fw)
{
    // const osgWidget::NullWidget& model = static_cast<const osgWidget::NullWidget&>(obj);

    fw.indent() << fw.wrapString("NullWidget stuff...") << std::endl;

    return true;
}