void KillableTargetActor::SwitchVisitor::apply(osg::Switch& switchNode) { for (unsigned i = 0; i < switchNode.getNumChildren(); ++i) { if (switchNode.getChild(i)->getName() == mSwitchState) { switchNode.setSingleChildOn(i); break; } } }
void CountsVisitor::apply(osg::Switch& node) { pushStateSet(node.getStateSet()); _switches++; osg::ref_ptr<osg::Object> rp = (osg::Object*)&node; _uSwitches.insert(rp); _totalChildren += node.getNumChildren(); apply(node.getStateSet()); if (++_depth > _maxDepth) _maxDepth = _depth; traverse((osg::Node&)node); _depth--; popStateSet(); }