Added calling of the LightSource and ClipNode as Group by the NodeVisitor and

fixed the CullVisitor and Optimizer to take account of this.
This commit is contained in:
Robert Osfield 2002-08-22 09:19:41 +00:00
parent ed3d083368
commit c45c3d3255
3 changed files with 9 additions and 5 deletions

View File

@ -194,13 +194,14 @@ class SG_EXPORT NodeVisitor : public Referenced
virtual void apply(Geode& node) { apply((Node&)node); }
virtual void apply(Billboard& node) { apply((Geode&)node); }
virtual void apply(LightSource& node) { apply((Node&)node); }
virtual void apply(ClipNode& node) { apply((Node&)node); }
virtual void apply(Group& node) { apply((Node&)node); }
virtual void apply(Projection& node) { apply((Group&)node); }
virtual void apply(ClipNode& node) { apply((Group&)node); }
virtual void apply(LightSource& node) { apply((Group&)node); }
virtual void apply(Transform& node) { apply((Group&)node); }
virtual void apply(DOFTransform& node) { apply((Transform&)node); }
virtual void apply(MatrixTransform& node) { apply((Transform&)node); }

View File

@ -58,8 +58,8 @@ class PrintVisitor : public NodeVisitor
virtual void apply(Geode& node) { apply((Node&)node); }
virtual void apply(Billboard& node) { apply((Geode&)node); }
virtual void apply(LightSource& node) { apply((Node&)node); }
virtual void apply(ClipNode& node) { apply((Node&)node); }
virtual void apply(LightSource& node) { apply((Group&)node); }
virtual void apply(ClipNode& node) { apply((Group&)node); }
virtual void apply(Group& node) { apply((Node&)node); }
virtual void apply(Transform& node) { apply((Group&)node); }
@ -382,6 +382,8 @@ void CullVisitor::apply(LightSource& node)
addPositionedAttribute(&matrix,light);
}
handle_cull_callbacks_and_traverse(node);
// pop the node's state off the geostate stack.
if (node_state) popStateSet();
}

View File

@ -933,7 +933,8 @@ void Optimizer::RemoveEmptyNodesVisitor::apply(osg::Group& group)
if (group.getNumParents()>0)
{
// only remove empty groups, but not empty occluders.
if (group.getNumChildren()==0 && !dynamic_cast<osg::OccluderNode*>(&group))
if (group.getNumChildren()==0 &&
(typeid(group)==typeid(osg::Group) || dynamic_cast<osg::Transform*>(&group)))
{
_redundentNodeList.insert(&group);
}