Show
Ignore:
Timestamp:
11/07/05 11:29:24 (8 years ago)
Author:
robert
Message:

From Ruben (with a few addition/changes from Robert), fixed the commandline of the osgsimplifier example. It now reads
--ratio and --max-error.


Files:
1 modified

Legend:

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

    r4552 r4685  
    6969    arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); 
    7070    arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 
     71    arguments.getApplicationUsage()->addCommandLineOption("--ratio <ratio>","Specify the sample ratio","0.5]"); 
     72    arguments.getApplicationUsage()->addCommandLineOption("--max-error <error>","Specify the maximum error","4.0"); 
    7173     
    7274 
    7375    float sampleRatio = 0.5f; 
     76    float maxError = 4.0f; 
    7477 
    7578    // construct the viewer. 
     
    8386 
    8487    // read the sample ratio if one is supplied 
    85     while (arguments.read("-s",sampleRatio)) {} 
     88    while (arguments.read("--ratio",sampleRatio)) {} 
     89    while (arguments.read("--max-error",maxError)) {} 
    8690 
    8791    // if user request help write it out to cout. 
     
    130134    std::cout << "Time to load = "<<osg::Timer::instance()->delta_s(start_tick,end_tick)<<std::endl; 
    131135 
    132     osgUtil::Simplifier simplifier(sampleRatio); 
    133     simplifier.setSampleRatio(1.0f); 
    134     simplifier.setMaximumError(0.4f); 
     136    osgUtil::Simplifier simplifier(sampleRatio, maxError); 
    135137     
    136138    //loadedModel->accept(simplifier); 
     
    146148 
    147149    float multiplier = 0.99f; 
    148     float minRatio = 0.00f; 
    149     float ratio = 0.5f; 
     150    float minRatio = 0.001f; 
     151    float ratio = sampleRatio; 
    150152 
    151153    while( !viewer.done() ) 
     
    169171             
    170172            simplifier.setSampleRatio(ratio); 
     173 
     174            std::cout<<"Runing osgUtil::Simplifier with SampleRatio="<<ratio<<" maxError="<<maxError<<" ..."; 
     175            std::cout.flush(); 
     176             
    171177            osg::ref_ptr<osg::Node> root = (osg::Node*)loadedModel->clone(osg::CopyOp::DEEP_COPY_ALL); 
     178 
    172179            root->accept(simplifier); 
     180             
     181            std::cout<<"done"<<std::endl; 
     182             
    173183            viewer.setSceneData(root.get()); 
    174184            keyFlag = 0;