Added new Node::getParentalNodePaths() method.

Added better handling in computeIntersections(..) of nodes that are internal
to the scene graph, correctly accounting for the accumulated transforms.

Changed the EventVisitor so that it only traveses active children rather than
all children.

Updated wrappers.
This commit is contained in:
Robert Osfield
2005-12-07 15:29:29 +00:00
parent 73cc97f0e1
commit 27ad107378
7 changed files with 92 additions and 39 deletions

View File

@@ -21,6 +21,36 @@
using namespace osg;
namespace osg
{
/// Helper class for generating NodePathList.
class CollectParentPaths : public NodeVisitor
{
public:
CollectParentPaths(osg::Node* haltTraversalAtNode=0) :
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_PARENTS),
_haltTraversalAtNode(haltTraversalAtNode)
{
}
virtual void apply(osg::Node& node)
{
if (node.getNumParents()==0 || &node==_haltTraversalAtNode)
{
_nodePaths.push_back(getNodePath());
}
else
{
traverse(node);
}
}
Node* _haltTraversalAtNode;
NodePath _nodePath;
NodePathList _nodePaths;
};
}
Node::Node()
{
_boundingSphereComputed = false;
@@ -133,6 +163,12 @@ osg::StateSet* Node::getOrCreateStateSet()
return _stateset.get();
}
NodePathList Node::getParentalNodePaths(osg::Node* haltTraversalAtNode) const
{
CollectParentPaths cpp(haltTraversalAtNode);
const_cast<Node*>(this)->accept(cpp);
return cpp._nodePaths;
}
void Node::setUpdateCallback(NodeCallback* nc)
{