From Mathias Froehlich, "attached is a change to the ProxyNode that also includes ProxyNode local

database options like recently added to PagedLOD.

Also there is a change to the traverse method:
The previous ProxyNode checks the VisitorType to be a CULL_VISITOR and the
presence of a request handler to submit a database request.
In contrast to that PagedLOD uses the request handler if it is there - even if
the visitor type is not a cull visitor.
The change removes the cull visitor test from the ProxyNode so that it behaves
like the PagedLOD.
I believe that the presence of a request handler in a visitor might be
sufficient to trigger the requests as this is done in the PagedLOD anyway.

Based on rev 10332."
This commit is contained in:
Robert Osfield 2009-06-12 10:08:15 +00:00
parent a921031034
commit d60801be3f
2 changed files with 15 additions and 2 deletions

View File

@ -41,6 +41,17 @@ class OSG_EXPORT ProxyNode : public Group
virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove); virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove);
/** Set the optional database osgDB::Options object to use when loaded children.*/
void setDatabaseOptions(osg::Referenced* options) { _databaseOptions = options; }
/** Get the optional database osgDB::Options object used when loaded children.*/
osg::Referenced* getDatabaseOptions() { return _databaseOptions.get(); }
/** Get the optional database osgDB::Options object used when loaded children.*/
const osg::Referenced* getDatabaseOptions() const { return _databaseOptions.get(); }
/** Set the database path to prepend to children's filenames.*/ /** Set the database path to prepend to children's filenames.*/
void setDatabasePath(const std::string& path); void setDatabasePath(const std::string& path);
/** Get the database path used to prepend to children's filenames.*/ /** Get the database path used to prepend to children's filenames.*/
@ -114,6 +125,7 @@ class OSG_EXPORT ProxyNode : public Group
typedef std::vector<FileNameDatabaseRequestPair> FileNameDatabaseRequestList; typedef std::vector<FileNameDatabaseRequestPair> FileNameDatabaseRequestList;
FileNameDatabaseRequestList _filenameList; FileNameDatabaseRequestList _filenameList;
ref_ptr<Referenced> _databaseOptions;
std::string _databasePath; std::string _databasePath;
LoadingExternalReferenceMode _loadingExtReference; LoadingExternalReferenceMode _loadingExtReference;

View File

@ -27,6 +27,8 @@ ProxyNode::ProxyNode() :
ProxyNode::ProxyNode(const ProxyNode& proxynode,const CopyOp& copyop): ProxyNode::ProxyNode(const ProxyNode& proxynode,const CopyOp& copyop):
Group(proxynode,copyop), Group(proxynode,copyop),
_filenameList(proxynode._filenameList), _filenameList(proxynode._filenameList),
_databaseOptions(proxynode._databaseOptions),
_databasePath(proxynode._databasePath),
_loadingExtReference(proxynode._loadingExtReference), _loadingExtReference(proxynode._loadingExtReference),
_centerMode(proxynode._centerMode), _centerMode(proxynode._centerMode),
_userDefinedCenter(proxynode._userDefinedCenter), _userDefinedCenter(proxynode._userDefinedCenter),
@ -57,12 +59,11 @@ void ProxyNode::setDatabasePath(const std::string& path)
void ProxyNode::traverse(NodeVisitor& nv) void ProxyNode::traverse(NodeVisitor& nv)
{ {
if (nv.getDatabaseRequestHandler() && _filenameList.size()>_children.size() && if (nv.getDatabaseRequestHandler() && _filenameList.size()>_children.size() &&
nv.getVisitorType()==NodeVisitor::CULL_VISITOR &&
_loadingExtReference!=NO_AUTOMATIC_LOADING) _loadingExtReference!=NO_AUTOMATIC_LOADING)
{ {
for(unsigned int i=_children.size(); i<_filenameList.size(); ++i) for(unsigned int i=_children.size(); i<_filenameList.size(); ++i)
{ {
nv.getDatabaseRequestHandler()->requestNodeFile(_databasePath+_filenameList[i].first, this, 1.0f, nv.getFrameStamp(), _filenameList[i].second); nv.getDatabaseRequestHandler()->requestNodeFile(_databasePath+_filenameList[i].first, this, 1.0f, nv.getFrameStamp(), _filenameList[i].second, _databaseOptions.get());
} }
} }
else else