From 1d94826b403343a85a5e6f2b0e4b6d1e6ae16a0f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 16 Mar 2005 14:14:12 +0000 Subject: [PATCH] Added --smooth option to osgconv --- applications/osgconv/osgconv.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/applications/osgconv/osgconv.cpp b/applications/osgconv/osgconv.cpp index 0cdd2b793..4991338dd 100644 --- a/applications/osgconv/osgconv.cpp +++ b/applications/osgconv/osgconv.cpp @@ -17,6 +17,7 @@ #include #include +#include #include @@ -409,6 +410,8 @@ static void usage( const char *prog, const char *msg ) " where SX, SY, and SZ represent the scale factors\n" " Caution: Scaling will be done in destination orientation\n" << std::endl; + osg::notify(osg::NOTICE)<<" --smooth - Smooth the surface by regenerating surface normals on\n" + " all geometry"<< std::endl; } @@ -539,6 +542,10 @@ int main( int argc, char **argv ) while(arguments.read("--compressed-dxt3")) { internalFormatMode = osg::Texture::USE_S3TC_DXT3_COMPRESSION; } while(arguments.read("--compressed-dxt5")) { internalFormatMode = osg::Texture::USE_S3TC_DXT5_COMPRESSION; } + bool smooth = false; + while(arguments.read("--smooth")) { smooth = true; } + + // any option left unread are converted into errors to write out later. arguments.reportRemainingOptionsAsUnrecognized(); @@ -583,7 +590,13 @@ int main( int argc, char **argv ) { // convert the old style GeoSet to Geometry ConvertGeoSetsToGeometryVisitor cgtg; - if( root.valid() ) root->accept(cgtg); + root->accept(cgtg); + + if (smooth) + { + osgUtil::SmoothingVisitor sv; + root->accept(sv); + } // optimize the scene graph, remove rendundent nodes and state etc. osgUtil::Optimizer optimizer;