From 416f908f29117b1960e57b27fba86918a80c22e0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 7 Nov 2005 10:29:24 +0000 Subject: [PATCH] From Ruben (with a few addition/changes from Robert), fixed the commandline of the osgsimplifier example. It now reads --ratio and --max-error. --------------------------------------------------- --- examples/osgsimplifier/osgsimplifier.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/examples/osgsimplifier/osgsimplifier.cpp b/examples/osgsimplifier/osgsimplifier.cpp index b7092db49..0bc446c24 100644 --- a/examples/osgsimplifier/osgsimplifier.cpp +++ b/examples/osgsimplifier/osgsimplifier.cpp @@ -68,9 +68,12 @@ int main( int argc, char **argv ) arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the standard OpenSceneGraph example which loads and visualises 3d models."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); + arguments.getApplicationUsage()->addCommandLineOption("--ratio ","Specify the sample ratio","0.5]"); + arguments.getApplicationUsage()->addCommandLineOption("--max-error ","Specify the maximum error","4.0"); float sampleRatio = 0.5f; + float maxError = 4.0f; // construct the viewer. osgProducer::Viewer viewer(arguments); @@ -82,7 +85,8 @@ int main( int argc, char **argv ) viewer.getUsage(*arguments.getApplicationUsage()); // read the sample ratio if one is supplied - while (arguments.read("-s",sampleRatio)) {} + while (arguments.read("--ratio",sampleRatio)) {} + while (arguments.read("--max-error",maxError)) {} // if user request help write it out to cout. if (arguments.read("-h") || arguments.read("--help")) @@ -129,9 +133,7 @@ int main( int argc, char **argv ) std::cout << "Time to load = "<delta_s(start_tick,end_tick)<accept(simplifier); @@ -145,8 +147,8 @@ int main( int argc, char **argv ) viewer.realize(); float multiplier = 0.99f; - float minRatio = 0.00f; - float ratio = 0.5f; + float minRatio = 0.001f; + float ratio = sampleRatio; while( !viewer.done() ) { @@ -168,8 +170,16 @@ int main( int argc, char **argv ) if (ratio root = (osg::Node*)loadedModel->clone(osg::CopyOp::DEEP_COPY_ALL); + root->accept(simplifier); + + std::cout<<"done"<