From f939ea731e629b636f839ef2132d9c41dff3c75d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 11 May 2009 11:39:12 +0000 Subject: [PATCH] Moved Registry::ReadFileCallback + WriteFileCallback, and osgDB::ReaderWriter::Options into their own separate Options file and into the osgDB namespace. Introduced a new callback osgDB::FindFileCallback that overrides the default behavior of findDataFile/findLibraryFile. Introduced support for assigning ReaderWriter::Options directory to PagedLOD. Introduced new osgDB::FileLocationCallback for assistancing the DatabasePager to know when a file is hosted on a local or remote file system. --- CMakeLists.txt | 4 +- include/osg/NodeVisitor | 12 ++-- include/osg/PagedLOD | 12 +++- include/osgDB/DatabasePager | 6 +- include/osgDB/FileCache | 2 + include/osgDB/Options | 41 +++++++++++++- include/osgDB/Registry | 12 +++- src/osg/PagedLOD.cpp | 6 +- src/osgDB/DatabasePager.cpp | 75 +++++++++++++++++-------- src/osgDB/FileCache.cpp | 5 ++ src/osgDB/Options.cpp | 4 +- src/osgWrappers/osg/NodeVisitor.cpp | 10 ++-- src/osgWrappers/osg/PagedLOD.cpp | 18 ++++++ src/osgWrappers/osgDB/DatabasePager.cpp | 10 +--- src/osgWrappers/osgDB/Options.cpp | 53 ++++++++++++++++- src/osgWrappers/osgDB/Registry.cpp | 15 +++++ 16 files changed, 226 insertions(+), 59 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 463f56de6..5b4e78063 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,8 +30,8 @@ PROJECT(OpenSceneGraph) SET(OPENSCENEGRAPH_MAJOR_VERSION 2) SET(OPENSCENEGRAPH_MINOR_VERSION 9) -SET(OPENSCENEGRAPH_PATCH_VERSION 4) -SET(OPENSCENEGRAPH_SOVERSION 59) +SET(OPENSCENEGRAPH_PATCH_VERSION 5) +SET(OPENSCENEGRAPH_SOVERSION 60) # set to 0 when not a release candidate, non zero means that any generated # svn tags will be treated as release candidates of given number diff --git a/include/osg/NodeVisitor b/include/osg/NodeVisitor index d1decdabf..d50f99604 100644 --- a/include/osg/NodeVisitor +++ b/include/osg/NodeVisitor @@ -274,19 +274,19 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced class DatabaseRequestHandler : public osg::Referenced { public: - + DatabaseRequestHandler(): Referenced(true) {} - - virtual void requestNodeFile(const std::string& fileName,osg::Group* group, float priority, const FrameStamp* framestamp, osg::ref_ptr& databaseRequest) = 0; - + + virtual void requestNodeFile(const std::string& fileName,osg::Group* group, float priority, const FrameStamp* framestamp, osg::ref_ptr& databaseRequest, const osg::Referenced* options=0) = 0; + protected: virtual ~DatabaseRequestHandler() {} }; - + /** Set the handler for database requests.*/ void setDatabaseRequestHandler(DatabaseRequestHandler* handler) { _databaseRequestHandler = handler; } - + /** Get the handler for database requests.*/ DatabaseRequestHandler* getDatabaseRequestHandler() { return _databaseRequestHandler.get(); } diff --git a/include/osg/PagedLOD b/include/osg/PagedLOD index 338625d41..0e76a8139 100644 --- a/include/osg/PagedLOD +++ b/include/osg/PagedLOD @@ -42,7 +42,16 @@ class OSG_EXPORT PagedLOD : public LOD virtual bool addChild(Node *child, float min, float max,const std::string& filename, float priorityOffset=0.0f, float priorityScale=1.0f); virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove=1); - + + + /** 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.*/ @@ -133,6 +142,7 @@ class OSG_EXPORT PagedLOD : public LOD void expandPerRangeDataTo(unsigned int pos); + ref_ptr _databaseOptions; std::string _databasePath; int _frameNumberOfLastTraversal; diff --git a/include/osgDB/DatabasePager b/include/osgDB/DatabasePager index 18b516f44..d5f659da5 100644 --- a/include/osgDB/DatabasePager +++ b/include/osgDB/DatabasePager @@ -63,14 +63,10 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl /** Add a request to load a node file to end the the database request list.*/ - virtual void requestNodeFile(const std::string& fileName,osg::Group* group, - float priority, const osg::FrameStamp* framestamp, - osg::ref_ptr& databaseRequest); - virtual void requestNodeFile(const std::string& fileName,osg::Group* group, float priority, const osg::FrameStamp* framestamp, osg::ref_ptr& databaseRequest, - Options* loadOptions); + const osg::Referenced* options); /** Set the priority of the database pager thread(s).*/ int setSchedulePriority(OpenThreads::Thread::ThreadPriority priority); diff --git a/include/osgDB/FileCache b/include/osgDB/FileCache index 0b52110b3..1eed2c2ef 100644 --- a/include/osgDB/FileCache +++ b/include/osgDB/FileCache @@ -28,6 +28,8 @@ class OSGDB_EXPORT FileCache : public osg::Referenced const std::string& getFileCachePath() const { return _fileCachePath; } + virtual bool isFileAppropriateForFileCache(const std::string& originalFileName) const; + virtual std::string createCacheFileName(const std::string& originalFileName) const; virtual bool existsInCache(const std::string& originalFileName) const; diff --git a/include/osgDB/Options b/include/osgDB/Options index 875f752e0..f22f1f050 100644 --- a/include/osgDB/Options +++ b/include/osgDB/Options @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -86,8 +87,27 @@ class OSGDB_EXPORT WriteFileCallback : public virtual osg::Referenced virtual ~WriteFileCallback() {} }; +class OSGDB_EXPORT FileLocationCallback : public virtual osg::Referenced +{ + public: + + enum Location + { + LOCAL_FILE, + REMOTE_FILE + }; + + virtual Location fileLocation(const std::string& filename, const Options* options) = 0; + + virtual bool useFileCache() const = 0; + + protected: + virtual ~FileLocationCallback() {} +}; + + /** Options base class used for passing options into plugins to control their operation.*/ -class Options : public osg::Object +class OSGDB_EXPORT Options : public osg::Object { public: @@ -233,13 +253,27 @@ class Options : public osg::Object ReadFileCallback* getReadFileCallback() const { return _readFileCallback.get(); } - /** Set the Registry callback to use in place of the default writeFile calls.*/ + /** Set the callback to use in place of the default writeFile calls.*/ void setWriteFileCallback( WriteFileCallback* cb) { _writeFileCallback = cb; } /** Get the const writeFile callback.*/ WriteFileCallback* getWriteFileCallback() const { return _writeFileCallback.get(); } + /** Set the callback to use inform the DatabasePager whether a file is located on local or remote file system..*/ + void setFileLocationCallback( FileLocationCallback* cb) { _fileLocationCallback = cb; } + + /** Get the callback to use inform the DatabasePager whether a file is located on local or remote file system..*/ + FileLocationCallback* getFileLocationCallback() const { return _fileLocationCallback.get(); } + + + /** Set the FileCache that is used to manage local storage of files downloaded from the internet.*/ + void setFileCache(FileCache* fileCache) { _fileCache = fileCache; } + + /** Get the FileCache that is used to manage local storage of files downloaded from the internet.*/ + FileCache* getFileCache() const { return _fileCache.get(); } + + protected: virtual ~Options() {} @@ -258,6 +292,9 @@ class Options : public osg::Object osg::ref_ptr _findFileCallback; osg::ref_ptr _readFileCallback; osg::ref_ptr _writeFileCallback; + osg::ref_ptr _fileLocationCallback; + + osg::ref_ptr _fileCache; }; } diff --git a/include/osgDB/Registry b/include/osgDB/Registry index 62182465d..4fbcafa05 100644 --- a/include/osgDB/Registry +++ b/include/osgDB/Registry @@ -164,6 +164,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced typedef class osgDB::FindFileCallback FindFileCallback; typedef class osgDB::ReadFileCallback ReadFileCallback; typedef class osgDB::WriteFileCallback WriteFileCallback; + typedef class osgDB::FileLocationCallback FileLocationCallback; /** Set the Registry callback to use in place of the default findFile calls.*/ void setFindFileCallback( FindFileCallback* cb) { _findFileCallback = cb; } @@ -326,6 +327,13 @@ class OSGDB_EXPORT Registry : public osg::Referenced } } + /** Set the callback to use inform the DatabasePager whether a file is located on local or remote file system..*/ + void setFileLocationCallback( FileLocationCallback* cb) { _fileLocationCallback = cb; } + + /** Get the callback to use inform the DatabasePager whether a file is located on local or remote file system..*/ + FileLocationCallback* getFileLocationCallback() const { return _fileLocationCallback.get(); } + + /** Set whether the KdTrees should be built for geometry in the loader model. */ void setBuildKdTreesHint(Options::BuildKdTreesHint hint) { _buildKdTreesHint = hint; } @@ -339,6 +347,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced /** Get the KdTreeBuilder visitor that is used to build KdTree on loaded models.*/ osg::KdTreeBuilder* getKdTreeBuilder() { return _kdTreeBuilder.get(); } + /** Set the FileCache that is used to manage local storage of files downloaded from the internet.*/ void setFileCache(FileCache* fileCache) { _fileCache = fileCache; } @@ -488,7 +497,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced construction other than via the instance() method and therefore ensuring only one copy is ever constructed*/ Registry(); - + /** get the attached library with specified name.*/ DynamicLibraryList::iterator getLibraryItr(const std::string& fileName); @@ -557,6 +566,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced osg::ref_ptr _findFileCallback; osg::ref_ptr _readFileCallback; osg::ref_ptr _writeFileCallback; + osg::ref_ptr _fileLocationCallback; DotOsgWrapperMap _objectWrapperMap; DotOsgWrapperMap _imageWrapperMap; diff --git a/src/osg/PagedLOD.cpp b/src/osg/PagedLOD.cpp index fb5771ef9..513d01acf 100644 --- a/src/osg/PagedLOD.cpp +++ b/src/osg/PagedLOD.cpp @@ -58,6 +58,7 @@ PagedLOD::PagedLOD() PagedLOD::PagedLOD(const PagedLOD& plod,const CopyOp& copyop): LOD(plod,copyop), + _databaseOptions(plod._databaseOptions), _databasePath(plod._databasePath), _frameNumberOfLastTraversal(plod._frameNumberOfLastTraversal), _numChildrenThatCannotBeExpired(plod._numChildrenThatCannotBeExpired), @@ -213,16 +214,15 @@ void PagedLOD::traverse(NodeVisitor& nv) if (_databasePath.empty()) { - nv.getDatabaseRequestHandler()->requestNodeFile(_perRangeDataList[numChildren]._filename,this,priority,nv.getFrameStamp(), _perRangeDataList[numChildren]._databaseRequest); + nv.getDatabaseRequestHandler()->requestNodeFile(_perRangeDataList[numChildren]._filename,this,priority,nv.getFrameStamp(), _perRangeDataList[numChildren]._databaseRequest, _databaseOptions.get()); } else { // prepend the databasePath to the child's filename. - nv.getDatabaseRequestHandler()->requestNodeFile(_databasePath+_perRangeDataList[numChildren]._filename,this,priority,nv.getFrameStamp(), _perRangeDataList[numChildren]._databaseRequest); + nv.getDatabaseRequestHandler()->requestNodeFile(_databasePath+_perRangeDataList[numChildren]._filename,this,priority,nv.getFrameStamp(), _perRangeDataList[numChildren]._databaseRequest, _databaseOptions.get()); } } - } diff --git a/src/osgDB/DatabasePager.cpp b/src/osgDB/DatabasePager.cpp index 4fee635c3..526bf7ca5 100644 --- a/src/osgDB/DatabasePager.cpp +++ b/src/osgDB/DatabasePager.cpp @@ -445,9 +445,7 @@ void DatabasePager::DatabaseThread::run() read_queue = _pager->_httpRequestQueue; break; } - - //Getting CURL Environment Variables (If found rewrite OSG Options) - osg::ref_ptr fileCache = osgDB::Registry::instance()->getFileCache(); + do { @@ -481,9 +479,22 @@ void DatabasePager::DatabaseThread::run() read_queue->takeFirst(databaseRequest); bool readFromFileCache = false; - + + osg::ref_ptr fileCache = osgDB::Registry::instance()->getFileCache(); + osg::ref_ptr fileLocationCallback = osgDB::Registry::instance()->getFileLocationCallback(); + if (databaseRequest.valid()) { + if (databaseRequest->_loadOptions.valid()) + { + if (databaseRequest->_loadOptions->getFileCache()) fileCache = databaseRequest->_loadOptions->getFileCache(); + if (databaseRequest->_loadOptions->getFileLocationCallback()) fileLocationCallback = databaseRequest->_loadOptions->getFileLocationCallback(); + } + + // disable the FileCache if the fileLocationCallback tells us that it isn't required for this request. + if (fileLocationCallback.valid() && !fileLocationCallback->useFileCache()) fileCache = 0; + + // check if databaseRequest is still relevant if ((_pager->_frameNumber-databaseRequest->_frameNumberLastRequest)<=1) { @@ -492,19 +503,32 @@ void DatabasePager::DatabaseThread::run() switch(_mode) { case(HANDLE_ALL_REQUESTS): + { // do nothing as this thread can handle the load - if (osgDB::containsServerAddress(databaseRequest->_fileName)) + if (fileCache.valid() && fileCache->isFileAppropriateForFileCache(databaseRequest->_fileName)) { - if (fileCache.valid() && fileCache->existsInCache(databaseRequest->_fileName)) + if (fileCache->existsInCache(databaseRequest->_fileName)) { readFromFileCache = true; } } break; - + } case(HANDLE_NON_HTTP): + { // check the cache first - if (osgDB::containsServerAddress(databaseRequest->_fileName)) + bool isHighLatencyFileRequest = false; + + if (fileLocationCallback.valid()) + { + isHighLatencyFileRequest = fileLocationCallback->fileLocation(databaseRequest->_fileName, databaseRequest->_loadOptions.get()) == FileLocationCallback::REMOTE_FILE; + } + else if (fileCache.valid() && fileCache->isFileAppropriateForFileCache(databaseRequest->_fileName)) + { + isHighLatencyFileRequest = true; + } + + if (isHighLatencyFileRequest) { if (fileCache.valid() && fileCache->existsInCache(databaseRequest->_fileName)) { @@ -518,15 +542,12 @@ void DatabasePager::DatabaseThread::run() } } break; - + } case(HANDLE_ONLY_HTTP): - // make sure the request is a http request - if (!osgDB::containsServerAddress(databaseRequest->_fileName)) - { - osg::notify(osg::NOTICE)<<_name<<": Help we have request we shouldn't have "<_fileName<_fileName<<" : "<_loadedModel.valid() && - osgDB::containsServerAddress(databaseRequest->_fileName) && fileCache.valid() && + fileCache->isFileAppropriateForFileCache(databaseRequest->_fileName) && !readFromFileCache) { fileCache->writeNode(*(databaseRequest->_loadedModel), databaseRequest->_fileName, databaseRequest->_loadOptions.get()); @@ -1228,18 +1249,24 @@ bool DatabasePager::getRequestsInProgress() const } -void DatabasePager::requestNodeFile(const std::string& fileName,osg::Group* group, - float priority, const osg::FrameStamp* framestamp, - osg::ref_ptr& databaseRequest) -{ - requestNodeFile(fileName,group,priority,framestamp,databaseRequest,Registry::instance()->getOptions()); -} - void DatabasePager::requestNodeFile(const std::string& fileName,osg::Group* group, float priority, const osg::FrameStamp* framestamp, osg::ref_ptr& databaseRequestRef, - Options* loadOptions) + const osg::Referenced* options) { + osgDB::Options* loadOptions = dynamic_cast(const_cast(options)); + if (!loadOptions) + { + loadOptions = Registry::instance()->getOptions(); + + osg::notify(osg::NOTICE)<<"Using options from Registry "<tick(); diff --git a/src/osgDB/FileCache.cpp b/src/osgDB/FileCache.cpp index 0777331b1..e362a3d43 100644 --- a/src/osgDB/FileCache.cpp +++ b/src/osgDB/FileCache.cpp @@ -30,6 +30,11 @@ FileCache::~FileCache() osg::notify(osg::INFO)<<"Destructed FileCache "< &, databaseRequest, - Properties::PURE_VIRTUAL, - __void__requestNodeFile__C5_std_string_R1__osg_Group_P1__float__C5_FrameStamp_P1__osg_ref_ptrT1_osg_Referenced__R1, - "", - ""); + I_MethodWithDefaults6(void, requestNodeFile, IN, const std::string &, fileName, , IN, osg::Group *, group, , IN, float, priority, , IN, const osg::FrameStamp *, framestamp, , IN, osg::ref_ptr< osg::Referenced > &, databaseRequest, , IN, const osg::Referenced *, options, 0, + Properties::PURE_VIRTUAL, + __void__requestNodeFile__C5_std_string_R1__osg_Group_P1__float__C5_FrameStamp_P1__osg_ref_ptrT1_osg_Referenced__R1__C5_osg_Referenced_P1, + "", + ""); END_REFLECTOR BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::NodeVisitor::ImageRequestHandler) diff --git a/src/osgWrappers/osg/PagedLOD.cpp b/src/osgWrappers/osg/PagedLOD.cpp index a6cfe6642..5dfe358d5 100644 --- a/src/osgWrappers/osg/PagedLOD.cpp +++ b/src/osgWrappers/osg/PagedLOD.cpp @@ -93,6 +93,21 @@ BEGIN_OBJECT_REFLECTOR(osg::PagedLOD) __bool__removeChildren__unsigned_int__unsigned_int, "Remove children from Group. ", "Note, must be override by subclasses of Group which add per child attributes. "); + I_Method1(void, setDatabaseOptions, IN, osg::Referenced *, options, + Properties::NON_VIRTUAL, + __void__setDatabaseOptions__osg_Referenced_P1, + "Set the optional database osgDB::Options object to use when loaded children. ", + ""); + I_Method0(osg::Referenced *, getDatabaseOptions, + Properties::NON_VIRTUAL, + __osg_Referenced_P1__getDatabaseOptions, + "Get the optional database osgDB::Options object used when loaded children. ", + ""); + I_Method0(const osg::Referenced *, getDatabaseOptions, + Properties::NON_VIRTUAL, + __C5_osg_Referenced_P1__getDatabaseOptions, + "Get the optional database osgDB::Options object used when loaded children. ", + ""); I_Method1(void, setDatabasePath, IN, const std::string &, path, Properties::NON_VIRTUAL, __void__setDatabasePath__C5_std_string_R1, @@ -224,6 +239,9 @@ BEGIN_OBJECT_REFLECTOR(osg::PagedLOD) __void__expandPerRangeDataTo__unsigned_int, "", ""); + I_SimpleProperty(osg::Referenced *, DatabaseOptions, + __osg_Referenced_P1__getDatabaseOptions, + __void__setDatabaseOptions__osg_Referenced_P1); I_SimpleProperty(const std::string &, DatabasePath, __C5_std_string_R1__getDatabasePath, __void__setDatabasePath__C5_std_string_R1); diff --git a/src/osgWrappers/osgDB/DatabasePager.cpp b/src/osgWrappers/osgDB/DatabasePager.cpp index ff88da767..ef07ebd13 100644 --- a/src/osgWrappers/osgDB/DatabasePager.cpp +++ b/src/osgWrappers/osgDB/DatabasePager.cpp @@ -19,7 +19,6 @@ #include #include #include -#include // Must undefine IN and OUT macros defined in Windows headers #ifdef IN @@ -69,16 +68,11 @@ BEGIN_OBJECT_REFLECTOR(osgDB::DatabasePager) __DatabasePager_P1__clone, "Create a shallow copy on the DatabasePager. ", ""); - I_Method5(void, requestNodeFile, IN, const std::string &, fileName, IN, osg::Group *, group, IN, float, priority, IN, const osg::FrameStamp *, framestamp, IN, osg::ref_ptr< osg::Referenced > &, databaseRequest, + I_Method6(void, requestNodeFile, IN, const std::string &, fileName, IN, osg::Group *, group, IN, float, priority, IN, const osg::FrameStamp *, framestamp, IN, osg::ref_ptr< osg::Referenced > &, databaseRequest, IN, const osg::Referenced *, options, Properties::VIRTUAL, - __void__requestNodeFile__C5_std_string_R1__osg_Group_P1__float__C5_osg_FrameStamp_P1__osg_ref_ptrT1_osg_Referenced__R1, + __void__requestNodeFile__C5_std_string_R1__osg_Group_P1__float__C5_osg_FrameStamp_P1__osg_ref_ptrT1_osg_Referenced__R1__C5_osg_Referenced_P1, "Add a request to load a node file to end the the database request list. ", ""); - I_Method6(void, requestNodeFile, IN, const std::string &, fileName, IN, osg::Group *, group, IN, float, priority, IN, const osg::FrameStamp *, framestamp, IN, osg::ref_ptr< osg::Referenced > &, databaseRequest, IN, osgDB::Options *, loadOptions, - Properties::VIRTUAL, - __void__requestNodeFile__C5_std_string_R1__osg_Group_P1__float__C5_osg_FrameStamp_P1__osg_ref_ptrT1_osg_Referenced__R1__Options_P1, - "", - ""); I_Method1(int, setSchedulePriority, IN, OpenThreads::Thread::ThreadPriority, priority, Properties::NON_VIRTUAL, __int__setSchedulePriority__OpenThreads_Thread_ThreadPriority, diff --git a/src/osgWrappers/osgDB/Options.cpp b/src/osgWrappers/osgDB/Options.cpp index 9e0916293..b6aacf848 100644 --- a/src/osgWrappers/osgDB/Options.cpp +++ b/src/osgWrappers/osgDB/Options.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -28,6 +29,30 @@ #undef OUT #endif +BEGIN_ENUM_REFLECTOR(osgDB::FileLocationCallback::Location) + I_DeclaringFile("osgDB/Options"); + I_EnumLabel(osgDB::FileLocationCallback::LOCAL_FILE); + I_EnumLabel(osgDB::FileLocationCallback::REMOTE_FILE); +END_REFLECTOR + +BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgDB::FileLocationCallback) + I_DeclaringFile("osgDB/Options"); + I_VirtualBaseType(osg::Referenced); + I_Constructor0(____FileLocationCallback, + "", + ""); + I_Method2(osgDB::FileLocationCallback::Location, fileLocation, IN, const std::string &, filename, IN, const osgDB::Options *, options, + Properties::PURE_VIRTUAL, + __Location__fileLocation__C5_std_string_R1__C5_Options_P1, + "", + ""); + I_Method0(bool, useFileCache, + Properties::PURE_VIRTUAL, + __bool__useFileCache, + "", + ""); +END_REFLECTOR + BEGIN_OBJECT_REFLECTOR(osgDB::FindFileCallback) I_DeclaringFile("osgDB/Options"); I_VirtualBaseType(osg::Referenced); @@ -223,13 +248,33 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Options) I_Method1(void, setWriteFileCallback, IN, osgDB::WriteFileCallback *, cb, Properties::NON_VIRTUAL, __void__setWriteFileCallback__WriteFileCallback_P1, - "Set the Registry callback to use in place of the default writeFile calls. ", + "Set the callback to use in place of the default writeFile calls. ", ""); I_Method0(osgDB::WriteFileCallback *, getWriteFileCallback, Properties::NON_VIRTUAL, __WriteFileCallback_P1__getWriteFileCallback, "Get the const writeFile callback. ", ""); + I_Method1(void, setFileLocationCallback, IN, osgDB::FileLocationCallback *, cb, + Properties::NON_VIRTUAL, + __void__setFileLocationCallback__FileLocationCallback_P1, + "Set the callback to use inform the DatabasePager whether a file is located on local or remote file system. ", + ""); + I_Method0(osgDB::FileLocationCallback *, getFileLocationCallback, + Properties::NON_VIRTUAL, + __FileLocationCallback_P1__getFileLocationCallback, + "Get the callback to use inform the DatabasePager whether a file is located on local or remote file system. ", + ""); + I_Method1(void, setFileCache, IN, osgDB::FileCache *, fileCache, + Properties::NON_VIRTUAL, + __void__setFileCache__FileCache_P1, + "Set the FileCache that is used to manage local storage of files downloaded from the internet. ", + ""); + I_Method0(osgDB::FileCache *, getFileCache, + Properties::NON_VIRTUAL, + __FileCache_P1__getFileCache, + "Get the FileCache that is used to manage local storage of files downloaded from the internet. ", + ""); I_SimpleProperty(osgDB::AuthenticationMap *, AuthenticationMap, 0, __void__setAuthenticationMap__AuthenticationMap_P1); @@ -242,6 +287,12 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Options) I_SimpleProperty(osgDB::FilePathList &, DatabasePathList, __FilePathList_R1__getDatabasePathList, 0); + I_SimpleProperty(osgDB::FileCache *, FileCache, + __FileCache_P1__getFileCache, + __void__setFileCache__FileCache_P1); + I_SimpleProperty(osgDB::FileLocationCallback *, FileLocationCallback, + __FileLocationCallback_P1__getFileLocationCallback, + __void__setFileLocationCallback__FileLocationCallback_P1); I_SimpleProperty(osgDB::FindFileCallback *, FindFileCallback, __FindFileCallback_P1__getFindFileCallback, __void__setFindFileCallback__FindFileCallback_P1); diff --git a/src/osgWrappers/osgDB/Registry.cpp b/src/osgWrappers/osgDB/Registry.cpp index 2bcb64160..6f7598da4 100644 --- a/src/osgWrappers/osgDB/Registry.cpp +++ b/src/osgWrappers/osgDB/Registry.cpp @@ -85,6 +85,8 @@ TYPE_NAME_ALIAS(class osgDB::ReadFileCallback, osgDB::Registry::ReadFileCallback TYPE_NAME_ALIAS(class osgDB::WriteFileCallback, osgDB::Registry::WriteFileCallback) +TYPE_NAME_ALIAS(class osgDB::FileLocationCallback, osgDB::Registry::FileLocationCallback) + BEGIN_OBJECT_REFLECTOR(osgDB::Registry) I_DeclaringFile("osgDB/Registry"); I_BaseType(osg::Referenced); @@ -412,6 +414,16 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Registry) __void___buildKdTreeIfRequired__ReaderWriter_ReadResult_R1__C5_Options_P1, "", ""); + I_Method1(void, setFileLocationCallback, IN, osgDB::Registry::FileLocationCallback *, cb, + Properties::NON_VIRTUAL, + __void__setFileLocationCallback__FileLocationCallback_P1, + "Set the callback to use inform the DatabasePager whether a file is located on local or remote file system. ", + ""); + I_Method0(osgDB::Registry::FileLocationCallback *, getFileLocationCallback, + Properties::NON_VIRTUAL, + __FileLocationCallback_P1__getFileLocationCallback, + "Get the callback to use inform the DatabasePager whether a file is located on local or remote file system. ", + ""); I_Method1(void, setBuildKdTreesHint, IN, osgDB::Options::BuildKdTreesHint, hint, Properties::NON_VIRTUAL, __void__setBuildKdTreesHint__Options_BuildKdTreesHint, @@ -666,6 +678,9 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Registry) I_SimpleProperty(osgDB::FileCache *, FileCache, __FileCache_P1__getFileCache, __void__setFileCache__FileCache_P1); + I_SimpleProperty(osgDB::Registry::FileLocationCallback *, FileLocationCallback, + __FileLocationCallback_P1__getFileLocationCallback, + __void__setFileLocationCallback__FileLocationCallback_P1); I_SimpleProperty(osgDB::Registry::FindFileCallback *, FindFileCallback, __FindFileCallback_P1__getFindFileCallback, __void__setFindFileCallback__FindFileCallback_P1);