Added --smooth option to osgconv
This commit is contained in:
parent
d7ddecbb40
commit
1d94826b40
@ -17,6 +17,7 @@
|
|||||||
#include <osgDB/ReaderWriter>
|
#include <osgDB/ReaderWriter>
|
||||||
|
|
||||||
#include <osgUtil/Optimizer>
|
#include <osgUtil/Optimizer>
|
||||||
|
#include <osgUtil/SmoothingVisitor>
|
||||||
|
|
||||||
#include <osgProducer/Viewer>
|
#include <osgProducer/Viewer>
|
||||||
|
|
||||||
@ -409,6 +410,8 @@ static void usage( const char *prog, const char *msg )
|
|||||||
" where SX, SY, and SZ represent the scale factors\n"
|
" where SX, SY, and SZ represent the scale factors\n"
|
||||||
" Caution: Scaling will be done in destination orientation\n"
|
" Caution: Scaling will be done in destination orientation\n"
|
||||||
<< std::endl;
|
<< 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-dxt3")) { internalFormatMode = osg::Texture::USE_S3TC_DXT3_COMPRESSION; }
|
||||||
while(arguments.read("--compressed-dxt5")) { internalFormatMode = osg::Texture::USE_S3TC_DXT5_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.
|
// any option left unread are converted into errors to write out later.
|
||||||
arguments.reportRemainingOptionsAsUnrecognized();
|
arguments.reportRemainingOptionsAsUnrecognized();
|
||||||
|
|
||||||
@ -583,7 +590,13 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
// convert the old style GeoSet to Geometry
|
// convert the old style GeoSet to Geometry
|
||||||
ConvertGeoSetsToGeometryVisitor cgtg;
|
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.
|
// optimize the scene graph, remove rendundent nodes and state etc.
|
||||||
osgUtil::Optimizer optimizer;
|
osgUtil::Optimizer optimizer;
|
||||||
|
Loading…
Reference in New Issue
Block a user