mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-25 03:40:40 +00:00
optimizer: run MERGE_GEOMETRY after removing redundant nodes
This commit is contained in:
parent
43f31d6e54
commit
ebfd845eae
@ -485,7 +485,7 @@ namespace Resource
|
|||||||
SceneUtil::Optimizer optimizer;
|
SceneUtil::Optimizer optimizer;
|
||||||
optimizer.setIsOperationPermissibleForObjectCallback(new CanOptimizeCallback);
|
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)
|
if (mIncrementalCompileOperation)
|
||||||
|
@ -82,21 +82,6 @@ void Optimizer::optimize(osg::Node* node, unsigned int options)
|
|||||||
cstv.removeTransforms(node);
|
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)
|
if (options & REMOVE_REDUNDANT_NODES)
|
||||||
{
|
{
|
||||||
OSG_INFO<<"Optimizer::optimize() doing REMOVE_REDUNDANT_NODES"<<std::endl;
|
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);
|
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)
|
if (options & VERTEX_POSTTRANSFORM)
|
||||||
{
|
{
|
||||||
OSG_INFO<<"Optimizer::optimize() doing VERTEX_POSTTRANSFORM"<<std::endl;
|
OSG_INFO<<"Optimizer::optimize() doing VERTEX_POSTTRANSFORM"<<std::endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user