Optimize empty groups from .ac models

The OSG optimizer seems to have changed since this work was originally done.
This commit is contained in:
Tim Moore 2009-01-23 15:22:40 +01:00
parent 1a8fd62680
commit be0635bfd3

View File

@ -494,13 +494,14 @@ struct ACOptimizePolicy : public OptimizeModelPolicy {
{ {
ref_ptr<Node> optimized ref_ptr<Node> optimized
= OptimizeModelPolicy::optimize(node, fileName, opt); = OptimizeModelPolicy::optimize(node, fileName, opt);
Group* group = dynamic_cast<Group*>(optimized.get());
MatrixTransform* transform MatrixTransform* transform
= dynamic_cast<MatrixTransform*>(optimized.get()); = dynamic_cast<MatrixTransform*>(optimized.get());
if (transform && transform->getMatrix().isIdentity() if (((transform && transform->getMatrix().isIdentity()) || group)
&& transform->getName().empty() && group->getName().empty()
&& transform->getNumChildren() == 1) { && group->getNumChildren() == 1) {
optimized = static_cast<Node*>(transform->getChild(0)); optimized = static_cast<Node*>(group->getChild(0));
Group* group = dynamic_cast<Group*>(optimized.get()); group = dynamic_cast<Group*>(optimized.get());
if (group && group->getName().empty() if (group && group->getName().empty()
&& group->getNumChildren() == 1) && group->getNumChildren() == 1)
optimized = static_cast<Node*>(group->getChild(0)); optimized = static_cast<Node*>(group->getChild(0));