optimizer: run MERGE_GEOMETRY after removing redundant nodes

coverity_scan^2
scrawl 8 years ago
parent 43f31d6e54
commit ebfd845eae

@ -485,7 +485,7 @@ namespace Resource
SceneUtil::Optimizer optimizer;
optimizer.setIsOperationPermissibleForObjectCallback(new CanOptimizeCallback);
optimizer.optimize(loaded, SceneUtil::Optimizer::FLATTEN_STATIC_TRANSFORMS|SceneUtil::Optimizer::REMOVE_REDUNDANT_NODES); //MERGE_GEOMETRY
optimizer.optimize(loaded, SceneUtil::Optimizer::FLATTEN_STATIC_TRANSFORMS|SceneUtil::Optimizer::REMOVE_REDUNDANT_NODES|SceneUtil::Optimizer::MERGE_GEOMETRY);
}
if (mIncrementalCompileOperation)

@ -82,21 +82,6 @@ void Optimizer::optimize(osg::Node* node, unsigned int options)
cstv.removeTransforms(node);
}
if (options & MERGE_GEOMETRY)
{
OSG_INFO<<"Optimizer::optimize() doing MERGE_GEOMETRY"<<std::endl;
osg::Timer_t startTick = osg::Timer::instance()->tick();
MergeGeometryVisitor mgv(this);
mgv.setTargetMaximumNumberOfVertices(10000);
node->accept(mgv);
osg::Timer_t endTick = osg::Timer::instance()->tick();
OSG_INFO<<"MERGE_GEOMETRY took "<<osg::Timer::instance()->delta_s(startTick,endTick)<<std::endl;
}
if (options & REMOVE_REDUNDANT_NODES)
{
OSG_INFO<<"Optimizer::optimize() doing REMOVE_REDUNDANT_NODES"<<std::endl;
@ -113,6 +98,21 @@ void Optimizer::optimize(osg::Node* node, unsigned int options)
node->accept(mgrp);
}
if (options & MERGE_GEOMETRY)
{
OSG_INFO<<"Optimizer::optimize() doing MERGE_GEOMETRY"<<std::endl;
osg::Timer_t startTick = osg::Timer::instance()->tick();
MergeGeometryVisitor mgv(this);
mgv.setTargetMaximumNumberOfVertices(10000);
node->accept(mgv);
osg::Timer_t endTick = osg::Timer::instance()->tick();
OSG_INFO<<"MERGE_GEOMETRY took "<<osg::Timer::instance()->delta_s(startTick,endTick)<<std::endl;
}
if (options & VERTEX_POSTTRANSFORM)
{
OSG_INFO<<"Optimizer::optimize() doing VERTEX_POSTTRANSFORM"<<std::endl;

Loading…
Cancel
Save