コード例 #1
0
int
main(int argc, char** argv)
{
    osg::ArgumentParser arguments(&argc,argv);

    // help?
    if ( arguments.read("--help") )
        return usage(argv[0]);

    // create a viewer:
    osgViewer::Viewer viewer(arguments);

    // Tell the database pager to not modify the unref settings
    viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy( false, false );

    // install our default manipulator (do this before calling load)
    viewer.setCameraManipulator( new osgEarth::Util::EarthManipulator() );

    // load an earth file, and support all or our example command-line options
    // and earth file <external> tags    
    osg::Group* node = osgEarth::Util::MapNodeHelper().load(arguments, &viewer, createUI());
    if ( node )
    {        
        viewer.getCamera()->setNearFarRatio(0.00002);
        viewer.getCamera()->setSmallFeatureCullingPixelSize(-1.0f);

        viewer.setSceneData( node );

        s_app.map = MapNode::get( node )->getMap();
        s_app.addTriton();

        return viewer.run();
    }
    else
    {
        return usage(argv[0]);
    }
}
コード例 #2
0
int
main(int argc, char** argv)
{
    osg::ArgumentParser arguments(&argc,argv);

    // help?
    if ( arguments.read("--help") )
        return usage(argv[0]);

    osg::Node* model = 0L;
    std::string filename;
    if (arguments.read("--model", filename))
    {
        model = osgDB::readRefNodeFile(filename).release();
        Registry::shaderGenerator().run(model);
    }

    // create a viewer:
    osgViewer::Viewer viewer(arguments);

    // Tell the database pager to not modify the unref settings
    viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy( false, false );

    // install our default manipulator (do this before calling load)
    EarthManipulator* manip = new EarthManipulator();
    viewer.setCameraManipulator(manip);

    // load an earth file, and support all or our example command-line options
    // and earth file <external> tags    
    osg::Group* node = osgEarth::Util::MapNodeHelper().load(arguments, &viewer, createUI());
    if ( node )
    {        
        viewer.getCamera()->setNearFarRatio(0.00002);
        viewer.getCamera()->setSmallFeatureCullingPixelSize(-1.0f);

        viewer.setSceneData( node );

        s_app.map = MapNode::get( node )->getMap();

        s_app.addTriton();
        s_app.addBuoyancyTest(model);
        
        // Zoom the camera to our area of interest:
        Viewpoint vp;
        vp.heading() = 25.0f;
        vp.pitch() = -25;
        vp.range() = 400.0;
        vp.focalPoint() = s_app.anchor;
        manip->setViewpoint(vp);

        while(!viewer.done())
        {
            viewer.frame();
            s_app.updateBuoyancyTest();
        }
    }
    else
    {
        return usage(argv[0]);
    }
}
コード例 #3
0
 void onValueChanged(ui::Control*, bool value) {
     if (s_app.tritonLayer)
         s_app.removeTriton();
     else
         s_app.addTriton();
 }