Show
Ignore:
Timestamp:
06/08/07 14:13:33 (8 years ago)
Author:
robert
Message:

Added default file load to avoid the need for command line option.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgdistortion/osgdistortion.cpp

    r6858 r6908  
    3131#include <osgViewer/ViewerEventHandlers> 
    3232 
     33#include <iostream> 
     34 
    3335using namespace osg; 
    3436 
     
    645647    // construct the viewer. 
    646648    osgViewer::Viewer viewer; 
     649 
     650    // load the nodes from the commandline arguments. 
     651    osg::Node* loadedModel = osgDB::readNodeFiles(arguments); 
     652 
     653    // if not loaded assume no arguments passed in, try use default mode instead. 
     654    if (!loadedModel) loadedModel = osgDB::readNodeFile("cessnafire.osg"); 
     655   
     656    if (!loadedModel) 
     657    { 
     658        std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl; 
     659        return 1; 
     660    } 
    647661     
    648662 
     
    652666        setDomeCorrection(viewer, arguments); 
    653667     
    654         viewer.setSceneData( osgDB::readNodeFiles(arguments) ); 
     668        viewer.setSceneData( loadedModel ); 
    655669    } 
    656670    else if (arguments.read("--faces")) 
     
    659673        setDomeFaces(viewer, arguments); 
    660674 
    661         viewer.setSceneData( osgDB::readNodeFiles(arguments) ); 
     675        viewer.setSceneData( loadedModel ); 
    662676    } 
    663677    else 
    664678    { 
    665         osg::Node* distortionNode = createDistortionSubgraph( osgDB::readNodeFiles(arguments), viewer.getCamera()->getClearColor()); 
     679        osg::Node* distortionNode = createDistortionSubgraph( loadedModel, viewer.getCamera()->getClearColor()); 
    666680        viewer.setSceneData( distortionNode ); 
    667681    }