Improved the constness of parameters the Node::getWorldMatrices(..) method.

Added Drawable::getWorldMatrices(const Node*) method.
This commit is contained in:
Robert Osfield
2008-09-18 10:38:18 +00:00
parent 93d4090169
commit 0969a5384b
6 changed files with 27 additions and 6 deletions

View File

@@ -250,6 +250,19 @@ Drawable::~Drawable()
dirtyDisplayList();
}
osg::MatrixList Drawable::getWorldMatrices(const osg::Node* haltTraversalAtNode) const
{
osg::MatrixList matrices;
for(ParentList::const_iterator itr = _parents.begin();
itr != _parents.end();
++itr)
{
osg::MatrixList localMatrices = (*itr)->getWorldMatrices(haltTraversalAtNode);
matrices.insert(matrices.end(), localMatrices.begin(), localMatrices.end());
}
return matrices;
}
void Drawable::computeDataVariance()
{
if (getDataVariance() != UNSPECIFIED) return;

View File

@@ -28,7 +28,7 @@ namespace osg
class CollectParentPaths : public NodeVisitor
{
public:
CollectParentPaths(osg::Node* haltTraversalAtNode=0) :
CollectParentPaths(const osg::Node* haltTraversalAtNode=0) :
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_PARENTS),
_haltTraversalAtNode(haltTraversalAtNode)
{
@@ -46,7 +46,7 @@ namespace osg
}
}
Node* _haltTraversalAtNode;
const Node* _haltTraversalAtNode;
NodePath _nodePath;
NodePathList _nodePaths;
};
@@ -191,7 +191,7 @@ NodePathList Node::getParentalNodePaths(osg::Node* haltTraversalAtNode) const
return cpp._nodePaths;
}
MatrixList Node::getWorldMatrices(osg::Node* haltTraversalAtNode) const
MatrixList Node::getWorldMatrices(const osg::Node* haltTraversalAtNode) const
{
CollectParentPaths cpp(haltTraversalAtNode);
const_cast<Node*>(this)->accept(cpp);