Added support in osg::computeWorldToLocal and compteLocalToWorld functions for automatically

stripping any absolute or root CameraNode's from the NodePaths.

Added osg::Node::getWorldMatrices() convinience method.
This commit is contained in:
Robert Osfield
2006-02-27 19:48:34 +00:00
parent 8f2ffb7c2d
commit 1dcf4fe81f
4 changed files with 79 additions and 19 deletions

View File

@@ -16,6 +16,7 @@
#include <osg/NodeVisitor>
#include <osg/Notify>
#include <osg/OccluderNode>
#include <osg/CameraNode>
#include <algorithm>
@@ -170,6 +171,31 @@ NodePathList Node::getParentalNodePaths(osg::Node* haltTraversalAtNode) const
return cpp._nodePaths;
}
MatrixList Node::getWorldMatrices(osg::Node* haltTraversalAtNode) const
{
CollectParentPaths cpp(haltTraversalAtNode);
const_cast<Node*>(this)->accept(cpp);
MatrixList matrices;
for(NodePathList::iterator itr = cpp._nodePaths.begin();
itr != cpp._nodePaths.end();
++itr)
{
NodePath& nodePath = *itr;
if (nodePath.empty())
{
matrices.push_back(osg::Matrix::identity());
}
else
{
matrices.push_back(osg::computeLocalToWorld(nodePath));
}
}
return matrices;
}
void Node::setUpdateCallback(NodeCallback* nc)
{
// if no changes just return.