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:
Robert Osfield
2003-08-14 00:05:34 +00:00
parent 6a25da37f2
commit 4b7bde1440
8 changed files with 446 additions and 472 deletions

View File

@@ -199,12 +199,6 @@ class SG_EXPORT NodeVisitor : public virtual Referenced
* to the current Node being visited.*/
const NodePath& getNodePath() const { return _nodePath; }
/** Get the Local To World Matrix from the NodePath for specified Transform::Mode, and u.*/
virtual bool getLocalToWorldMatrix(Matrix& matrix, Node* node);
/** Get the World To Local Matrix from the NodePath for specified Transform::Mode.*/
virtual bool getWorldToLocalMatrix(Matrix& matrix, Node* node);
/** Get the eye point in local coordinates.
* Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement.*/
virtual osg::Vec3 getEyePoint() const { return Vec3(0.0f,0.0f,0.0f); }

View File

@@ -84,6 +84,22 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
* note, should only be called from the draw thread.*/
void compileRenderingObjects(osg::State& state,double& availableTime);
/** Helper class used internally to force the release of texture objects
* and displace lists.*/
class OSGDB_EXPORT ReleaseTexturesAndDrawablesVisitor : public osg::NodeVisitor
{
public:
ReleaseTexturesAndDrawablesVisitor():
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
{
}
virtual void apply(osg::Node& node);
virtual void apply(osg::Geode& geode);
inline void apply(osg::StateSet* stateset);
inline void apply(osg::Drawable* drawable);
};
public:

View File

@@ -20,7 +20,7 @@
#include <osg/ref_ptr>
#include <osg/Object>
#include <osg/Node>
#include <osg/Transform>
#include <osg/NodeVisitor>
#include <osg/CopyOp>
#include <osg/Vec3>
@@ -161,7 +161,8 @@ namespace osgParticle
{
if (need_ltw_matrix_) {
ltw_matrix_ = osg::Matrix::identity();
current_nodevisitor_->getLocalToWorldMatrix(ltw_matrix_, this);
//current_nodevisitor_->getLocalToWorldMatrix(ltw_matrix_, this);
ltw_matrix_ = osg::computeLocalToWorld(current_nodevisitor_->getNodePath());
need_ltw_matrix_ = false;
}
return ltw_matrix_;
@@ -171,7 +172,8 @@ namespace osgParticle
{
if (need_wtl_matrix_) {
wtl_matrix_ = osg::Matrix::identity();
current_nodevisitor_->getWorldToLocalMatrix(wtl_matrix_, this);
//current_nodevisitor_->getWorldToLocalMatrix(wtl_matrix_, this);
wtl_matrix_ = osg::computeWorldToLocal(current_nodevisitor_->getNodePath());
need_wtl_matrix_ = false;
}
return wtl_matrix_;