Removed the deprecated NodeVisitor::getLocalToWorld/WorldToLocal methods as
this are replaced by the osg::computeLocalToWorld/WorldToLocal() functions found in osg/Transform. Made the ReleaseTextureAndDisplayListsVisitor a public nested class of osgDB::DatabasePager to allow it to be used in the TXP plugin, and added usage of this visitor to the TXP plugin to make sure that textures and display lists are released during the update thread.
This commit is contained in:
@@ -44,65 +44,3 @@ NodeVisitor::~NodeVisitor()
|
||||
// if (_traversalVisitor) detach from _traversalVisitor;
|
||||
}
|
||||
|
||||
class TransformVisitor : public NodeVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
enum CoordMode
|
||||
{
|
||||
WORLD_TO_LOCAL,
|
||||
LOCAL_TO_WORLD
|
||||
};
|
||||
|
||||
|
||||
CoordMode _coordMode;
|
||||
Matrix& _matrix;
|
||||
NodeVisitor* _nodeVisitor;
|
||||
|
||||
TransformVisitor(Matrix& matrix,CoordMode coordMode,NodeVisitor* nv):
|
||||
NodeVisitor(),
|
||||
_coordMode(coordMode),
|
||||
_matrix(matrix),
|
||||
_nodeVisitor(nv)
|
||||
{}
|
||||
|
||||
virtual void apply(Transform& transform)
|
||||
{
|
||||
if (_coordMode==LOCAL_TO_WORLD)
|
||||
{
|
||||
transform.getLocalToWorldMatrix(_matrix,_nodeVisitor);
|
||||
}
|
||||
else // worldToLocal
|
||||
{
|
||||
transform.getWorldToLocalMatrix(_matrix,_nodeVisitor);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
bool NodeVisitor::getLocalToWorldMatrix(Matrix& matrix, Node* node)
|
||||
{
|
||||
TransformVisitor tv(matrix,TransformVisitor::LOCAL_TO_WORLD,this);
|
||||
for(NodePath::iterator itr=_nodePath.begin();
|
||||
itr!=_nodePath.end();
|
||||
++itr)
|
||||
{
|
||||
if (*itr==node) return true; // don't account for matrix attached to specified node
|
||||
(*itr)->accept(tv);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NodeVisitor::getWorldToLocalMatrix(Matrix& matrix, Node* node)
|
||||
{
|
||||
TransformVisitor tv(matrix,TransformVisitor::WORLD_TO_LOCAL,this);
|
||||
for(NodePath::iterator itr=_nodePath.begin();
|
||||
itr!=_nodePath.end();
|
||||
++itr)
|
||||
{
|
||||
if (*itr==node) return true; // don't account for matrix attached to specified node
|
||||
(*itr)->accept(tv);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user