mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
Improve switchable nodes handling by optimizer
This commit is contained in:
parent
87598f9419
commit
03b71d3c30
@ -737,6 +737,20 @@ bool Optimizer::CombineStaticTransformsVisitor::removeTransforms(osg::Node* node
|
||||
// RemoveEmptyNodes.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Optimizer::RemoveEmptyNodesVisitor::apply(osg::Switch& switchNode)
|
||||
{
|
||||
// We should keep all switch child nodes since they reflect different switch states.
|
||||
for (unsigned int i=0; i<switchNode.getNumChildren(); ++i)
|
||||
traverse(*switchNode.getChild(i));
|
||||
}
|
||||
|
||||
void Optimizer::RemoveEmptyNodesVisitor::apply(osg::LOD& lod)
|
||||
{
|
||||
// don't remove any direct children of the LOD because they are used to define each LOD level.
|
||||
for (unsigned int i=0; i<lod.getNumChildren(); ++i)
|
||||
traverse(*lod.getChild(i));
|
||||
}
|
||||
|
||||
void Optimizer::RemoveEmptyNodesVisitor::apply(osg::Group& group)
|
||||
{
|
||||
if (group.getNumParents()>0)
|
||||
@ -1856,7 +1870,8 @@ bool Optimizer::MergeGeometryVisitor::mergePrimitive(osg::DrawElementsUInt& lhs,
|
||||
|
||||
bool Optimizer::MergeGroupsVisitor::isOperationPermissible(osg::Group& node)
|
||||
{
|
||||
return !node.asTransform() &&
|
||||
return !node.asSwitch() &&
|
||||
!node.asTransform() &&
|
||||
!node.getCullCallback() &&
|
||||
!node.getEventCallback() &&
|
||||
!node.getUpdateCallback() &&
|
||||
|
@ -321,6 +321,8 @@ class Optimizer
|
||||
BaseOptimizerVisitor(optimizer, REMOVE_REDUNDANT_NODES) {}
|
||||
|
||||
virtual void apply(osg::Group& group);
|
||||
virtual void apply(osg::LOD& lod);
|
||||
virtual void apply(osg::Switch& switchNode);
|
||||
|
||||
void removeEmptyNodes();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user