From Paul Martz, "Regarding the osg-users thread "mergeGeodes crash", I'm submitting this for consideration as a fix for the problem with the FlattenStaticTransformsVisitor. It seems that the additional nested loop over the Transform's parent was not needed. I'm not sure why it was there, and if it really was unnecessary, then it has probably been resulting in many redundant Nodes for quite some time. Perhaps this fix will result in a cull- and draw-time performance boost."

From Robert Osfield, added copying of the UserData and Descriptions from the transform to the new group.
This commit is contained in:
Robert Osfield 2010-02-26 15:40:19 +00:00
parent dbe854e9b0
commit 3b43810c66

View File

@ -1076,12 +1076,11 @@ bool CollectLowestTransformsVisitor::removeTransforms(osg::Node* nodeWeCannotRem
group->setDataVariance(osg::Object::STATIC); group->setDataVariance(osg::Object::STATIC);
group->setNodeMask(transform->getNodeMask()); group->setNodeMask(transform->getNodeMask());
group->setStateSet(transform->getStateSet()); group->setStateSet(transform->getStateSet());
group->setUserData(transform->getUserData());
group->setDescriptions(transform->getDescriptions());
for(unsigned int i=0;i<transform->getNumChildren();++i) for(unsigned int i=0;i<transform->getNumChildren();++i)
{ {
for(unsigned int j=0;j<transform->getNumParents();++j) group->addChild(transform->getChild(i));
{
group->addChild(transform->getChild(i));
}
} }
for(int i2=transform->getNumParents()-1;i2>=0;--i2) for(int i2=transform->getNumParents()-1;i2>=0;--i2)