1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 15:29:55 +00:00

optimizer: run MERGE_GEOMETRY after removing redundant nodes

This commit is contained in:
scrawl 2017-02-23 20:27:01 +01:00
parent 43f31d6e54
commit ebfd845eae
2 changed files with 16 additions and 16 deletions

View file

@ -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)

View file

@ -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;