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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user