From b7b065abe3c567ab6b9dfaafdfa59ff060368b58 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 9 May 2009 08:49:27 +0000 Subject: [PATCH] Refactored the Registry::ReadFileCallback, WriteFileCallback and ReaderWriter::Options to they are now defined in their own header and in the osgDB namespace. Introduced a new FindFileCallback to Registry to compliement the existing ReadFileCallback and WriteFileCallback. Added support for assign Find, Read and WriteFileCallbacks to osdDB::Options to enable plugins/applications to override the callbacks just for that read/write call and any nested file operations --- include/osgDB/Archive | 2 +- include/osgDB/DatabasePager | 6 +- include/osgDB/FileCache | 14 +- include/osgDB/FileUtils | 8 +- include/osgDB/ImageOptions | 6 +- include/osgDB/ImagePager | 3 +- include/osgDB/Input | 7 +- include/osgDB/Options | 272 +++++++++++++++++ include/osgDB/Output | 6 +- include/osgDB/ReadFile | 26 +- include/osgDB/ReaderWriter | 167 +---------- include/osgDB/Registry | 220 ++++++-------- include/osgDB/WriteFile | 10 +- include/osgDB/XmlParser | 4 +- include/osgVolume/Layer | 2 +- src/osg/Shader.cpp | 4 +- src/osgDB/Archive.cpp | 2 +- src/osgDB/CMakeLists.txt | 2 + src/osgDB/DatabasePager.cpp | 6 +- src/osgDB/FileCache.cpp | 4 +- src/osgDB/FileUtils.cpp | 82 +---- src/osgDB/Options.cpp | 94 ++++++ src/osgDB/Output.cpp | 2 +- src/osgDB/ReadFile.cpp | 24 +- src/osgDB/ReaderWriter.cpp | 1 + src/osgDB/Registry.cpp | 152 ++++++++-- src/osgDB/WriteFile.cpp | 10 +- src/osgDB/XmlParser.cpp | 2 +- src/osgPlugins/OpenFlight/Document.h | 1 + src/osgPlugins/OpenFlight/ExportOptions.h | 4 +- src/osgPlugins/ive/PagedLOD.cpp | 2 + src/osgPlugins/p3d/ReaderWriterP3D.cpp | 11 + src/osgWrappers/genwrapper.conf | 9 +- src/osgWrappers/osg/BoundingSphere.cpp | 2 +- src/osgWrappers/osgDB/Archive.cpp | 17 +- src/osgWrappers/osgDB/DatabasePager.cpp | 6 +- src/osgWrappers/osgDB/FileUtils.cpp | 6 - src/osgWrappers/osgDB/ImageOptions.cpp | 2 +- src/osgWrappers/osgDB/Input.cpp | 16 +- src/osgWrappers/osgDB/Options.cpp | 350 ++++++++++++++++++++++ src/osgWrappers/osgDB/Output.cpp | 2 +- src/osgWrappers/osgDB/ReaderWriter.cpp | 191 +----------- src/osgWrappers/osgDB/Registry.cpp | 248 +++++++-------- 43 files changed, 1180 insertions(+), 825 deletions(-) create mode 100644 include/osgDB/Options create mode 100644 src/osgDB/Options.cpp create mode 100644 src/osgWrappers/osgDB/Options.cpp diff --git a/include/osgDB/Archive b/include/osgDB/Archive index 3f67461f4..98b8701ee 100644 --- a/include/osgDB/Archive +++ b/include/osgDB/Archive @@ -68,7 +68,7 @@ class OSGDB_EXPORT Archive : public ReaderWriter OSGDB_EXPORT Archive* openArchive(const std::string& filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint=4096); /** Open an archive for reading or writing.*/ -OSGDB_EXPORT Archive* openArchive(const std::string& filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint,ReaderWriter::Options* options); +OSGDB_EXPORT Archive* openArchive(const std::string& filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint,Options* options); } #endif // OSGDB_ARCHIVE diff --git a/include/osgDB/DatabasePager b/include/osgDB/DatabasePager index 9f389568c..18b516f44 100644 --- a/include/osgDB/DatabasePager +++ b/include/osgDB/DatabasePager @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include @@ -70,7 +70,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl virtual void requestNodeFile(const std::string& fileName,osg::Group* group, float priority, const osg::FrameStamp* framestamp, osg::ref_ptr& databaseRequest, - ReaderWriter::Options* loadOptions); + Options* loadOptions); /** Set the priority of the database pager thread(s).*/ int setSchedulePriority(OpenThreads::Thread::ThreadPriority priority); @@ -375,7 +375,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl osg::observer_ptr _groupForAddingLoadedSubgraph; osg::ref_ptr _loadedModel; DataToCompileMap _dataToCompileMap; - osg::ref_ptr _loadOptions; + osg::ref_ptr _loadOptions; RequestQueue* _requestQueue; bool isRequestCurrent (int frameNumber) const diff --git a/include/osgDB/FileCache b/include/osgDB/FileCache index 19ce3c29b..0b52110b3 100644 --- a/include/osgDB/FileCache +++ b/include/osgDB/FileCache @@ -23,23 +23,23 @@ namespace osgDB { class OSGDB_EXPORT FileCache : public osg::Referenced { public: - + FileCache(const std::string& path); const std::string& getFileCachePath() const { return _fileCachePath; } virtual std::string createCacheFileName(const std::string& originalFileName) const; - + virtual bool existsInCache(const std::string& originalFileName) const; - - virtual ReaderWriter::ReadResult readNode(const std::string& originalFileName, const osgDB::ReaderWriter::Options* options, bool buildKdTreeIfRequired=true) const; - - virtual ReaderWriter::WriteResult writeNode(const osg::Node& node, const std::string& originalFileName, const osgDB::ReaderWriter::Options* options) const; + + virtual ReaderWriter::ReadResult readNode(const std::string& originalFileName, const osgDB::Options* options, bool buildKdTreeIfRequired=true) const; + + virtual ReaderWriter::WriteResult writeNode(const osg::Node& node, const std::string& originalFileName, const osgDB::Options* options) const; protected: virtual ~FileCache(); - + std::string _fileCachePath; }; diff --git a/include/osgDB/FileUtils b/include/osgDB/FileUtils index 2150cf492..50181aa3f 100644 --- a/include/osgDB/FileUtils +++ b/include/osgDB/FileUtils @@ -23,12 +23,6 @@ namespace osgDB { -enum CaseSensitivity -{ - CASE_SENSITIVE, - CASE_INSENSITIVE -}; - enum FileType { FILE_NOT_FOUND, @@ -86,7 +80,7 @@ extern OSGDB_EXPORT std::string findDataFile(const std::string& filename,CaseSen /** Search for specified file in file system, checking first the database path set in the Options structure, then the DataFilePathList for possible paths, * returning the full path of the first valid file found, return an empty string if no string is found. */ -extern OSGDB_EXPORT std::string findDataFile(const std::string& filename,const ReaderWriter::Options* options, CaseSensitivity caseSensitivity=CASE_SENSITIVE); +extern OSGDB_EXPORT std::string findDataFile(const std::string& filename,const Options* options, CaseSensitivity caseSensitivity=CASE_SENSITIVE); inline void setLibraryFilePathList(const FilePathList& filepaths) { osgDB::Registry::instance()->setLibraryFilePathList(filepaths); } diff --git a/include/osgDB/ImageOptions b/include/osgDB/ImageOptions index 248f36401..9bebec3a3 100644 --- a/include/osgDB/ImageOptions +++ b/include/osgDB/ImageOptions @@ -14,11 +14,11 @@ #ifndef OSGDB_IMAGEOPTIONS #define OSGDB_IMAGEOPTIONS 1 -#include +#include namespace osgDB { -class OSGDB_EXPORT ImageOptions : public osgDB::ReaderWriter::Options +class OSGDB_EXPORT ImageOptions : public osgDB::Options { public: @@ -27,7 +27,7 @@ class OSGDB_EXPORT ImageOptions : public osgDB::ReaderWriter::Options ImageOptions(const std::string& str); ImageOptions(const ImageOptions& options,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): - osgDB::ReaderWriter::Options(options,copyop), + osgDB::Options(options,copyop), _sourceImageSamplingMode(options._sourceImageSamplingMode), _sourceImageWindowMode(options._sourceImageWindowMode), _sourceRatioWindow(options._sourceRatioWindow), diff --git a/include/osgDB/ImagePager b/include/osgDB/ImagePager index 50f3d6aae..102ea70cc 100644 --- a/include/osgDB/ImagePager +++ b/include/osgDB/ImagePager @@ -23,6 +23,7 @@ #include #include +#include namespace osgDB { @@ -107,7 +108,7 @@ class OSGDB_EXPORT ImagePager : public osg::NodeVisitor::ImageRequestHandler double _timeToMergeBy; std::string _fileName; - osg::ref_ptr _loadOptions; + osg::ref_ptr _loadOptions; osg::observer_ptr _attachmentPoint; int _attachmentIndex; osg::ref_ptr _loadedImage; diff --git a/include/osgDB/Input b/include/osgDB/Input index bf44914db..05e504540 100644 --- a/include/osgDB/Input +++ b/include/osgDB/Input @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -39,8 +40,8 @@ class OSGDB_EXPORT Input : public FieldReaderIterator Input(); virtual ~Input(); - void setOptions(const ReaderWriter::Options* options) { _options = options; } - const ReaderWriter::Options* getOptions() const { return _options.get(); } + void setOptions(const Options* options) { _options = options; } + const Options* getOptions() const { return _options.get(); } virtual osg::Object* readObjectOfType(const osg::Object& compObj); virtual osg::Object* readObjectOfType(const basic_type_wrapper &btw); @@ -87,7 +88,7 @@ class OSGDB_EXPORT Input : public FieldReaderIterator typedef std::map< std::string, osg::ref_ptr > UniqueIDToObjectMapping; UniqueIDToObjectMapping _uniqueIDToObjectMap; - osg::ref_ptr _options; + osg::ref_ptr _options; }; diff --git a/include/osgDB/Options b/include/osgDB/Options new file mode 100644 index 000000000..3003566a8 --- /dev/null +++ b/include/osgDB/Options @@ -0,0 +1,272 @@ +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield + * + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * (at your option) any later version. The full license is in LICENSE file + * included with this distribution, and on the openscenegraph.org website. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * OpenSceneGraph Public License for more details. +*/ + +#ifndef OSGDB_OPTIONS +#define OSGDB_OPTIONS 1 + +#include +#include + +#include +#include +#include + +namespace osgDB { + +/** list of directories to search through which searching for files. */ +typedef std::deque FilePathList; + +enum CaseSensitivity +{ + CASE_SENSITIVE, + CASE_INSENSITIVE +}; + +// forward decare +class Options; + +class OSGDB_EXPORT FindFileCallback : public virtual osg::Referenced +{ + public: + + virtual std::string findDataFile(const std::string& filename, const Options* options, CaseSensitivity caseSensitivity); + + virtual std::string findLibraryFile(const std::string& filename, const Options* options, CaseSensitivity caseSensitivity); + + protected: + virtual ~FindFileCallback() {} +}; + + +class OSGDB_EXPORT ReadFileCallback : public virtual osg::Referenced +{ + public: + + virtual ReaderWriter::ReadResult openArchive(const std::string& filename,ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint, const Options* useObjectCache); + + virtual ReaderWriter::ReadResult readObject(const std::string& filename, const Options* options); + + virtual ReaderWriter::ReadResult readImage(const std::string& filename, const Options* options); + + virtual ReaderWriter::ReadResult readHeightField(const std::string& filename, const Options* options); + + virtual ReaderWriter::ReadResult readNode(const std::string& filename, const Options* options); + + virtual ReaderWriter::ReadResult readShader(const std::string& filename, const Options* options); + + protected: + virtual ~ReadFileCallback() {} +}; + +class OSGDB_EXPORT WriteFileCallback : public virtual osg::Referenced +{ + public: + + virtual ReaderWriter::WriteResult writeObject(const osg::Object& obj, const std::string& fileName,const Options* options); + + virtual ReaderWriter::WriteResult writeImage(const osg::Image& obj, const std::string& fileName,const Options* options); + + virtual ReaderWriter::WriteResult writeHeightField(const osg::HeightField& obj, const std::string& fileName,const Options* options); + + virtual ReaderWriter::WriteResult writeNode(const osg::Node& obj, const std::string& fileName,const Options* options); + + virtual ReaderWriter::WriteResult writeShader(const osg::Shader& obj, const std::string& fileName,const Options* options); + + protected: + virtual ~WriteFileCallback() {} +}; + +/** Options base class used for passing options into plugins to control their operation.*/ +class Options : public osg::Object +{ + public: + + /// bit mask for setting up which object types get cached by readObject/Image/HeightField/Node(filename) calls + enum CacheHintOptions + { /// do not cache objects of any type + CACHE_NONE = 0, + + /// cache nodes loaded via readNode(filename) + CACHE_NODES = 1<<0, + + /// cache images loaded via readImage(filename) + CACHE_IMAGES = 1<<1, + + /// cache heightfield loaded via readHeightField(filename) + CACHE_HEIGHTFIELDS = 1<<2, + + /// cache heightfield loaded via readHeightField(filename) + CACHE_ARCHIVES = 1<<3, + + /// cache objects loaded via readObject(filename) + CACHE_OBJECTS = 1<<4, + + /// cache shaders loaded via readShader(filename) + CACHE_SHADERS = 1<<5, + + /// cache on all read*(filename) calls + CACHE_ALL = CACHE_NODES | + CACHE_IMAGES | + CACHE_HEIGHTFIELDS | + CACHE_ARCHIVES | + CACHE_OBJECTS | + CACHE_SHADERS + }; + + /// range of options of whether to build kdtrees automatically on loading + enum BuildKdTreesHint + { + NO_PREFERENCE, + DO_NOT_BUILD_KDTREES, + BUILD_KDTREES + }; + + + Options(): + osg::Object(true), + _objectCacheHint(CACHE_ARCHIVES), + _buildKdTreesHint(NO_PREFERENCE) {} + + Options(const std::string& str): + osg::Object(true), + _str(str), + _objectCacheHint(CACHE_ARCHIVES), + _buildKdTreesHint(NO_PREFERENCE) {} + + Options(const Options& options,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): + osg::Object(options,copyop), + _str(options._str), + _databasePaths(options._databasePaths), + _objectCacheHint(options._objectCacheHint), + _buildKdTreesHint(options._buildKdTreesHint), + _pluginData(options._pluginData), + _pluginStringData(options._pluginStringData){} + + META_Object(osgDB,Options); + + /** Set the general Options string.*/ + void setOptionString(const std::string& str) { _str = str; } + + /** Get the general Options string.*/ + const std::string& getOptionString() const { return _str; } + + /** Set the database path to use a hint of where to look when loading models.*/ + void setDatabasePath(const std::string& str) { _databasePaths.clear(); _databasePaths.push_back(str); } + + /** Get the database path which is used a hint of where to look when loading models.*/ + FilePathList& getDatabasePathList() { return _databasePaths; } + + /** Get the const database path which is used a hint of where to look when loading models.*/ + const FilePathList& getDatabasePathList() const { return _databasePaths; } + + + /** Set whether the Registry::ObjectCache should be used by default.*/ + void setObjectCacheHint(CacheHintOptions useObjectCache) { _objectCacheHint = useObjectCache; } + + /** Get whether the Registry::ObjectCache should be used by default.*/ + CacheHintOptions getObjectCacheHint() const { return _objectCacheHint; } + + + /** Set whether the KdTrees should be built for geometry in the loader model. */ + void setBuildKdTreesHint(BuildKdTreesHint hint) { _buildKdTreesHint = hint; } + + /** Get whether the KdTrees should be built for geometry in the loader model. */ + BuildKdTreesHint getBuildKdTreesHint() const { return _buildKdTreesHint; } + + + /** Set the password map to be used by plugins when access files from secure locations.*/ + void setAuthenticationMap(AuthenticationMap* authenticationMap) { _authenticationMap = authenticationMap; } + + /** Get the password map to be used by plugins when access files from secure locations.*/ + const AuthenticationMap* getAuthenticationMap() const { return _authenticationMap.get(); } + + + /** Sets a plugindata value PluginData with a string */ + void setPluginData(const std::string& s, void* v) const { _pluginData[s] = v; } + + /** Get a value from the PluginData */ + void* getPluginData(const std::string& s) { return _pluginData[s]; } + + /** Get a value from the PluginData */ + const void* getPluginData(const std::string& s) const + { + PluginDataMap::const_iterator itr = _pluginData.find(s); + return (itr == _pluginData.end()) ? 0 : itr->second; + } + + /** Remove a value from the PluginData */ + void removePluginData(const std::string& s) const { _pluginData.erase(s); } + + + /** Sets a plugindata value PluginData with a string */ + void setPluginStringData(const std::string& s, const std::string& v) const { _pluginStringData[s] = v; } + + /** Get a string from the PluginStrData */ + std::string getPluginStringData(const std::string& s) { return _pluginStringData[s]; } + + /** Get a value from the PluginData */ + const std::string getPluginStringData(const std::string& s) const + { + PluginStringDataMap::const_iterator itr = _pluginStringData.find(s); + return (itr == _pluginStringData.end()) ? std::string("") : itr->second; + } + + /** Remove a value from the PluginData */ + void removePluginStringData(const std::string& s) const { _pluginStringData.erase(s); } + + + + /** Set the find callback to use in place of the default findFile calls.*/ + void setFindFileCallback( FindFileCallback* cb) { _findFileCallback = cb; } + + /** Get the const findFile callback.*/ + FindFileCallback* getFindFileCallback() const { return _findFileCallback.get(); } + + + /** Set the read callback to use in place of the default readFile calls.*/ + void setReadFileCallback( ReadFileCallback* cb) { _readFileCallback = cb; } + + /** Get the const readFile callback.*/ + ReadFileCallback* getReadFileCallback() const { return _readFileCallback.get(); } + + + /** Set the Registry 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(); } + + + protected: + + virtual ~Options() {} + + std::string _str; + FilePathList _databasePaths; + CacheHintOptions _objectCacheHint; + BuildKdTreesHint _buildKdTreesHint; + osg::ref_ptr _authenticationMap; + + typedef std::map PluginDataMap; + mutable PluginDataMap _pluginData; + typedef std::map PluginStringDataMap; + mutable PluginStringDataMap _pluginStringData; + + osg::ref_ptr _findFileCallback; + osg::ref_ptr _readFileCallback; + osg::ref_ptr _writeFileCallback; +}; + +} + +#endif // OSGDB_OPTIONS diff --git a/include/osgDB/Output b/include/osgDB/Output index 9acc24637..0617ed88f 100644 --- a/include/osgDB/Output +++ b/include/osgDB/Output @@ -36,8 +36,8 @@ class OSGDB_EXPORT Output : public osgDB::ofstream virtual ~Output(); - void setOptions(const ReaderWriter::Options* options); - const ReaderWriter::Options* getOptions() const { return _options.get(); } + void setOptions(const Options* options); + const Options* getOptions() const { return _options.get(); } void setWriteOutDefaultValues(bool flag) { _writeOutDefaultValues = flag; } bool getWriteOutDefaultValues() const { return _writeOutDefaultValues; } @@ -106,7 +106,7 @@ class OSGDB_EXPORT Output : public osgDB::ofstream virtual void init(); - osg::ref_ptr _options; + osg::ref_ptr _options; int _indent; int _indentStep; diff --git a/include/osgDB/ReadFile b/include/osgDB/ReadFile index 0fe1d030f..711157093 100644 --- a/include/osgDB/ReadFile +++ b/include/osgDB/ReadFile @@ -33,7 +33,7 @@ namespace osgDB { * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to read the specified file.*/ -extern OSGDB_EXPORT osg::Object* readObjectFile(const std::string& filename,const ReaderWriter::Options* options); +extern OSGDB_EXPORT osg::Object* readObjectFile(const std::string& filename,const Options* options); /** Read an osg::Object from file. * Return valid osg::Object on success, @@ -53,7 +53,7 @@ inline osg::Object* readObjectFile(const std::string& filename) * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to read the specified file.*/ -extern OSGDB_EXPORT osg::Image* readImageFile(const std::string& filename,const ReaderWriter::Options* options); +extern OSGDB_EXPORT osg::Image* readImageFile(const std::string& filename,const Options* options); /** Read an osg::Image from file. * Return valid osg::Image on success, @@ -73,7 +73,7 @@ inline osg::Image* readImageFile(const std::string& filename) * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to read the specified file.*/ -extern OSGDB_EXPORT osg::HeightField* readHeightFieldFile(const std::string& filename,const ReaderWriter::Options* options); +extern OSGDB_EXPORT osg::HeightField* readHeightFieldFile(const std::string& filename,const Options* options); /** Read an osg::HeightField from file. * Return valid osg::HeightField on success, @@ -93,7 +93,7 @@ inline osg::HeightField* readHeightFieldFile(const std::string& filename) * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to read the specified file.*/ -extern OSGDB_EXPORT osg::Node* readNodeFile(const std::string& filename,const ReaderWriter::Options* options); +extern OSGDB_EXPORT osg::Node* readNodeFile(const std::string& filename,const Options* options); /** Read an osg::Node from file. * Return valid osg::Node on success, @@ -110,7 +110,7 @@ inline osg::Node* readNodeFile(const std::string& filename) /** Read an osg::Node subgraph from files, creating a osg::Group to contain the nodes if more * than one subgraph has been loaded. * Use the Options object to control cache operations and file search paths in osgDB::Registry.*/ -extern OSGDB_EXPORT osg::Node* readNodeFiles(std::vector& commandLine,const ReaderWriter::Options* options); +extern OSGDB_EXPORT osg::Node* readNodeFiles(std::vector& commandLine,const Options* options); /** Read an osg::Node subgraph from files, creating a osg::Group to contain the nodes if more * than one subgraph has been loaded.*/ @@ -123,7 +123,7 @@ inline osg::Node* readNodeFiles(std::vector& commandLine) /** Read an osg::Node subgraph from files, creating a osg::Group to contain the nodes if more * than one subgraph has been loaded. * Use the Options object to control cache operations and file search paths in osgDB::Registry.*/ -extern OSGDB_EXPORT osg::Node* readNodeFiles(osg::ArgumentParser& parser,const ReaderWriter::Options* options); +extern OSGDB_EXPORT osg::Node* readNodeFiles(osg::ArgumentParser& parser,const Options* options); /** Read an osg::Node subgraph from files, creating a osg::Group to contain the nodes if more * than one subgraph has been loaded.*/ @@ -139,7 +139,7 @@ inline osg::Node* readNodeFiles(osg::ArgumentParser& parser) * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to read the specified file.*/ -extern OSGDB_EXPORT osg::Shader* readShaderFile(const std::string& filename,const ReaderWriter::Options* options); +extern OSGDB_EXPORT osg::Shader* readShaderFile(const std::string& filename,const Options* options); /** Read an osg::Shader from file. * Return valid osg::Shader on success, @@ -159,7 +159,7 @@ inline osg::Shader* readShaderFile(const std::string& filename) * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to read the specified file.*/ -inline osg::Shader* readShaderFile(osg::Shader::Type type, const std::string& filename,const ReaderWriter::Options* options) +inline osg::Shader* readShaderFile(osg::Shader::Type type, const std::string& filename,const Options* options) { osg::Shader* shader = readShaderFile(filename, options); if (shader && type != osg::Shader::UNDEFINED) shader->setType(type); @@ -184,7 +184,7 @@ inline osg::Shader* readShaderFile(osg::Shader::Type type, const std::string& fi * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to read the specified file.*/ -extern OSGDB_EXPORT osg::ref_ptr readRefObjectFile(const std::string& filename,const ReaderWriter::Options* options); +extern OSGDB_EXPORT osg::ref_ptr readRefObjectFile(const std::string& filename,const Options* options); /** Read an osg::Object from file. * Return an assigned osg::ref_ptr on success, @@ -204,7 +204,7 @@ inline osg::ref_ptr readRefObjectFile(const std::string& filename) * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to read the specified file.*/ -extern OSGDB_EXPORT osg::ref_ptr readRefImageFile(const std::string& filename,const ReaderWriter::Options* options); +extern OSGDB_EXPORT osg::ref_ptr readRefImageFile(const std::string& filename,const Options* options); /** Read an osg::Image from file. * Return an assigned osg::ref_ptr on success, @@ -224,7 +224,7 @@ inline osg::ref_ptr readRefImageFile(const std::string& filename) * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to read the specified file.*/ -extern OSGDB_EXPORT osg::ref_ptr readRefHeightFieldFile(const std::string& filename,const ReaderWriter::Options* options); +extern OSGDB_EXPORT osg::ref_ptr readRefHeightFieldFile(const std::string& filename,const Options* options); /** Read an osg::HeightField from file. * Return an assigned osg::ref_ptr on success, @@ -244,7 +244,7 @@ inline osg::ref_ptr readRefHeightFieldFile(const std::string& * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to read the specified file.*/ -extern OSGDB_EXPORT osg::ref_ptr readRefNodeFile(const std::string& filename,const ReaderWriter::Options* options); +extern OSGDB_EXPORT osg::ref_ptr readRefNodeFile(const std::string& filename,const Options* options); /** Read an osg::Node from file. * Return an assigned osg::ref_ptr on success, @@ -264,7 +264,7 @@ inline osg::ref_ptr readRefNodeFile(const std::string& filename) * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to read the specified file.*/ -extern OSGDB_EXPORT osg::ref_ptr readRefShaderFile(const std::string& filename,const ReaderWriter::Options* options); +extern OSGDB_EXPORT osg::ref_ptr readRefShaderFile(const std::string& filename,const Options* options); /** Read an osg::Shader from file. * Return an assigned osg::ref_ptr on success, diff --git a/include/osgDB/ReaderWriter b/include/osgDB/ReaderWriter index a050d3ca9..ee2d7fb1c 100644 --- a/include/osgDB/ReaderWriter +++ b/include/osgDB/ReaderWriter @@ -31,6 +31,9 @@ class Archive; /** list of directories to search through which searching for files. */ typedef std::deque FilePathList; +// forward declare +class Options; + /** pure virtual base class for reading and writing of non native formats. */ class OSGDB_EXPORT ReaderWriter : public osg::Object { @@ -52,10 +55,10 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object /** return which protocols are supported by ReaderWriter. */ virtual const FormatDescriptionMap& supportedProtocols() const { return _supportedProtocols; } - + /** return which list of file extensions supported by ReaderWriter. */ virtual const FormatDescriptionMap& supportedExtensions() const { return _supportedExtensions; } - + /** return which list of file extensions supported by ReaderWriter. */ virtual const FormatDescriptionMap& supportedOptions() const { return _supportedOptions; } @@ -93,164 +96,6 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object /** return feature as string */ static FeatureList featureAsString(Features feature); - /** Options base class used for passing options into plugins to control their operation.*/ - class Options : public osg::Object - { - public: - - - /// bit mask for setting up which object types get cached by readObject/Image/HeightField/Node(filename) calls - enum CacheHintOptions - { /// do not cache objects of any type - CACHE_NONE = 0, - - /// cache nodes loaded via readNode(filename) - CACHE_NODES = 1<<0, - - /// cache images loaded via readImage(filename) - CACHE_IMAGES = 1<<1, - - /// cache heightfield loaded via readHeightField(filename) - CACHE_HEIGHTFIELDS = 1<<2, - - /// cache heightfield loaded via readHeightField(filename) - CACHE_ARCHIVES = 1<<3, - - /// cache objects loaded via readObject(filename) - CACHE_OBJECTS = 1<<4, - - /// cache shaders loaded via readShader(filename) - CACHE_SHADERS = 1<<5, - - /// cache on all read*(filename) calls - CACHE_ALL = CACHE_NODES | - CACHE_IMAGES | - CACHE_HEIGHTFIELDS | - CACHE_ARCHIVES | - CACHE_OBJECTS | - CACHE_SHADERS - }; - - /// range of options of whether to build kdtrees automatically on loading - enum BuildKdTreesHint - { - NO_PREFERENCE, - DO_NOT_BUILD_KDTREES, - BUILD_KDTREES - }; - - - Options(): - osg::Object(true), - _objectCacheHint(CACHE_ARCHIVES), - _buildKdTreesHint(NO_PREFERENCE) {} - - Options(const std::string& str): - osg::Object(true), - _str(str), - _objectCacheHint(CACHE_ARCHIVES), - _buildKdTreesHint(NO_PREFERENCE) {} - - Options(const Options& options,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): - osg::Object(options,copyop), - _str(options._str), - _databasePaths(options._databasePaths), - _objectCacheHint(options._objectCacheHint), - _buildKdTreesHint(options._buildKdTreesHint), - _pluginData(options._pluginData), - _pluginStringData(options._pluginStringData){} - - META_Object(osgDB,Options); - - /** Set the general Options string.*/ - void setOptionString(const std::string& str) { _str = str; } - - /** Get the general Options string.*/ - const std::string& getOptionString() const { return _str; } - - /** Set the database path to use a hint of where to look when loading models.*/ - void setDatabasePath(const std::string& str) { _databasePaths.clear(); _databasePaths.push_back(str); } - - /** Get the database path which is used a hint of where to look when loading models.*/ - FilePathList& getDatabasePathList() { return _databasePaths; } - - /** Get the const database path which is used a hint of where to look when loading models.*/ - const FilePathList& getDatabasePathList() const { return _databasePaths; } - - - /** Set whether the Registry::ObjectCache should be used by default.*/ - void setObjectCacheHint(CacheHintOptions useObjectCache) { _objectCacheHint = useObjectCache; } - - /** Get whether the Registry::ObjectCache should be used by default.*/ - CacheHintOptions getObjectCacheHint() const { return _objectCacheHint; } - - - /** Set whether the KdTrees should be built for geometry in the loader model. */ - void setBuildKdTreesHint(BuildKdTreesHint hint) { _buildKdTreesHint = hint; } - - /** Get whether the KdTrees should be built for geometry in the loader model. */ - BuildKdTreesHint getBuildKdTreesHint() const { return _buildKdTreesHint; } - - - /** Set the password map to be used by plugins when access files from secure locations.*/ - void setAuthenticationMap(AuthenticationMap* authenticationMap) { _authenticationMap = authenticationMap; } - - /** Get the password map to be used by plugins when access files from secure locations.*/ - const AuthenticationMap* getAuthenticationMap() const { return _authenticationMap.get(); } - - - /** Sets a plugindata value PluginData with a string */ - void setPluginData(const std::string& s, void* v) const { _pluginData[s] = v; } - - /** Get a value from the PluginData */ - void* getPluginData(const std::string& s) { return _pluginData[s]; } - - /** Get a value from the PluginData */ - const void* getPluginData(const std::string& s) const - { - PluginDataMap::const_iterator itr = _pluginData.find(s); - return (itr == _pluginData.end()) ? 0 : itr->second; - } - - /** Remove a value from the PluginData */ - void removePluginData(const std::string& s) const { _pluginData.erase(s); } - - - /** Sets a plugindata value PluginData with a string */ - void setPluginStringData(const std::string& s, const std::string& v) const { _pluginStringData[s] = v; } - - /** Get a string from the PluginStrData */ - std::string getPluginStringData(const std::string& s) { return _pluginStringData[s]; } - - /** Get a value from the PluginData */ - const std::string getPluginStringData(const std::string& s) const - { - PluginStringDataMap::const_iterator itr = _pluginStringData.find(s); - return (itr == _pluginStringData.end()) ? std::string("") : itr->second; - } - - /** Remove a value from the PluginData */ - void removePluginStringData(const std::string& s) const { _pluginStringData.erase(s); } - - - - - protected: - - virtual ~Options() {} - - std::string _str; - FilePathList _databasePaths; - CacheHintOptions _objectCacheHint; - BuildKdTreesHint _buildKdTreesHint; - osg::ref_ptr _authenticationMap; - - typedef std::map PluginDataMap; - mutable PluginDataMap _pluginData; - typedef std::map PluginStringDataMap; - mutable PluginStringDataMap _pluginStringData; - - }; class OSGDB_EXPORT ReadResult @@ -353,6 +198,8 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object CREATE }; + typedef osgDB::Options Options; + /** open an archive for reading, writing, or to create an empty archive for writing to.*/ virtual ReadResult openArchive(const std::string& /*fileName*/,ArchiveStatus, unsigned int =4096, const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); } diff --git a/include/osgDB/Registry b/include/osgDB/Registry index 73e9f25bc..62182465d 100644 --- a/include/osgDB/Registry +++ b/include/osgDB/Registry @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -159,43 +160,38 @@ class OSGDB_EXPORT Registry : public osg::Referenced bool writeObject(const osg::Object& obj,Output& fw); - class ReadFileCallback : public virtual osg::Referenced + + typedef class osgDB::FindFileCallback FindFileCallback; + typedef class osgDB::ReadFileCallback ReadFileCallback; + typedef class osgDB::WriteFileCallback WriteFileCallback; + + /** Set the Registry callback to use in place of the default findFile calls.*/ + void setFindFileCallback( FindFileCallback* cb) { _findFileCallback = cb; } + + /** Get the findFile callback.*/ + FindFileCallback* getFindFileCallback() { return _findFileCallback.get(); } + + /** Get the const findFile callback.*/ + const FindFileCallback* getFindFileCallback() const { return _findFileCallback.get(); } + + + std::string findDataFile(const std::string& fileName, const Options* options, CaseSensitivity caseSensitivity) { - public: - - virtual ReaderWriter::ReadResult openArchive(const std::string& filename,ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint, const ReaderWriter::Options* useObjectCache) - { - return osgDB::Registry::instance()->openArchiveImplementation(filename, status, indexBlockSizeHint, useObjectCache); - } - - virtual ReaderWriter::ReadResult readObject(const std::string& filename, const ReaderWriter::Options* options) - { - return osgDB::Registry::instance()->readObjectImplementation(filename,options); - } + if (options && options->getFindFileCallback()) return options->getFindFileCallback()->findDataFile(fileName, options, caseSensitivity); + else if (_findFileCallback.valid()) return _findFileCallback->findDataFile(fileName, options, caseSensitivity); + else return findDataFileImplementation(fileName, options, caseSensitivity); + } + std::string findDataFileImplementation(const std::string& fileName, const Options* options, CaseSensitivity caseSensitivity); + + std::string findLibraryFile(const std::string& fileName, const Options* options, CaseSensitivity caseSensitivity) + { + if (options && options->getFindFileCallback()) return options->getFindFileCallback()->findLibraryFile(fileName, options, caseSensitivity); + else if (_findFileCallback.valid()) return _findFileCallback->findLibraryFile(fileName, options, caseSensitivity); + else return findLibraryFileImplementation(fileName, options, caseSensitivity); + } + std::string findLibraryFileImplementation(const std::string& fileName, const Options* options, CaseSensitivity caseSensitivity); - virtual ReaderWriter::ReadResult readImage(const std::string& filename, const ReaderWriter::Options* options) - { - return osgDB::Registry::instance()->readImageImplementation(filename,options); - } - - virtual ReaderWriter::ReadResult readHeightField(const std::string& filename, const ReaderWriter::Options* options) - { - return osgDB::Registry::instance()->readHeightFieldImplementation(filename,options); - } - - virtual ReaderWriter::ReadResult readNode(const std::string& filename, const ReaderWriter::Options* options) - { - return osgDB::Registry::instance()->readNodeImplementation(filename,options); - } - virtual ReaderWriter::ReadResult readShader(const std::string& filename, const ReaderWriter::Options* options) - { - return osgDB::Registry::instance()->readShaderImplementation(filename,options); - } - - protected: - virtual ~ReadFileCallback() {} - }; /** Set the Registry callback to use in place of the default readFile calls.*/ void setReadFileCallback( ReadFileCallback* cb) { _readFileCallback = cb; } @@ -207,93 +203,65 @@ class OSGDB_EXPORT Registry : public osg::Referenced const ReadFileCallback* getReadFileCallback() const { return _readFileCallback.get(); } - ReaderWriter::ReadResult openArchive(const std::string& fileName,ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint, const ReaderWriter::Options* options) + ReaderWriter::ReadResult openArchive(const std::string& fileName,ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint, const Options* options) { - if (_readFileCallback.valid()) return _readFileCallback->openArchive(fileName, status, indexBlockSizeHint, options); + if (options && options->getReadFileCallback()) return options->getReadFileCallback()->openArchive(fileName, status, indexBlockSizeHint, options); + else if (_readFileCallback.valid()) return _readFileCallback->openArchive(fileName, status, indexBlockSizeHint, options); else return openArchiveImplementation(fileName, status, indexBlockSizeHint, options); } - ReaderWriter::ReadResult openArchiveImplementation(const std::string& fileName, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint, const ReaderWriter::Options* options); + ReaderWriter::ReadResult openArchiveImplementation(const std::string& fileName, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint, const Options* options); - ReaderWriter::ReadResult readObject(const std::string& fileName,const ReaderWriter::Options* options, bool buildKdTreeIfRequired=true) + ReaderWriter::ReadResult readObject(const std::string& fileName,const Options* options, bool buildKdTreeIfRequired=true) { - ReaderWriter::ReadResult result = _readFileCallback.valid() ? - _readFileCallback->readObject(fileName,options) : - readObjectImplementation(fileName,options); - + ReaderWriter::ReadResult result; + if (options && options->getReadFileCallback()) result = options->getReadFileCallback()->readObject(fileName,options); + else if (_readFileCallback.valid()) result = _readFileCallback->readObject(fileName,options); + else result = readObjectImplementation(fileName,options); + if (buildKdTreeIfRequired) _buildKdTreeIfRequired(result, options); - + return result; } - ReaderWriter::ReadResult readObjectImplementation(const std::string& fileName,const ReaderWriter::Options* options); - - ReaderWriter::ReadResult readImage(const std::string& fileName,const ReaderWriter::Options* options) + ReaderWriter::ReadResult readObjectImplementation(const std::string& fileName,const Options* options); + + ReaderWriter::ReadResult readImage(const std::string& fileName,const Options* options) { - if (_readFileCallback.valid()) return _readFileCallback->readImage(fileName,options); + if (options && options->getReadFileCallback()) return options->getReadFileCallback()->readImage(fileName,options); + else if (_readFileCallback.valid()) return _readFileCallback->readImage(fileName,options); else return readImageImplementation(fileName,options); } - ReaderWriter::ReadResult readImageImplementation(const std::string& fileName,const ReaderWriter::Options* options); + ReaderWriter::ReadResult readImageImplementation(const std::string& fileName,const Options* options); - ReaderWriter::ReadResult readHeightField(const std::string& fileName,const ReaderWriter::Options* options) + ReaderWriter::ReadResult readHeightField(const std::string& fileName,const Options* options) { - if (_readFileCallback.valid()) return _readFileCallback->readHeightField(fileName,options); + if (options && options->getReadFileCallback()) return options->getReadFileCallback()->readHeightField(fileName,options); + else if (_readFileCallback.valid()) return _readFileCallback->readHeightField(fileName,options); else return readHeightFieldImplementation(fileName,options); } - ReaderWriter::ReadResult readHeightFieldImplementation(const std::string& fileName,const ReaderWriter::Options* options); + ReaderWriter::ReadResult readHeightFieldImplementation(const std::string& fileName,const Options* options); - ReaderWriter::ReadResult readNode(const std::string& fileName,const ReaderWriter::Options* options, bool buildKdTreeIfRequired=true) + ReaderWriter::ReadResult readNode(const std::string& fileName,const Options* options, bool buildKdTreeIfRequired=true) { - ReaderWriter::ReadResult result = _readFileCallback.valid() ? - _readFileCallback->readNode(fileName,options) : - readNodeImplementation(fileName,options); - + ReaderWriter::ReadResult result; + if (options && options->getReadFileCallback()) result = options->getReadFileCallback()->readNode(fileName,options); + else if (_readFileCallback.valid()) result = _readFileCallback->readNode(fileName,options); + else result = readNodeImplementation(fileName,options); + if (buildKdTreeIfRequired) _buildKdTreeIfRequired(result, options); - + return result; } - ReaderWriter::ReadResult readNodeImplementation(const std::string& fileName,const ReaderWriter::Options* options); + ReaderWriter::ReadResult readNodeImplementation(const std::string& fileName,const Options* options); - ReaderWriter::ReadResult readShader(const std::string& fileName,const ReaderWriter::Options* options) + ReaderWriter::ReadResult readShader(const std::string& fileName,const Options* options) { + if (options && options->getReadFileCallback()) return options->getReadFileCallback()->readShader(fileName,options); if (_readFileCallback.valid()) return _readFileCallback->readShader(fileName,options); else return readShaderImplementation(fileName,options); } - ReaderWriter::ReadResult readShaderImplementation(const std::string& fileName,const ReaderWriter::Options* options); + ReaderWriter::ReadResult readShaderImplementation(const std::string& fileName,const Options* options); - - class WriteFileCallback : public virtual osg::Referenced - { - public: - - virtual ReaderWriter::WriteResult writeObject(const osg::Object& obj, const std::string& fileName,const ReaderWriter::Options* options) - { - return osgDB::Registry::instance()->writeObjectImplementation(obj,fileName,options); - } - - virtual ReaderWriter::WriteResult writeImage(const osg::Image& obj, const std::string& fileName,const ReaderWriter::Options* options) - { - return osgDB::Registry::instance()->writeImageImplementation(obj,fileName,options); - } - - virtual ReaderWriter::WriteResult writeHeightField(const osg::HeightField& obj, const std::string& fileName,const ReaderWriter::Options* options) - { - return osgDB::Registry::instance()->writeHeightFieldImplementation(obj,fileName,options); - } - - virtual ReaderWriter::WriteResult writeNode(const osg::Node& obj, const std::string& fileName,const ReaderWriter::Options* options) - { - return osgDB::Registry::instance()->writeNodeImplementation(obj,fileName,options); - } - - virtual ReaderWriter::WriteResult writeShader(const osg::Shader& obj, const std::string& fileName,const ReaderWriter::Options* options) - { - return osgDB::Registry::instance()->writeShaderImplementation(obj,fileName,options); - } - - protected: - virtual ~WriteFileCallback() {} - }; - /** Set the Registry callback to use in place of the default writeFile calls.*/ void setWriteFileCallback( WriteFileCallback* cb) { _writeFileCallback = cb; } @@ -304,47 +272,52 @@ class OSGDB_EXPORT Registry : public osg::Referenced const WriteFileCallback* getWriteFileCallback() const { return _writeFileCallback.get(); } - ReaderWriter::WriteResult writeObject(const osg::Object& obj, const std::string& fileName,const ReaderWriter::Options* options) + ReaderWriter::WriteResult writeObject(const osg::Object& obj, const std::string& fileName,const Options* options) { - if (_writeFileCallback.valid()) return _writeFileCallback->writeObject(obj,fileName,options); + if (options && options->getWriteFileCallback()) return options->getWriteFileCallback()->writeObject(obj,fileName,options); + else if (_writeFileCallback.valid()) return _writeFileCallback->writeObject(obj,fileName,options); else return writeObjectImplementation(obj,fileName,options); } - ReaderWriter::WriteResult writeObjectImplementation(const osg::Object& obj, const std::string& fileName,const ReaderWriter::Options* options); + ReaderWriter::WriteResult writeObjectImplementation(const osg::Object& obj, const std::string& fileName,const Options* options); - ReaderWriter::WriteResult writeImage(const osg::Image& obj, const std::string& fileName,const ReaderWriter::Options* options) + ReaderWriter::WriteResult writeImage(const osg::Image& obj, const std::string& fileName,const Options* options) { - if (_writeFileCallback.valid()) return _writeFileCallback->writeImage(obj,fileName,options); + if (options && options->getWriteFileCallback()) return options->getWriteFileCallback()->writeImage(obj,fileName,options); + else if (_writeFileCallback.valid()) return _writeFileCallback->writeImage(obj,fileName,options); else return writeImageImplementation(obj,fileName,options); } - ReaderWriter::WriteResult writeImageImplementation(const osg::Image& obj, const std::string& fileName,const ReaderWriter::Options* options); + ReaderWriter::WriteResult writeImageImplementation(const osg::Image& obj, const std::string& fileName,const Options* options); - ReaderWriter::WriteResult writeHeightField(const osg::HeightField& obj, const std::string& fileName,const ReaderWriter::Options* options) + ReaderWriter::WriteResult writeHeightField(const osg::HeightField& obj, const std::string& fileName,const Options* options) { - if (_writeFileCallback.valid()) return _writeFileCallback->writeHeightField(obj,fileName,options); + if (options && options->getWriteFileCallback()) return options->getWriteFileCallback()->writeHeightField(obj,fileName,options); + else if (_writeFileCallback.valid()) return _writeFileCallback->writeHeightField(obj,fileName,options); else return writeHeightFieldImplementation(obj,fileName,options); } - ReaderWriter::WriteResult writeHeightFieldImplementation(const osg::HeightField& obj, const std::string& fileName,const ReaderWriter::Options* options); + ReaderWriter::WriteResult writeHeightFieldImplementation(const osg::HeightField& obj, const std::string& fileName,const Options* options); - ReaderWriter::WriteResult writeNode(const osg::Node& node, const std::string& fileName,const ReaderWriter::Options* options) + ReaderWriter::WriteResult writeNode(const osg::Node& node, const std::string& fileName,const Options* options) { - if (_writeFileCallback.valid()) return _writeFileCallback->writeNode(node,fileName,options); + if (options && options->getWriteFileCallback()) return options->getWriteFileCallback()->writeNode(node,fileName,options); + else if (_writeFileCallback.valid()) return _writeFileCallback->writeNode(node,fileName,options); else return writeNodeImplementation(node,fileName,options); } - ReaderWriter::WriteResult writeNodeImplementation(const osg::Node& node, const std::string& fileName,const ReaderWriter::Options* options); + ReaderWriter::WriteResult writeNodeImplementation(const osg::Node& node, const std::string& fileName,const Options* options); - ReaderWriter::WriteResult writeShader(const osg::Shader& obj, const std::string& fileName,const ReaderWriter::Options* options) + ReaderWriter::WriteResult writeShader(const osg::Shader& obj, const std::string& fileName,const Options* options) { - if (_writeFileCallback.valid()) return _writeFileCallback->writeShader(obj,fileName,options); + if (options && options->getWriteFileCallback()) return options->getWriteFileCallback()->writeShader(obj,fileName,options); + else if (_writeFileCallback.valid()) return _writeFileCallback->writeShader(obj,fileName,options); else return writeShaderImplementation(obj,fileName,options); } - ReaderWriter::WriteResult writeShaderImplementation(const osg::Shader& obj, const std::string& fileName,const ReaderWriter::Options* options); + ReaderWriter::WriteResult writeShaderImplementation(const osg::Shader& obj, const std::string& fileName,const Options* options); - inline void _buildKdTreeIfRequired(ReaderWriter::ReadResult& result, const ReaderWriter::Options* options) + inline void _buildKdTreeIfRequired(ReaderWriter::ReadResult& result, const Options* options) { - bool doKdTreeBuilder = (options && options->getBuildKdTreesHint()!=ReaderWriter::Options::NO_PREFERENCE) ? - options->getBuildKdTreesHint() == ReaderWriter::Options::BUILD_KDTREES : - _buildKdTreesHint == ReaderWriter::Options::BUILD_KDTREES; + bool doKdTreeBuilder = (options && options->getBuildKdTreesHint()!=Options::NO_PREFERENCE) ? + options->getBuildKdTreesHint() == Options::BUILD_KDTREES : + _buildKdTreesHint == Options::BUILD_KDTREES; if (doKdTreeBuilder && _kdTreeBuilder.valid() && result.validNode()) { @@ -355,10 +328,10 @@ class OSGDB_EXPORT Registry : public osg::Referenced /** Set whether the KdTrees should be built for geometry in the loader model. */ - void setBuildKdTreesHint(ReaderWriter::Options::BuildKdTreesHint hint) { _buildKdTreesHint = hint; } + void setBuildKdTreesHint(Options::BuildKdTreesHint hint) { _buildKdTreesHint = hint; } /** Get whether the KdTrees should be built for geometry in the loader model. */ - ReaderWriter::Options::BuildKdTreesHint getBuildKdTreesHint() const { return _buildKdTreesHint; } + Options::BuildKdTreesHint getBuildKdTreesHint() const { return _buildKdTreesHint; } /** Set the KdTreeBuilder visitor that is used to build KdTree on loaded models.*/ void setKdTreeBuilder(osg::KdTreeBuilder* builder) { _kdTreeBuilder = builder; } @@ -390,9 +363,9 @@ class OSGDB_EXPORT Registry : public osg::Referenced bool getCreateNodeFromImage() const { return _createNodeFromImage; } - void setOptions(ReaderWriter::Options* opt) { _options = opt; } - ReaderWriter::Options* getOptions() { return _options.get(); } - const ReaderWriter::Options* getOptions() const { return _options.get(); } + void setOptions(Options* opt) { _options = opt; } + Options* getOptions() { return _options.get(); } + const Options* getOptions() const { return _options.get(); } /** initialize both the Data and Library FilePaths, by default called by the @@ -519,7 +492,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced /** get the attached library with specified name.*/ DynamicLibraryList::iterator getLibraryItr(const std::string& fileName); - ReaderWriter::Options::BuildKdTreesHint _buildKdTreesHint; + Options::BuildKdTreesHint _buildKdTreesHint; osg::ref_ptr _kdTreeBuilder; osg::ref_ptr _fileCache; @@ -538,7 +511,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced /** Functor used in internal implementations.*/ struct ReadFunctor { - ReadFunctor(const std::string& filename, const ReaderWriter::Options* options): + ReadFunctor(const std::string& filename, const Options* options): _filename(filename), _options(options) {} @@ -548,7 +521,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced virtual bool isValid(osg::Object* object) const = 0; std::string _filename; - const ReaderWriter::Options* _options; + const Options* _options; }; protected: @@ -573,7 +546,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced friend struct ReadShaderFunctor; ReaderWriter::ReadResult read(const ReadFunctor& readFunctor); - ReaderWriter::ReadResult readImplementation(const ReadFunctor& readFunctor,ReaderWriter::Options::CacheHintOptions cacheHint); + ReaderWriter::ReadResult readImplementation(const ReadFunctor& readFunctor,Options::CacheHintOptions cacheHint); // forward declare helper class @@ -581,6 +554,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced friend class AvailableReaderWriterIterator; + osg::ref_ptr _findFileCallback; osg::ref_ptr _readFileCallback; osg::ref_ptr _writeFileCallback; @@ -610,7 +584,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced static std::string trim( const std::string& str ); // options to pass to reader writers. - osg::ref_ptr _options; + osg::ref_ptr _options; FilePathList _dataFilePath; FilePathList _libraryFilePath; diff --git a/include/osgDB/WriteFile b/include/osgDB/WriteFile index 72e8bd63e..2567edb4d 100644 --- a/include/osgDB/WriteFile +++ b/include/osgDB/WriteFile @@ -32,7 +32,7 @@ namespace osgDB { * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to write the specified file.*/ -extern OSGDB_EXPORT bool writeObjectFile(const osg::Object& object, const std::string& filename, const ReaderWriter::Options* options ); +extern OSGDB_EXPORT bool writeObjectFile(const osg::Object& object, const std::string& filename, const Options* options ); /** Write an osg::Object to file. * Return true on success, @@ -52,7 +52,7 @@ inline bool writeObjectFile(const osg::Object& object, const std::string& filena * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to write the specified file.*/ -extern OSGDB_EXPORT bool writeImageFile(const osg::Image& image, const std::string& filename, const ReaderWriter::Options* options ); +extern OSGDB_EXPORT bool writeImageFile(const osg::Image& image, const std::string& filename, const Options* options ); /** Write an osg::Image to file. * Return true on success, @@ -72,7 +72,7 @@ inline bool writeImageFile(const osg::Image& image, const std::string& filename) * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to write the specified file.*/ -extern OSGDB_EXPORT bool writeHeightFieldFile(const osg::HeightField& hf, const std::string& filename, const ReaderWriter::Options* options ); +extern OSGDB_EXPORT bool writeHeightFieldFile(const osg::HeightField& hf, const std::string& filename, const Options* options ); /** Write an osg::HeightField to file. * Return true on success, @@ -92,7 +92,7 @@ inline bool writeHeightFieldFile(const osg::HeightField& hf, const std::string& * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to write the specified file.*/ -extern OSGDB_EXPORT bool writeNodeFile(const osg::Node& node, const std::string& filename, const ReaderWriter::Options* options ); +extern OSGDB_EXPORT bool writeNodeFile(const osg::Node& node, const std::string& filename, const Options* options ); /** Write an osg::Node to file. * Return true on success, @@ -112,7 +112,7 @@ inline bool writeNodeFile(const osg::Node& node, const std::string& filename) * The osgDB::Registry is used to load the appropriate ReaderWriter plugin * for the filename extension, and this plugin then handles the request * to write the specified file.*/ -extern OSGDB_EXPORT bool writeShaderFile(const osg::Shader& shader, const std::string& filename, const ReaderWriter::Options* options ); +extern OSGDB_EXPORT bool writeShaderFile(const osg::Shader& shader, const std::string& filename, const Options* options ); /** Write an osg::Shader to file. * Return true on success, diff --git a/include/osgDB/XmlParser b/include/osgDB/XmlParser index a4d8de16e..4d8a30435 100644 --- a/include/osgDB/XmlParser +++ b/include/osgDB/XmlParser @@ -21,8 +21,8 @@ namespace osgDB { // forward declare class XmlNode; -/** read an Xml file, find the file in ReaderWriter::Options DataFilePathList.*/ -extern OSGDB_EXPORT XmlNode* readXmlFile(const std::string& filename,const ReaderWriter::Options* options); +/** read an Xml file, find the file in Options DataFilePathList.*/ +extern OSGDB_EXPORT XmlNode* readXmlFile(const std::string& filename,const Options* options); /** read an Xml file, find the file in osgDB::Registry's eaderWriter::Options DataFilePathList.*/ inline XmlNode* readXmlFile(const std::string& filename) diff --git a/include/osgVolume/Layer b/include/osgVolume/Layer index 2034ae114..8c5a619b7 100644 --- a/include/osgVolume/Layer +++ b/include/osgVolume/Layer @@ -172,7 +172,7 @@ class OSGVOLUME_EXPORT CompositeLayer : public Layer void clear(); - void setFileName(unsigned int i, const std::string& filename) { _layers[i].filename = filename; if (_layers[i].layer.valid()) _layers[i].layer->setFileName(filename); } + void setFileName(unsigned int i, const std::string& filename) { if (i>=_layers.size()) _layers.resize(i+1); _layers[i].filename = filename; if (_layers[i].layer.valid()) _layers[i].layer->setFileName(filename); } const std::string& getFileName(unsigned int i) const { return _layers[i].layer.valid() ? _layers[i].layer->getFileName() : _layers[i].filename; } void setLayer(unsigned int i, Layer* layer) { if (i>=_layers.size()) _layers.resize(i+1); _layers[i].layer = layer; } diff --git a/src/osg/Shader.cpp b/src/osg/Shader.cpp index fcf72e5d5..1c0e6766e 100644 --- a/src/osg/Shader.cpp +++ b/src/osg/Shader.cpp @@ -121,7 +121,9 @@ Shader::~Shader() bool Shader::setType( Type t ) { - if( _type != UNDEFINED ) + if (_type==t) return true; + + if (_type != UNDEFINED) { osg::notify(osg::WARN) << "cannot change type of Shader" << std::endl; return false; diff --git a/src/osgDB/Archive.cpp b/src/osgDB/Archive.cpp index 1c8fdeb36..b7a8bab73 100644 --- a/src/osgDB/Archive.cpp +++ b/src/osgDB/Archive.cpp @@ -27,7 +27,7 @@ osgDB::Archive* osgDB::openArchive(const std::string& filename, ReaderWriter::Ar return openArchive(filename, status, indexBlockSizeHint, Registry::instance()->getOptions()); } -osgDB::Archive* osgDB::openArchive(const std::string& filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint,ReaderWriter::Options* options) +osgDB::Archive* osgDB::openArchive(const std::string& filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint,Options* options) { // ensure archive extension is in the registry list std::string::size_type dot = filename.find_last_of('.'); diff --git a/src/osgDB/CMakeLists.txt b/src/osgDB/CMakeLists.txt index 88e24c2bf..183040290 100644 --- a/src/osgDB/CMakeLists.txt +++ b/src/osgDB/CMakeLists.txt @@ -37,6 +37,7 @@ SET(LIB_PUBLIC_HEADERS ${HEADER_PATH}/ImagePager ${HEADER_PATH}/Input ${HEADER_PATH}/Output + ${HEADER_PATH}/Options ${HEADER_PATH}/ParameterOutput ${HEADER_PATH}/PluginQuery ${HEADER_PATH}/ReaderWriter @@ -71,6 +72,7 @@ ADD_LIBRARY(${LIB_NAME} Input.cpp MimeTypes.cpp Output.cpp + Options.cpp PluginQuery.cpp ReaderWriter.cpp ReadFile.cpp diff --git a/src/osgDB/DatabasePager.cpp b/src/osgDB/DatabasePager.cpp index 356984de9..4fee635c3 100644 --- a/src/osgDB/DatabasePager.cpp +++ b/src/osgDB/DatabasePager.cpp @@ -122,7 +122,7 @@ public: _changeAnisotropy(changeAnisotropy), _valueAnisotropy(valueAnisotropy), _drawablePolicy(drawablePolicy), _pager(pager) { - if (osgDB::Registry::instance()->getBuildKdTreesHint()==osgDB::ReaderWriter::Options::BUILD_KDTREES && + if (osgDB::Registry::instance()->getBuildKdTreesHint()==osgDB::Options::BUILD_KDTREES && osgDB::Registry::instance()->getKdTreeBuilder()) { _kdTreeBuilder = osgDB::Registry::instance()->getKdTreeBuilder()->clone(); @@ -679,7 +679,7 @@ void DatabasePager::DatabaseThread::run() else { // check to see if we need to run the KdTreeBuilder - if (osgDB::Registry::instance()->getBuildKdTreesHint()==osgDB::ReaderWriter::Options::BUILD_KDTREES && + if (osgDB::Registry::instance()->getBuildKdTreesHint()==osgDB::Options::BUILD_KDTREES && osgDB::Registry::instance()->getKdTreeBuilder()) { //osg::Timer_t before = osg::Timer::instance()->tick(); @@ -1238,7 +1238,7 @@ void DatabasePager::requestNodeFile(const std::string& fileName,osg::Group* grou void DatabasePager::requestNodeFile(const std::string& fileName,osg::Group* group, float priority, const osg::FrameStamp* framestamp, osg::ref_ptr& databaseRequestRef, - ReaderWriter::Options* loadOptions) + Options* loadOptions) { if (!_acceptNewRequests) return; diff --git a/src/osgDB/FileCache.cpp b/src/osgDB/FileCache.cpp index 1dc85a861..0777331b1 100644 --- a/src/osgDB/FileCache.cpp +++ b/src/osgDB/FileCache.cpp @@ -46,7 +46,7 @@ bool FileCache::existsInCache(const std::string& originalFileName) const return osgDB::fileExists(createCacheFileName(originalFileName)); } -ReaderWriter::ReadResult FileCache::readNode(const std::string& originalFileName, const osgDB::ReaderWriter::Options* options, bool buildKdTreeIfRequired) const +ReaderWriter::ReadResult FileCache::readNode(const std::string& originalFileName, const osgDB::Options* options, bool buildKdTreeIfRequired) const { std::string cacheFileName = createCacheFileName(originalFileName); if (!cacheFileName.empty() && osgDB::fileExists(cacheFileName)) @@ -60,7 +60,7 @@ ReaderWriter::ReadResult FileCache::readNode(const std::string& originalFileName } } -ReaderWriter::WriteResult FileCache::writeNode(const osg::Node& node, const std::string& originalFileName, const osgDB::ReaderWriter::Options* options) const +ReaderWriter::WriteResult FileCache::writeNode(const osg::Node& node, const std::string& originalFileName, const osgDB::Options* options) const { std::string cacheFileName = createCacheFileName(originalFileName); if (!cacheFileName.empty()) diff --git a/src/osgDB/FileUtils.cpp b/src/osgDB/FileUtils.cpp index 7e1fabd70..064cbce61 100644 --- a/src/osgDB/FileUtils.cpp +++ b/src/osgDB/FileUtils.cpp @@ -289,91 +289,17 @@ std::string osgDB::findFileInPath(const std::string& filename, const FilePathLis std::string osgDB::findDataFile(const std::string& filename,CaseSensitivity caseSensitivity) { - return findDataFile(filename,static_cast(0),caseSensitivity); + return findDataFile(filename,static_cast(0),caseSensitivity); } -OSGDB_EXPORT std::string osgDB::findDataFile(const std::string& filename,const ReaderWriter::Options* options, CaseSensitivity caseSensitivity) +OSGDB_EXPORT std::string osgDB::findDataFile(const std::string& filename,const Options* options, CaseSensitivity caseSensitivity) { - if (filename.empty()) return filename; - - if(fileExists(filename)) - { - osg::notify(osg::DEBUG_INFO) << "FindFileInPath(" << filename << "): returning " << filename << std::endl; - return filename; - } - - std::string fileFound; - - if (options && !options->getDatabasePathList().empty()) - { - fileFound = findFileInPath(filename, options->getDatabasePathList(), caseSensitivity); - if (!fileFound.empty()) return fileFound; - } - - const FilePathList& filepath = Registry::instance()->getDataFilePathList(); - if (!filepath.empty()) - { - fileFound = findFileInPath(filename, filepath,caseSensitivity); - if (!fileFound.empty()) return fileFound; - } - - - // if a directory is included in the filename, get just the (simple) filename itself and try that - std::string simpleFileName = getSimpleFileName(filename); - if (simpleFileName!=filename) - { - - if(fileExists(simpleFileName)) - { - osg::notify(osg::DEBUG_INFO) << "FindFileInPath(" << filename << "): returning " << filename << std::endl; - return simpleFileName; - } - - if (options && !options->getDatabasePathList().empty()) - { - fileFound = findFileInPath(simpleFileName, options->getDatabasePathList(), caseSensitivity); - if (!fileFound.empty()) return fileFound; - } - - if (!filepath.empty()) - { - fileFound = findFileInPath(simpleFileName, filepath,caseSensitivity); - if (!fileFound.empty()) return fileFound; - } - - } - - // return empty string. - return std::string(); + return Registry::instance()->findDataFile(filename, options, caseSensitivity); } std::string osgDB::findLibraryFile(const std::string& filename,CaseSensitivity caseSensitivity) { - if (filename.empty()) - return filename; - - const FilePathList& filepath = Registry::instance()->getLibraryFilePathList(); - - std::string fileFound = findFileInPath(filename, filepath,caseSensitivity); - if (!fileFound.empty()) - return fileFound; - - if(fileExists(filename)) - { - osg::notify(osg::DEBUG_INFO) << "FindFileInPath(" << filename << "): returning " << filename << std::endl; - return filename; - } - - // if a directory is included in the filename, get just the (simple) filename itself and try that - std::string simpleFileName = getSimpleFileName(filename); - if (simpleFileName!=filename) - { - std::string fileFound = findFileInPath(simpleFileName, filepath,caseSensitivity); - if (!fileFound.empty()) return fileFound; - } - - // failed return empty string. - return std::string(); + return Registry::instance()->findLibraryFile(filename, osgDB::Registry::instance()->getOptions(), caseSensitivity); } std::string osgDB::findFileInDirectory(const std::string& fileName,const std::string& dirName,CaseSensitivity caseSensitivity) diff --git a/src/osgDB/Options.cpp b/src/osgDB/Options.cpp new file mode 100644 index 000000000..10bd4a914 --- /dev/null +++ b/src/osgDB/Options.cpp @@ -0,0 +1,94 @@ +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield + * + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * (at your option) any later version. The full license is in LICENSE file + * included with this distribution, and on the openscenegraph.org website. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * OpenSceneGraph Public License for more details. +*/ + +#include +#include + +using namespace osgDB; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// FindFileCallback default implementation +// +std::string FindFileCallback::findDataFile(const std::string& filename, const Options* options, CaseSensitivity caseSensitivity) +{ + return osgDB::Registry::instance()->findDataFileImplementation(filename, options, caseSensitivity); +} + +std::string FindFileCallback::findLibraryFile(const std::string& filename, const Options* options, CaseSensitivity caseSensitivity) +{ + return osgDB::Registry::instance()->findLibraryFileImplementation(filename, options, caseSensitivity); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ReadFileCallback default implementation +// +ReaderWriter::ReadResult ReadFileCallback::openArchive(const std::string& filename,ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint, const Options* useObjectCache) +{ + return osgDB::Registry::instance()->openArchiveImplementation(filename, status, indexBlockSizeHint, useObjectCache); +} + +ReaderWriter::ReadResult ReadFileCallback::readObject(const std::string& filename, const Options* options) +{ + return osgDB::Registry::instance()->readObjectImplementation(filename,options); +} + +ReaderWriter::ReadResult ReadFileCallback::readImage(const std::string& filename, const Options* options) +{ + return osgDB::Registry::instance()->readImageImplementation(filename,options); +} + +ReaderWriter::ReadResult ReadFileCallback::readHeightField(const std::string& filename, const Options* options) +{ + return osgDB::Registry::instance()->readHeightFieldImplementation(filename,options); +} + +ReaderWriter::ReadResult ReadFileCallback::readNode(const std::string& filename, const Options* options) +{ + return osgDB::Registry::instance()->readNodeImplementation(filename,options); +} + +ReaderWriter::ReadResult ReadFileCallback::readShader(const std::string& filename, const Options* options) +{ + return osgDB::Registry::instance()->readShaderImplementation(filename,options); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// WriteFileCallback default implementation +// +ReaderWriter::WriteResult WriteFileCallback::writeObject(const osg::Object& obj, const std::string& fileName,const Options* options) +{ + return osgDB::Registry::instance()->writeObjectImplementation(obj,fileName,options); +} + +ReaderWriter::WriteResult WriteFileCallback::writeImage(const osg::Image& obj, const std::string& fileName,const Options* options) +{ + return osgDB::Registry::instance()->writeImageImplementation(obj,fileName,options); +} + +ReaderWriter::WriteResult WriteFileCallback::writeHeightField(const osg::HeightField& obj, const std::string& fileName,const Options* options) +{ + return osgDB::Registry::instance()->writeHeightFieldImplementation(obj,fileName,options); +} + +ReaderWriter::WriteResult WriteFileCallback::writeNode(const osg::Node& obj, const std::string& fileName,const Options* options) +{ + return osgDB::Registry::instance()->writeNodeImplementation(obj,fileName,options); +} + +ReaderWriter::WriteResult WriteFileCallback::writeShader(const osg::Shader& obj, const std::string& fileName,const Options* options) +{ + return osgDB::Registry::instance()->writeShaderImplementation(obj,fileName,options); +} diff --git a/src/osgDB/Output.cpp b/src/osgDB/Output.cpp index 334c669c3..8d30f8e86 100644 --- a/src/osgDB/Output.cpp +++ b/src/osgDB/Output.cpp @@ -63,7 +63,7 @@ void Output::init() } } -void Output::setOptions(const ReaderWriter::Options* options) +void Output::setOptions(const Options* options) { _options = options; } diff --git a/src/osgDB/ReadFile.cpp b/src/osgDB/ReadFile.cpp index ddde42b28..a4586d239 100644 --- a/src/osgDB/ReadFile.cpp +++ b/src/osgDB/ReadFile.cpp @@ -29,7 +29,7 @@ using namespace osg; using namespace osgDB; -Object* osgDB::readObjectFile(const std::string& filename,const ReaderWriter::Options* options) +Object* osgDB::readObjectFile(const std::string& filename,const Options* options) { ReaderWriter::ReadResult rr = Registry::instance()->readObject(filename,options); if (rr.validObject()) return rr.takeObject(); @@ -38,7 +38,7 @@ Object* osgDB::readObjectFile(const std::string& filename,const ReaderWriter::Op } -Image* osgDB::readImageFile(const std::string& filename,const ReaderWriter::Options* options) +Image* osgDB::readImageFile(const std::string& filename,const Options* options) { ReaderWriter::ReadResult rr = Registry::instance()->readImage(filename,options); if (rr.validImage()) return rr.takeImage(); @@ -46,7 +46,7 @@ Image* osgDB::readImageFile(const std::string& filename,const ReaderWriter::Opti return NULL; } -Shader* osgDB::readShaderFile(const std::string& filename,const ReaderWriter::Options* options) +Shader* osgDB::readShaderFile(const std::string& filename,const Options* options) { ReaderWriter::ReadResult rr = Registry::instance()->readShader(filename,options); if (rr.validShader()) return rr.takeShader(); @@ -55,7 +55,7 @@ Shader* osgDB::readShaderFile(const std::string& filename,const ReaderWriter::Op } -HeightField* osgDB::readHeightFieldFile(const std::string& filename,const ReaderWriter::Options* options) +HeightField* osgDB::readHeightFieldFile(const std::string& filename,const Options* options) { ReaderWriter::ReadResult rr = Registry::instance()->readHeightField(filename,options); if (rr.validHeightField()) return rr.takeHeightField(); @@ -64,7 +64,7 @@ HeightField* osgDB::readHeightFieldFile(const std::string& filename,const Reader } -Node* osgDB::readNodeFile(const std::string& filename,const ReaderWriter::Options* options) +Node* osgDB::readNodeFile(const std::string& filename,const Options* options) { ReaderWriter::ReadResult rr = Registry::instance()->readNode(filename,options); if (rr.validNode()) return rr.takeNode(); @@ -72,7 +72,7 @@ Node* osgDB::readNodeFile(const std::string& filename,const ReaderWriter::Option return NULL; } -Node* osgDB::readNodeFiles(std::vector& commandLine,const ReaderWriter::Options* options) +Node* osgDB::readNodeFiles(std::vector& commandLine,const Options* options) { typedef std::vector NodeList; NodeList nodeList; @@ -121,7 +121,7 @@ Node* osgDB::readNodeFiles(std::vector& commandLine,const ReaderWri } -Node* osgDB::readNodeFiles(osg::ArgumentParser& arguments,const ReaderWriter::Options* options) +Node* osgDB::readNodeFiles(osg::ArgumentParser& arguments,const Options* options) { typedef std::vector< osg::ref_ptr > NodeList; @@ -255,7 +255,7 @@ Node* osgDB::readNodeFiles(osg::ArgumentParser& arguments,const ReaderWriter::Op } -osg::ref_ptr osgDB::readRefObjectFile(const std::string& filename,const ReaderWriter::Options* options) +osg::ref_ptr osgDB::readRefObjectFile(const std::string& filename,const Options* options) { ReaderWriter::ReadResult rr = Registry::instance()->readObject(filename,options); if (rr.validObject()) return osg::ref_ptr(rr.getObject()); @@ -263,7 +263,7 @@ osg::ref_ptr osgDB::readRefObjectFile(const std::string& filename,c return NULL; } -osg::ref_ptr osgDB::readRefImageFile(const std::string& filename,const ReaderWriter::Options* options) +osg::ref_ptr osgDB::readRefImageFile(const std::string& filename,const Options* options) { ReaderWriter::ReadResult rr = Registry::instance()->readImage(filename,options); if (rr.validImage()) return osg::ref_ptr(rr.getImage()); @@ -271,7 +271,7 @@ osg::ref_ptr osgDB::readRefImageFile(const std::string& filename,con return NULL; } -osg::ref_ptr osgDB::readRefShaderFile(const std::string& filename,const ReaderWriter::Options* options) +osg::ref_ptr osgDB::readRefShaderFile(const std::string& filename,const Options* options) { ReaderWriter::ReadResult rr = Registry::instance()->readShader(filename,options); if (rr.validShader()) return osg::ref_ptr(rr.getShader()); @@ -279,7 +279,7 @@ osg::ref_ptr osgDB::readRefShaderFile(const std::string& filename,c return NULL; } -osg::ref_ptr osgDB::readRefHeightFieldFile(const std::string& filename,const ReaderWriter::Options* options) +osg::ref_ptr osgDB::readRefHeightFieldFile(const std::string& filename,const Options* options) { ReaderWriter::ReadResult rr = Registry::instance()->readHeightField(filename,options); if (rr.validHeightField()) return osg::ref_ptr(rr.getHeightField()); @@ -287,7 +287,7 @@ osg::ref_ptr osgDB::readRefHeightFieldFile(const std::string& return NULL; } -osg::ref_ptr osgDB::readRefNodeFile(const std::string& filename,const ReaderWriter::Options* options) +osg::ref_ptr osgDB::readRefNodeFile(const std::string& filename,const Options* options) { ReaderWriter::ReadResult rr = Registry::instance()->readNode(filename,options); if (rr.validNode()) return osg::ref_ptr(rr.getNode()); diff --git a/src/osgDB/ReaderWriter.cpp b/src/osgDB/ReaderWriter.cpp index 3bc18b1f6..8fc2d029f 100644 --- a/src/osgDB/ReaderWriter.cpp +++ b/src/osgDB/ReaderWriter.cpp @@ -12,6 +12,7 @@ */ #include +#include #include #include diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index b51d8a5ad..b7beb598c 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -176,15 +176,15 @@ Registry::Registry() // comment out because it was causing problems under OSX - causing it to crash osgconv when constructing ostream in osg::notify(). // notify(INFO) << "Constructing osg::Registry"<getDatabasePathList().empty()) + { + fileFound = findFileInPath(filename, options->getDatabasePathList(), caseSensitivity); + if (!fileFound.empty()) return fileFound; + } + + const FilePathList& filepath = Registry::instance()->getDataFilePathList(); + if (!filepath.empty()) + { + fileFound = findFileInPath(filename, filepath,caseSensitivity); + if (!fileFound.empty()) return fileFound; + } + + + // if a directory is included in the filename, get just the (simple) filename itself and try that + std::string simpleFileName = getSimpleFileName(filename); + if (simpleFileName!=filename) + { + + if(fileExists(simpleFileName)) + { + osg::notify(osg::DEBUG_INFO) << "FindFileInPath(" << filename << "): returning " << filename << std::endl; + return simpleFileName; + } + + if (options && !options->getDatabasePathList().empty()) + { + fileFound = findFileInPath(simpleFileName, options->getDatabasePathList(), caseSensitivity); + if (!fileFound.empty()) return fileFound; + } + + if (!filepath.empty()) + { + fileFound = findFileInPath(simpleFileName, filepath,caseSensitivity); + if (!fileFound.empty()) return fileFound; + } + + } + + // return empty string. + return std::string(); +} + +std::string Registry::findLibraryFileImplementation(const std::string& filename, const Options* options, CaseSensitivity caseSensitivity) +{ + if (filename.empty()) + return filename; + + const FilePathList& filepath = Registry::instance()->getLibraryFilePathList(); + + std::string fileFound = findFileInPath(filename, filepath,caseSensitivity); + if (!fileFound.empty()) + return fileFound; + + if(fileExists(filename)) + { + osg::notify(osg::DEBUG_INFO) << "FindFileInPath(" << filename << "): returning " << filename << std::endl; + return filename; + } + + // if a directory is included in the filename, get just the (simple) filename itself and try that + std::string simpleFileName = getSimpleFileName(filename); + if (simpleFileName!=filename) + { + std::string fileFound = findFileInPath(simpleFileName, filepath,caseSensitivity); + if (!fileFound.empty()) return fileFound; + } + + // failed return empty string. + return std::string(); +} + + + ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) { for(ArchiveExtensionList::iterator aitr=_archiveExtList.begin(); @@ -1514,7 +1600,7 @@ ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) osgDB::Archive* archive = result.getArchive(); - osg::ref_ptr options = new ReaderWriter::Options; + osg::ref_ptr options = new Options; options->setDatabasePath(archiveName); return archive->readObject(fileName,options.get()); @@ -1650,15 +1736,15 @@ ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) return results.front(); } -ReaderWriter::ReadResult Registry::readImplementation(const ReadFunctor& readFunctor,ReaderWriter::Options::CacheHintOptions cacheHint) +ReaderWriter::ReadResult Registry::readImplementation(const ReadFunctor& readFunctor,Options::CacheHintOptions cacheHint) { std::string file(readFunctor._filename); bool useObjectCache=false; //Note CACHE_ARCHIVES has a different object that it caches to so it will never be used here - if (cacheHint!=ReaderWriter::Options::CACHE_ARCHIVES) + if (cacheHint!=Options::CACHE_ARCHIVES) { - const ReaderWriter::Options* options=readFunctor._options; + const Options* options=readFunctor._options; useObjectCache=options ? (options->getObjectCacheHint()&cacheHint)!=0: false; } if (useObjectCache) @@ -1698,17 +1784,17 @@ ReaderWriter::ReadResult Registry::readImplementation(const ReadFunctor& readFun } -ReaderWriter::ReadResult Registry::openArchiveImplementation(const std::string& fileName, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint, const ReaderWriter::Options* options) +ReaderWriter::ReadResult Registry::openArchiveImplementation(const std::string& fileName, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint, const Options* options) { osgDB::Archive* archive = getFromArchiveCache(fileName); if (archive) return archive; - ReaderWriter::ReadResult result = readImplementation(ReadArchiveFunctor(fileName, status, indexBlockSizeHint, options),ReaderWriter::Options::CACHE_ARCHIVES); + ReaderWriter::ReadResult result = readImplementation(ReadArchiveFunctor(fileName, status, indexBlockSizeHint, options),Options::CACHE_ARCHIVES); // default to using caching archive if no options structure provided, but if options are provided use archives // only if supplied. if (result.validArchive() && - (!options || (options->getObjectCacheHint() & ReaderWriter::Options::CACHE_ARCHIVES)) ) + (!options || (options->getObjectCacheHint() & Options::CACHE_ARCHIVES)) ) { addToArchiveCache(fileName,result.getArchive()); } @@ -1716,12 +1802,12 @@ ReaderWriter::ReadResult Registry::openArchiveImplementation(const std::string& } -ReaderWriter::ReadResult Registry::readObjectImplementation(const std::string& fileName,const ReaderWriter::Options* options) +ReaderWriter::ReadResult Registry::readObjectImplementation(const std::string& fileName,const Options* options) { - return readImplementation(ReadObjectFunctor(fileName, options),ReaderWriter::Options::CACHE_OBJECTS); + return readImplementation(ReadObjectFunctor(fileName, options),Options::CACHE_OBJECTS); } -ReaderWriter::WriteResult Registry::writeObjectImplementation(const Object& obj,const std::string& fileName,const ReaderWriter::Options* options) +ReaderWriter::WriteResult Registry::writeObjectImplementation(const Object& obj,const std::string& fileName,const Options* options) { // record the errors reported by readerwriters. typedef std::vector Results; @@ -1768,12 +1854,12 @@ ReaderWriter::WriteResult Registry::writeObjectImplementation(const Object& obj, -ReaderWriter::ReadResult Registry::readImageImplementation(const std::string& fileName,const ReaderWriter::Options* options) +ReaderWriter::ReadResult Registry::readImageImplementation(const std::string& fileName,const Options* options) { - return readImplementation(ReadImageFunctor(fileName, options),ReaderWriter::Options::CACHE_IMAGES); + return readImplementation(ReadImageFunctor(fileName, options),Options::CACHE_IMAGES); } -ReaderWriter::WriteResult Registry::writeImageImplementation(const Image& image,const std::string& fileName,const ReaderWriter::Options* options) +ReaderWriter::WriteResult Registry::writeImageImplementation(const Image& image,const std::string& fileName,const Options* options) { // record the errors reported by readerwriters. typedef std::vector Results; @@ -1821,12 +1907,12 @@ ReaderWriter::WriteResult Registry::writeImageImplementation(const Image& image, } -ReaderWriter::ReadResult Registry::readHeightFieldImplementation(const std::string& fileName,const ReaderWriter::Options* options) +ReaderWriter::ReadResult Registry::readHeightFieldImplementation(const std::string& fileName,const Options* options) { - return readImplementation(ReadHeightFieldFunctor(fileName, options),ReaderWriter::Options::CACHE_HEIGHTFIELDS); + return readImplementation(ReadHeightFieldFunctor(fileName, options),Options::CACHE_HEIGHTFIELDS); } -ReaderWriter::WriteResult Registry::writeHeightFieldImplementation(const HeightField& HeightField,const std::string& fileName,const ReaderWriter::Options* options) +ReaderWriter::WriteResult Registry::writeHeightFieldImplementation(const HeightField& HeightField,const std::string& fileName,const Options* options) { // record the errors reported by readerwriters. typedef std::vector Results; @@ -1874,24 +1960,24 @@ ReaderWriter::WriteResult Registry::writeHeightFieldImplementation(const HeightF } -ReaderWriter::ReadResult Registry::readNodeImplementation(const std::string& fileName,const ReaderWriter::Options* options) +ReaderWriter::ReadResult Registry::readNodeImplementation(const std::string& fileName,const Options* options) { #if 0 osg::Timer_t startTick = osg::Timer::instance()->tick(); - ReaderWriter::ReadResult result = readImplementation(ReadNodeFunctor(fileName, options),ReaderWriter::Options::CACHE_NODES); + ReaderWriter::ReadResult result = readImplementation(ReadNodeFunctor(fileName, options),Options::CACHE_NODES); osg::Timer_t endTick = osg::Timer::instance()->tick(); osg::notify(osg::NOTICE)<<"time to load "<delta_m(startTick, endTick)<<"ms"< Results; @@ -1941,12 +2027,12 @@ ReaderWriter::WriteResult Registry::writeNodeImplementation(const Node& node,con return results.front(); } -ReaderWriter::ReadResult Registry::readShaderImplementation(const std::string& fileName,const ReaderWriter::Options* options) +ReaderWriter::ReadResult Registry::readShaderImplementation(const std::string& fileName,const Options* options) { - return readImplementation(ReadShaderFunctor(fileName, options),ReaderWriter::Options::CACHE_SHADERS); + return readImplementation(ReadShaderFunctor(fileName, options),Options::CACHE_SHADERS); } -ReaderWriter::WriteResult Registry::writeShaderImplementation(const Shader& shader,const std::string& fileName,const ReaderWriter::Options* options) +ReaderWriter::WriteResult Registry::writeShaderImplementation(const Shader& shader,const std::string& fileName,const Options* options) { // record the errors reported by readerwriters. typedef std::vector Results; diff --git a/src/osgDB/WriteFile.cpp b/src/osgDB/WriteFile.cpp index e61e57fce..5efeb3c74 100644 --- a/src/osgDB/WriteFile.cpp +++ b/src/osgDB/WriteFile.cpp @@ -24,7 +24,7 @@ using namespace osg; using namespace osgDB; -bool osgDB::writeObjectFile(const Object& object,const std::string& filename, const ReaderWriter::Options* options ) +bool osgDB::writeObjectFile(const Object& object,const std::string& filename, const Options* options ) { ReaderWriter::WriteResult wr = Registry::instance()->writeObject( object, filename, options ); if (wr.error()) notify(WARN) << "Error writing file " << filename << ": " << wr.message() << std::endl; @@ -32,7 +32,7 @@ bool osgDB::writeObjectFile(const Object& object,const std::string& filename, co } -bool osgDB::writeImageFile(const Image& image,const std::string& filename, const ReaderWriter::Options* options ) +bool osgDB::writeImageFile(const Image& image,const std::string& filename, const Options* options ) { ReaderWriter::WriteResult wr = Registry::instance()->writeImage( image, filename, options ); if (wr.error()) notify(WARN) << "Error writing file " << filename << ": " << wr.message() << std::endl; @@ -40,21 +40,21 @@ bool osgDB::writeImageFile(const Image& image,const std::string& filename, const } -bool osgDB::writeHeightFieldFile(const HeightField& HeightField,const std::string& filename, const ReaderWriter::Options* options ) +bool osgDB::writeHeightFieldFile(const HeightField& HeightField,const std::string& filename, const Options* options ) { ReaderWriter::WriteResult wr = Registry::instance()->writeHeightField( HeightField, filename, options ); if (wr.error()) notify(WARN) << "Error writing file " << filename << ": " << wr.message() << std::endl; return wr.success(); } -bool osgDB::writeNodeFile(const Node& node,const std::string& filename, const ReaderWriter::Options* options ) +bool osgDB::writeNodeFile(const Node& node,const std::string& filename, const Options* options ) { ReaderWriter::WriteResult wr = Registry::instance()->writeNode( node, filename, options ); if (wr.error()) notify(WARN) << "Error writing file " << filename << ": " << wr.message() << std::endl; return wr.success(); } -bool osgDB::writeShaderFile(const Shader& shader,const std::string& filename, const ReaderWriter::Options* options ) +bool osgDB::writeShaderFile(const Shader& shader,const std::string& filename, const Options* options ) { ReaderWriter::WriteResult wr = Registry::instance()->writeShader( shader, filename, options ); if (wr.error()) notify(WARN) << "Error writing file " << filename << ": " << wr.message() << std::endl; diff --git a/src/osgDB/XmlParser.cpp b/src/osgDB/XmlParser.cpp index c3d886a08..78e6e1580 100644 --- a/src/osgDB/XmlParser.cpp +++ b/src/osgDB/XmlParser.cpp @@ -18,7 +18,7 @@ using namespace osgDB; -XmlNode* osgDB::readXmlFile(const std::string& filename,const ReaderWriter::Options* options) +XmlNode* osgDB::readXmlFile(const std::string& filename,const Options* options) { std::string foundFile = osgDB::findDataFile(filename, options); if (!foundFile.empty()) diff --git a/src/osgPlugins/OpenFlight/Document.h b/src/osgPlugins/OpenFlight/Document.h index 60c963b2d..bbe524337 100644 --- a/src/osgPlugins/OpenFlight/Document.h +++ b/src/osgPlugins/OpenFlight/Document.h @@ -27,6 +27,7 @@ #include #include #include +#include #include "Types.h" #include "Record.h" diff --git a/src/osgPlugins/OpenFlight/ExportOptions.h b/src/osgPlugins/OpenFlight/ExportOptions.h index b1907bef3..c40b067f3 100644 --- a/src/osgPlugins/OpenFlight/ExportOptions.h +++ b/src/osgPlugins/OpenFlight/ExportOptions.h @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include @@ -38,7 +38,7 @@ namespace flt Features a parser for the Option string as well as getter methods for supported options. */ -class ExportOptions : public osgDB::ReaderWriter::Options +class ExportOptions : public osgDB::Options { public: ExportOptions( const Options* opt ); diff --git a/src/osgPlugins/ive/PagedLOD.cpp b/src/osgPlugins/ive/PagedLOD.cpp index c8b363ac6..a8c6e753d 100644 --- a/src/osgPlugins/ive/PagedLOD.cpp +++ b/src/osgPlugins/ive/PagedLOD.cpp @@ -16,6 +16,8 @@ #include "PagedLOD.h" #include "Node.h" +#include + using namespace ive; void PagedLOD::write(DataOutputStream* out) diff --git a/src/osgPlugins/p3d/ReaderWriterP3D.cpp b/src/osgPlugins/p3d/ReaderWriterP3D.cpp index 52f1a130b..f5601445e 100644 --- a/src/osgPlugins/p3d/ReaderWriterP3D.cpp +++ b/src/osgPlugins/p3d/ReaderWriterP3D.cpp @@ -1405,6 +1405,15 @@ osgDB::ReaderWriter::ReadResult ReaderWriterP3DXML::readNode(const std::string& return readNode(input, local_opt); } +struct MyFindFileCallback : public osgDB::FindFileCallback +{ + virtual std::string findDataFile(const std::string& filename, const osgDB::Options* options, osgDB::CaseSensitivity caseSensitivity) + { + osg::notify(osg::NOTICE)<<"find file "<findDataFileImplementation(filename, options, caseSensitivity); + } +}; + osgDB::ReaderWriter::ReadResult ReaderWriterP3DXML::readNode(std::istream& fin, const Options* options) const { osgDB::XmlNode::Input input; @@ -1412,6 +1421,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterP3DXML::readNode(std::istream& fin, input.readAllDataIntoBuffer(); osg::ref_ptr local_opt = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; + local_opt->setFindFileCallback(new MyFindFileCallback); return readNode(input, local_opt); } @@ -1429,6 +1439,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterP3DXML::readNode(osgDB::XmlNode::Inp doc->read(input); + // doc->write(std::cout); if (doc == NULL ) diff --git a/src/osgWrappers/genwrapper.conf b/src/osgWrappers/genwrapper.conf index 855fa01c3..a884395f8 100644 --- a/src/osgWrappers/genwrapper.conf +++ b/src/osgWrappers/genwrapper.conf @@ -97,8 +97,13 @@ configure file /osg\/BoundingBox/ end configure file /osg\/BoundingSphere/ - emit before "#include - " + emit before "#include + " +end + +configure file /osgDB\/ReaderWriter/ + emit before "#include + " end ############################################################################# diff --git a/src/osgWrappers/osg/BoundingSphere.cpp b/src/osgWrappers/osg/BoundingSphere.cpp index 26f3a352e..e4959df8a 100644 --- a/src/osgWrappers/osg/BoundingSphere.cpp +++ b/src/osgWrappers/osg/BoundingSphere.cpp @@ -23,7 +23,7 @@ #endif #include - + TYPE_NAME_ALIAS(osg::BoundingSphereImpl< osg::Vec3f >, osg::BoundingSpheref) TYPE_NAME_ALIAS(osg::BoundingSphereImpl< osg::Vec3d >, osg::BoundingSphered) diff --git a/src/osgWrappers/osgDB/Archive.cpp b/src/osgWrappers/osgDB/Archive.cpp index 566e8072e..b7cfb78e8 100644 --- a/src/osgWrappers/osgDB/Archive.cpp +++ b/src/osgWrappers/osgDB/Archive.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include // Must undefine IN and OUT macros defined in Windows headers @@ -68,42 +69,42 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgDB::Archive) __bool__getFileNames__FileNameList_R1, "Get the full list of file names available in the archive. ", ""); - I_MethodWithDefaults2(osgDB::ReaderWriter::ReadResult, readObject, IN, const std::string &, x, , IN, const osgDB::ReaderWriter::Options *, x, NULL, + I_MethodWithDefaults2(osgDB::ReaderWriter::ReadResult, readObject, IN, const std::string &, x, , IN, const osgDB::Options *, x, NULL, Properties::PURE_VIRTUAL, __ReadResult__readObject__C5_std_string_R1__C5_Options_P1, "", ""); - I_MethodWithDefaults2(osgDB::ReaderWriter::ReadResult, readImage, IN, const std::string &, x, , IN, const osgDB::ReaderWriter::Options *, x, NULL, + I_MethodWithDefaults2(osgDB::ReaderWriter::ReadResult, readImage, IN, const std::string &, x, , IN, const osgDB::Options *, x, NULL, Properties::PURE_VIRTUAL, __ReadResult__readImage__C5_std_string_R1__C5_Options_P1, "", ""); - I_MethodWithDefaults2(osgDB::ReaderWriter::ReadResult, readHeightField, IN, const std::string &, x, , IN, const osgDB::ReaderWriter::Options *, x, NULL, + I_MethodWithDefaults2(osgDB::ReaderWriter::ReadResult, readHeightField, IN, const std::string &, x, , IN, const osgDB::Options *, x, NULL, Properties::PURE_VIRTUAL, __ReadResult__readHeightField__C5_std_string_R1__C5_Options_P1, "", ""); - I_MethodWithDefaults2(osgDB::ReaderWriter::ReadResult, readNode, IN, const std::string &, x, , IN, const osgDB::ReaderWriter::Options *, x, NULL, + I_MethodWithDefaults2(osgDB::ReaderWriter::ReadResult, readNode, IN, const std::string &, x, , IN, const osgDB::Options *, x, NULL, Properties::PURE_VIRTUAL, __ReadResult__readNode__C5_std_string_R1__C5_Options_P1, "", ""); - I_MethodWithDefaults3(osgDB::ReaderWriter::WriteResult, writeObject, IN, const osg::Object &, x, , IN, const std::string &, x, , IN, const osgDB::ReaderWriter::Options *, x, NULL, + I_MethodWithDefaults3(osgDB::ReaderWriter::WriteResult, writeObject, IN, const osg::Object &, x, , IN, const std::string &, x, , IN, const osgDB::Options *, x, NULL, Properties::PURE_VIRTUAL, __WriteResult__writeObject__C5_osg_Object_R1__C5_std_string_R1__C5_Options_P1, "", ""); - I_MethodWithDefaults3(osgDB::ReaderWriter::WriteResult, writeImage, IN, const osg::Image &, x, , IN, const std::string &, x, , IN, const osgDB::ReaderWriter::Options *, x, NULL, + I_MethodWithDefaults3(osgDB::ReaderWriter::WriteResult, writeImage, IN, const osg::Image &, x, , IN, const std::string &, x, , IN, const osgDB::Options *, x, NULL, Properties::PURE_VIRTUAL, __WriteResult__writeImage__C5_osg_Image_R1__C5_std_string_R1__C5_Options_P1, "", ""); - I_MethodWithDefaults3(osgDB::ReaderWriter::WriteResult, writeHeightField, IN, const osg::HeightField &, x, , IN, const std::string &, x, , IN, const osgDB::ReaderWriter::Options *, x, NULL, + I_MethodWithDefaults3(osgDB::ReaderWriter::WriteResult, writeHeightField, IN, const osg::HeightField &, x, , IN, const std::string &, x, , IN, const osgDB::Options *, x, NULL, Properties::PURE_VIRTUAL, __WriteResult__writeHeightField__C5_osg_HeightField_R1__C5_std_string_R1__C5_Options_P1, "", ""); - I_MethodWithDefaults3(osgDB::ReaderWriter::WriteResult, writeNode, IN, const osg::Node &, x, , IN, const std::string &, x, , IN, const osgDB::ReaderWriter::Options *, x, NULL, + I_MethodWithDefaults3(osgDB::ReaderWriter::WriteResult, writeNode, IN, const osg::Node &, x, , IN, const std::string &, x, , IN, const osgDB::Options *, x, NULL, Properties::PURE_VIRTUAL, __WriteResult__writeNode__C5_osg_Node_R1__C5_std_string_R1__C5_Options_P1, "", diff --git a/src/osgWrappers/osgDB/DatabasePager.cpp b/src/osgWrappers/osgDB/DatabasePager.cpp index 5b7926dcb..ff88da767 100644 --- a/src/osgWrappers/osgDB/DatabasePager.cpp +++ b/src/osgWrappers/osgDB/DatabasePager.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include // Must undefine IN and OUT macros defined in Windows headers #ifdef IN @@ -74,9 +74,9 @@ BEGIN_OBJECT_REFLECTOR(osgDB::DatabasePager) __void__requestNodeFile__C5_std_string_R1__osg_Group_P1__float__C5_osg_FrameStamp_P1__osg_ref_ptrT1_osg_Referenced__R1, "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::ReaderWriter::Options *, loadOptions, + 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__ReaderWriter_Options_P1, + __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, diff --git a/src/osgWrappers/osgDB/FileUtils.cpp b/src/osgWrappers/osgDB/FileUtils.cpp index 6e52fb00a..3abff9ae1 100644 --- a/src/osgWrappers/osgDB/FileUtils.cpp +++ b/src/osgWrappers/osgDB/FileUtils.cpp @@ -20,12 +20,6 @@ #undef OUT #endif -BEGIN_ENUM_REFLECTOR(osgDB::CaseSensitivity) - I_DeclaringFile("osgDB/FileUtils"); - I_EnumLabel(osgDB::CASE_SENSITIVE); - I_EnumLabel(osgDB::CASE_INSENSITIVE); -END_REFLECTOR - BEGIN_ENUM_REFLECTOR(osgDB::FileType) I_DeclaringFile("osgDB/FileUtils"); I_EnumLabel(osgDB::FILE_NOT_FOUND); diff --git a/src/osgWrappers/osgDB/ImageOptions.cpp b/src/osgWrappers/osgDB/ImageOptions.cpp index 472491999..ac3a01020 100644 --- a/src/osgWrappers/osgDB/ImageOptions.cpp +++ b/src/osgWrappers/osgDB/ImageOptions.cpp @@ -38,7 +38,7 @@ END_REFLECTOR BEGIN_OBJECT_REFLECTOR(osgDB::ImageOptions) I_DeclaringFile("osgDB/ImageOptions"); - I_BaseType(osgDB::ReaderWriter::Options); + I_BaseType(osgDB::Options); I_Constructor0(____ImageOptions, "", ""); diff --git a/src/osgWrappers/osgDB/Input.cpp b/src/osgWrappers/osgDB/Input.cpp index 84ac300b6..4a53a2b66 100644 --- a/src/osgWrappers/osgDB/Input.cpp +++ b/src/osgWrappers/osgDB/Input.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include // Must undefine IN and OUT macros defined in Windows headers @@ -37,14 +37,14 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Input) I_Constructor0(____Input, "", ""); - I_Method1(void, setOptions, IN, const osgDB::ReaderWriter::Options *, options, + I_Method1(void, setOptions, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __void__setOptions__C5_ReaderWriter_Options_P1, + __void__setOptions__C5_Options_P1, "", ""); - I_Method0(const osgDB::ReaderWriter::Options *, getOptions, + I_Method0(const osgDB::Options *, getOptions, Properties::NON_VIRTUAL, - __C5_ReaderWriter_Options_P1__getOptions, + __C5_Options_P1__getOptions, "", ""); I_Method1(osg::Object *, readObjectOfType, IN, const osg::Object &, compObj, @@ -207,8 +207,8 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Input) __bool__read__C5_char_P1__Parameter__Parameter__Parameter__Parameter__Parameter__Parameter__Parameter__Parameter, "", ""); - I_SimpleProperty(const osgDB::ReaderWriter::Options *, Options, - __C5_ReaderWriter_Options_P1__getOptions, - __void__setOptions__C5_ReaderWriter_Options_P1); + I_SimpleProperty(const osgDB::Options *, Options, + __C5_Options_P1__getOptions, + __void__setOptions__C5_Options_P1); END_REFLECTOR diff --git a/src/osgWrappers/osgDB/Options.cpp b/src/osgWrappers/osgDB/Options.cpp new file mode 100644 index 000000000..9e0916293 --- /dev/null +++ b/src/osgWrappers/osgDB/Options.cpp @@ -0,0 +1,350 @@ +// *************************************************************************** +// +// Generated automatically by genwrapper. +// Please DO NOT EDIT this file! +// +// *************************************************************************** + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Must undefine IN and OUT macros defined in Windows headers +#ifdef IN +#undef IN +#endif +#ifdef OUT +#undef OUT +#endif + +BEGIN_OBJECT_REFLECTOR(osgDB::FindFileCallback) + I_DeclaringFile("osgDB/Options"); + I_VirtualBaseType(osg::Referenced); + I_Constructor0(____FindFileCallback, + "", + ""); + I_Method3(std::string, findDataFile, IN, const std::string &, filename, IN, const osgDB::Options *, options, IN, osgDB::CaseSensitivity, caseSensitivity, + Properties::VIRTUAL, + __std_string__findDataFile__C5_std_string_R1__C5_Options_P1__CaseSensitivity, + "", + ""); + I_Method3(std::string, findLibraryFile, IN, const std::string &, filename, IN, const osgDB::Options *, options, IN, osgDB::CaseSensitivity, caseSensitivity, + Properties::VIRTUAL, + __std_string__findLibraryFile__C5_std_string_R1__C5_Options_P1__CaseSensitivity, + "", + ""); +END_REFLECTOR + +BEGIN_ENUM_REFLECTOR(osgDB::Options::CacheHintOptions) + I_DeclaringFile("osgDB/Options"); + I_EnumLabel(osgDB::Options::CACHE_NONE); + I_EnumLabel(osgDB::Options::CACHE_NODES); + I_EnumLabel(osgDB::Options::CACHE_IMAGES); + I_EnumLabel(osgDB::Options::CACHE_HEIGHTFIELDS); + I_EnumLabel(osgDB::Options::CACHE_ARCHIVES); + I_EnumLabel(osgDB::Options::CACHE_OBJECTS); + I_EnumLabel(osgDB::Options::CACHE_SHADERS); + I_EnumLabel(osgDB::Options::CACHE_ALL); +END_REFLECTOR + +BEGIN_ENUM_REFLECTOR(osgDB::Options::BuildKdTreesHint) + I_DeclaringFile("osgDB/Options"); + I_EnumLabel(osgDB::Options::NO_PREFERENCE); + I_EnumLabel(osgDB::Options::DO_NOT_BUILD_KDTREES); + I_EnumLabel(osgDB::Options::BUILD_KDTREES); +END_REFLECTOR + +BEGIN_OBJECT_REFLECTOR(osgDB::Options) + I_DeclaringFile("osgDB/Options"); + I_BaseType(osg::Object); + I_Constructor0(____Options, + "", + ""); + I_Constructor1(IN, const std::string &, str, + Properties::NON_EXPLICIT, + ____Options__C5_std_string_R1, + "", + ""); + I_ConstructorWithDefaults2(IN, const osgDB::Options &, options, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY, + ____Options__C5_Options_R1__C5_osg_CopyOp_R1, + "", + ""); + I_Method0(osg::Object *, cloneType, + Properties::VIRTUAL, + __osg_Object_P1__cloneType, + "Clone the type of an object, with Object* return type. ", + "Must be defined by derived classes. "); + I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, x, + Properties::VIRTUAL, + __osg_Object_P1__clone__C5_osg_CopyOp_R1, + "Clone an object, with Object* return type. ", + "Must be defined by derived classes. "); + I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj, + Properties::VIRTUAL, + __bool__isSameKindAs__C5_osg_Object_P1, + "", + ""); + I_Method0(const char *, libraryName, + Properties::VIRTUAL, + __C5_char_P1__libraryName, + "return the name of the object's library. ", + "Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. "); + I_Method0(const char *, className, + Properties::VIRTUAL, + __C5_char_P1__className, + "return the name of the object's class type. ", + "Must be defined by derived classes. "); + I_Method1(void, setOptionString, IN, const std::string &, str, + Properties::NON_VIRTUAL, + __void__setOptionString__C5_std_string_R1, + "Set the general Options string. ", + ""); + I_Method0(const std::string &, getOptionString, + Properties::NON_VIRTUAL, + __C5_std_string_R1__getOptionString, + "Get the general Options string. ", + ""); + I_Method1(void, setDatabasePath, IN, const std::string &, str, + Properties::NON_VIRTUAL, + __void__setDatabasePath__C5_std_string_R1, + "Set the database path to use a hint of where to look when loading models. ", + ""); + I_Method0(osgDB::FilePathList &, getDatabasePathList, + Properties::NON_VIRTUAL, + __FilePathList_R1__getDatabasePathList, + "Get the database path which is used a hint of where to look when loading models. ", + ""); + I_Method0(const osgDB::FilePathList &, getDatabasePathList, + Properties::NON_VIRTUAL, + __C5_FilePathList_R1__getDatabasePathList, + "Get the const database path which is used a hint of where to look when loading models. ", + ""); + I_Method1(void, setObjectCacheHint, IN, osgDB::Options::CacheHintOptions, useObjectCache, + Properties::NON_VIRTUAL, + __void__setObjectCacheHint__CacheHintOptions, + "Set whether the Registry::ObjectCache should be used by default. ", + ""); + I_Method0(osgDB::Options::CacheHintOptions, getObjectCacheHint, + Properties::NON_VIRTUAL, + __CacheHintOptions__getObjectCacheHint, + "Get whether the Registry::ObjectCache should be used by default. ", + ""); + I_Method1(void, setBuildKdTreesHint, IN, osgDB::Options::BuildKdTreesHint, hint, + Properties::NON_VIRTUAL, + __void__setBuildKdTreesHint__BuildKdTreesHint, + "Set whether the KdTrees should be built for geometry in the loader model. ", + ""); + I_Method0(osgDB::Options::BuildKdTreesHint, getBuildKdTreesHint, + Properties::NON_VIRTUAL, + __BuildKdTreesHint__getBuildKdTreesHint, + "Get whether the KdTrees should be built for geometry in the loader model. ", + ""); + I_Method1(void, setAuthenticationMap, IN, osgDB::AuthenticationMap *, authenticationMap, + Properties::NON_VIRTUAL, + __void__setAuthenticationMap__AuthenticationMap_P1, + "Set the password map to be used by plugins when access files from secure locations. ", + ""); + I_Method0(const osgDB::AuthenticationMap *, getAuthenticationMap, + Properties::NON_VIRTUAL, + __C5_AuthenticationMap_P1__getAuthenticationMap, + "Get the password map to be used by plugins when access files from secure locations. ", + ""); + I_Method2(void, setPluginData, IN, const std::string &, s, IN, void *, v, + Properties::NON_VIRTUAL, + __void__setPluginData__C5_std_string_R1__void_P1, + "Sets a plugindata value PluginData with a string. ", + ""); + I_Method1(void *, getPluginData, IN, const std::string &, s, + Properties::NON_VIRTUAL, + __void_P1__getPluginData__C5_std_string_R1, + "Get a value from the PluginData. ", + ""); + I_Method1(const void *, getPluginData, IN, const std::string &, s, + Properties::NON_VIRTUAL, + __C5_void_P1__getPluginData__C5_std_string_R1, + "Get a value from the PluginData. ", + ""); + I_Method1(void, removePluginData, IN, const std::string &, s, + Properties::NON_VIRTUAL, + __void__removePluginData__C5_std_string_R1, + "Remove a value from the PluginData. ", + ""); + I_Method2(void, setPluginStringData, IN, const std::string &, s, IN, const std::string &, v, + Properties::NON_VIRTUAL, + __void__setPluginStringData__C5_std_string_R1__C5_std_string_R1, + "Sets a plugindata value PluginData with a string. ", + ""); + I_Method1(std::string, getPluginStringData, IN, const std::string &, s, + Properties::NON_VIRTUAL, + __std_string__getPluginStringData__C5_std_string_R1, + "Get a string from the PluginStrData. ", + ""); + I_Method1(const std::string, getPluginStringData, IN, const std::string &, s, + Properties::NON_VIRTUAL, + __C5_std_string__getPluginStringData__C5_std_string_R1, + "Get a value from the PluginData. ", + ""); + I_Method1(void, removePluginStringData, IN, const std::string &, s, + Properties::NON_VIRTUAL, + __void__removePluginStringData__C5_std_string_R1, + "Remove a value from the PluginData. ", + ""); + I_Method1(void, setFindFileCallback, IN, osgDB::FindFileCallback *, cb, + Properties::NON_VIRTUAL, + __void__setFindFileCallback__FindFileCallback_P1, + "Set the find callback to use in place of the default findFile calls. ", + ""); + I_Method0(osgDB::FindFileCallback *, getFindFileCallback, + Properties::NON_VIRTUAL, + __FindFileCallback_P1__getFindFileCallback, + "Get the const findFile callback. ", + ""); + I_Method1(void, setReadFileCallback, IN, osgDB::ReadFileCallback *, cb, + Properties::NON_VIRTUAL, + __void__setReadFileCallback__ReadFileCallback_P1, + "Set the read callback to use in place of the default readFile calls. ", + ""); + I_Method0(osgDB::ReadFileCallback *, getReadFileCallback, + Properties::NON_VIRTUAL, + __ReadFileCallback_P1__getReadFileCallback, + "Get the const readFile callback. ", + ""); + 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. ", + ""); + I_Method0(osgDB::WriteFileCallback *, getWriteFileCallback, + Properties::NON_VIRTUAL, + __WriteFileCallback_P1__getWriteFileCallback, + "Get the const writeFile callback. ", + ""); + I_SimpleProperty(osgDB::AuthenticationMap *, AuthenticationMap, + 0, + __void__setAuthenticationMap__AuthenticationMap_P1); + I_SimpleProperty(osgDB::Options::BuildKdTreesHint, BuildKdTreesHint, + __BuildKdTreesHint__getBuildKdTreesHint, + __void__setBuildKdTreesHint__BuildKdTreesHint); + I_SimpleProperty(const std::string &, DatabasePath, + 0, + __void__setDatabasePath__C5_std_string_R1); + I_SimpleProperty(osgDB::FilePathList &, DatabasePathList, + __FilePathList_R1__getDatabasePathList, + 0); + I_SimpleProperty(osgDB::FindFileCallback *, FindFileCallback, + __FindFileCallback_P1__getFindFileCallback, + __void__setFindFileCallback__FindFileCallback_P1); + I_SimpleProperty(osgDB::Options::CacheHintOptions, ObjectCacheHint, + __CacheHintOptions__getObjectCacheHint, + __void__setObjectCacheHint__CacheHintOptions); + I_SimpleProperty(const std::string &, OptionString, + __C5_std_string_R1__getOptionString, + __void__setOptionString__C5_std_string_R1); + I_IndexedProperty(void *, PluginData, + __void_P1__getPluginData__C5_std_string_R1, + __void__setPluginData__C5_std_string_R1__void_P1, + 0); + I_IndexedProperty(std::string, PluginStringData, + __std_string__getPluginStringData__C5_std_string_R1, + __void__setPluginStringData__C5_std_string_R1__C5_std_string_R1, + 0); + I_SimpleProperty(osgDB::ReadFileCallback *, ReadFileCallback, + __ReadFileCallback_P1__getReadFileCallback, + __void__setReadFileCallback__ReadFileCallback_P1); + I_SimpleProperty(osgDB::WriteFileCallback *, WriteFileCallback, + __WriteFileCallback_P1__getWriteFileCallback, + __void__setWriteFileCallback__WriteFileCallback_P1); +END_REFLECTOR + +BEGIN_OBJECT_REFLECTOR(osgDB::ReadFileCallback) + I_DeclaringFile("osgDB/Options"); + I_VirtualBaseType(osg::Referenced); + I_Constructor0(____ReadFileCallback, + "", + ""); + I_Method4(osgDB::ReaderWriter::ReadResult, openArchive, IN, const std::string &, filename, IN, osgDB::ReaderWriter::ArchiveStatus, status, IN, unsigned int, indexBlockSizeHint, IN, const osgDB::Options *, useObjectCache, + Properties::VIRTUAL, + __ReaderWriter_ReadResult__openArchive__C5_std_string_R1__ReaderWriter_ArchiveStatus__unsigned_int__C5_Options_P1, + "", + ""); + I_Method2(osgDB::ReaderWriter::ReadResult, readObject, IN, const std::string &, filename, IN, const osgDB::Options *, options, + Properties::VIRTUAL, + __ReaderWriter_ReadResult__readObject__C5_std_string_R1__C5_Options_P1, + "", + ""); + I_Method2(osgDB::ReaderWriter::ReadResult, readImage, IN, const std::string &, filename, IN, const osgDB::Options *, options, + Properties::VIRTUAL, + __ReaderWriter_ReadResult__readImage__C5_std_string_R1__C5_Options_P1, + "", + ""); + I_Method2(osgDB::ReaderWriter::ReadResult, readHeightField, IN, const std::string &, filename, IN, const osgDB::Options *, options, + Properties::VIRTUAL, + __ReaderWriter_ReadResult__readHeightField__C5_std_string_R1__C5_Options_P1, + "", + ""); + I_Method2(osgDB::ReaderWriter::ReadResult, readNode, IN, const std::string &, filename, IN, const osgDB::Options *, options, + Properties::VIRTUAL, + __ReaderWriter_ReadResult__readNode__C5_std_string_R1__C5_Options_P1, + "", + ""); + I_Method2(osgDB::ReaderWriter::ReadResult, readShader, IN, const std::string &, filename, IN, const osgDB::Options *, options, + Properties::VIRTUAL, + __ReaderWriter_ReadResult__readShader__C5_std_string_R1__C5_Options_P1, + "", + ""); +END_REFLECTOR + +BEGIN_OBJECT_REFLECTOR(osgDB::WriteFileCallback) + I_DeclaringFile("osgDB/Options"); + I_VirtualBaseType(osg::Referenced); + I_Constructor0(____WriteFileCallback, + "", + ""); + I_Method3(osgDB::ReaderWriter::WriteResult, writeObject, IN, const osg::Object &, obj, IN, const std::string &, fileName, IN, const osgDB::Options *, options, + Properties::VIRTUAL, + __ReaderWriter_WriteResult__writeObject__C5_osg_Object_R1__C5_std_string_R1__C5_Options_P1, + "", + ""); + I_Method3(osgDB::ReaderWriter::WriteResult, writeImage, IN, const osg::Image &, obj, IN, const std::string &, fileName, IN, const osgDB::Options *, options, + Properties::VIRTUAL, + __ReaderWriter_WriteResult__writeImage__C5_osg_Image_R1__C5_std_string_R1__C5_Options_P1, + "", + ""); + I_Method3(osgDB::ReaderWriter::WriteResult, writeHeightField, IN, const osg::HeightField &, obj, IN, const std::string &, fileName, IN, const osgDB::Options *, options, + Properties::VIRTUAL, + __ReaderWriter_WriteResult__writeHeightField__C5_osg_HeightField_R1__C5_std_string_R1__C5_Options_P1, + "", + ""); + I_Method3(osgDB::ReaderWriter::WriteResult, writeNode, IN, const osg::Node &, obj, IN, const std::string &, fileName, IN, const osgDB::Options *, options, + Properties::VIRTUAL, + __ReaderWriter_WriteResult__writeNode__C5_osg_Node_R1__C5_std_string_R1__C5_Options_P1, + "", + ""); + I_Method3(osgDB::ReaderWriter::WriteResult, writeShader, IN, const osg::Shader &, obj, IN, const std::string &, fileName, IN, const osgDB::Options *, options, + Properties::VIRTUAL, + __ReaderWriter_WriteResult__writeShader__C5_osg_Shader_R1__C5_std_string_R1__C5_Options_P1, + "", + ""); +END_REFLECTOR + +BEGIN_ENUM_REFLECTOR(osgDB::CaseSensitivity) + I_DeclaringFile("osgDB/Options"); + I_EnumLabel(osgDB::CASE_SENSITIVE); + I_EnumLabel(osgDB::CASE_INSENSITIVE); +END_REFLECTOR + +TYPE_NAME_ALIAS(std::deque< std::string >, osgDB::FilePathList) + +STD_VECTOR_REFLECTOR(std::deque< std::string >) + diff --git a/src/osgWrappers/osgDB/Output.cpp b/src/osgWrappers/osgDB/Output.cpp index 0afda06a7..c32050662 100644 --- a/src/osgWrappers/osgDB/Output.cpp +++ b/src/osgWrappers/osgDB/Output.cpp @@ -11,8 +11,8 @@ #include #include +#include #include -#include // Must undefine IN and OUT macros defined in Windows headers #ifdef IN diff --git a/src/osgWrappers/osgDB/ReaderWriter.cpp b/src/osgWrappers/osgDB/ReaderWriter.cpp index 4c1ae0567..3fc417041 100644 --- a/src/osgWrappers/osgDB/ReaderWriter.cpp +++ b/src/osgWrappers/osgDB/ReaderWriter.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include // Must undefine IN and OUT macros defined in Windows headers @@ -28,6 +27,8 @@ #undef OUT #endif +#include + BEGIN_ENUM_REFLECTOR(osgDB::ReaderWriter::Features) I_DeclaringFile("osgDB/ReaderWriter"); I_EnumLabel(osgDB::ReaderWriter::FEATURE_NONE); @@ -55,6 +56,8 @@ TYPE_NAME_ALIAS(std::map< std::string COMMA std::string >, osgDB::ReaderWriter: TYPE_NAME_ALIAS(std::list< std::string >, osgDB::ReaderWriter::FeatureList) +TYPE_NAME_ALIAS(osgDB::Options, osgDB::ReaderWriter::Options) + BEGIN_OBJECT_REFLECTOR(osgDB::ReaderWriter) I_DeclaringFile("osgDB/ReaderWriter"); I_BaseType(osg::Object); @@ -249,188 +252,6 @@ BEGIN_OBJECT_REFLECTOR(osgDB::ReaderWriter) ""); END_REFLECTOR -BEGIN_ENUM_REFLECTOR(osgDB::ReaderWriter::Options::CacheHintOptions) - I_DeclaringFile("osgDB/ReaderWriter"); - I_EnumLabel(osgDB::ReaderWriter::Options::CACHE_NONE); - I_EnumLabel(osgDB::ReaderWriter::Options::CACHE_NODES); - I_EnumLabel(osgDB::ReaderWriter::Options::CACHE_IMAGES); - I_EnumLabel(osgDB::ReaderWriter::Options::CACHE_HEIGHTFIELDS); - I_EnumLabel(osgDB::ReaderWriter::Options::CACHE_ARCHIVES); - I_EnumLabel(osgDB::ReaderWriter::Options::CACHE_OBJECTS); - I_EnumLabel(osgDB::ReaderWriter::Options::CACHE_SHADERS); - I_EnumLabel(osgDB::ReaderWriter::Options::CACHE_ALL); -END_REFLECTOR - -BEGIN_ENUM_REFLECTOR(osgDB::ReaderWriter::Options::BuildKdTreesHint) - I_DeclaringFile("osgDB/ReaderWriter"); - I_EnumLabel(osgDB::ReaderWriter::Options::NO_PREFERENCE); - I_EnumLabel(osgDB::ReaderWriter::Options::DO_NOT_BUILD_KDTREES); - I_EnumLabel(osgDB::ReaderWriter::Options::BUILD_KDTREES); -END_REFLECTOR - -BEGIN_OBJECT_REFLECTOR(osgDB::ReaderWriter::Options) - I_DeclaringFile("osgDB/ReaderWriter"); - I_BaseType(osg::Object); - I_Constructor0(____Options, - "", - ""); - I_Constructor1(IN, const std::string &, str, - Properties::NON_EXPLICIT, - ____Options__C5_std_string_R1, - "", - ""); - I_ConstructorWithDefaults2(IN, const osgDB::ReaderWriter::Options &, options, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY, - ____Options__C5_Options_R1__C5_osg_CopyOp_R1, - "", - ""); - I_Method0(osg::Object *, cloneType, - Properties::VIRTUAL, - __osg_Object_P1__cloneType, - "Clone the type of an object, with Object* return type. ", - "Must be defined by derived classes. "); - I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, x, - Properties::VIRTUAL, - __osg_Object_P1__clone__C5_osg_CopyOp_R1, - "Clone an object, with Object* return type. ", - "Must be defined by derived classes. "); - I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj, - Properties::VIRTUAL, - __bool__isSameKindAs__C5_osg_Object_P1, - "", - ""); - I_Method0(const char *, libraryName, - Properties::VIRTUAL, - __C5_char_P1__libraryName, - "return the name of the object's library. ", - "Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. "); - I_Method0(const char *, className, - Properties::VIRTUAL, - __C5_char_P1__className, - "return the name of the object's class type. ", - "Must be defined by derived classes. "); - I_Method1(void, setOptionString, IN, const std::string &, str, - Properties::NON_VIRTUAL, - __void__setOptionString__C5_std_string_R1, - "Set the general Options string. ", - ""); - I_Method0(const std::string &, getOptionString, - Properties::NON_VIRTUAL, - __C5_std_string_R1__getOptionString, - "Get the general Options string. ", - ""); - I_Method1(void, setDatabasePath, IN, const std::string &, str, - Properties::NON_VIRTUAL, - __void__setDatabasePath__C5_std_string_R1, - "Set the database path to use a hint of where to look when loading models. ", - ""); - I_Method0(osgDB::FilePathList &, getDatabasePathList, - Properties::NON_VIRTUAL, - __FilePathList_R1__getDatabasePathList, - "Get the database path which is used a hint of where to look when loading models. ", - ""); - I_Method0(const osgDB::FilePathList &, getDatabasePathList, - Properties::NON_VIRTUAL, - __C5_FilePathList_R1__getDatabasePathList, - "Get the const database path which is used a hint of where to look when loading models. ", - ""); - I_Method1(void, setObjectCacheHint, IN, osgDB::ReaderWriter::Options::CacheHintOptions, useObjectCache, - Properties::NON_VIRTUAL, - __void__setObjectCacheHint__CacheHintOptions, - "Set whether the Registry::ObjectCache should be used by default. ", - ""); - I_Method0(osgDB::ReaderWriter::Options::CacheHintOptions, getObjectCacheHint, - Properties::NON_VIRTUAL, - __CacheHintOptions__getObjectCacheHint, - "Get whether the Registry::ObjectCache should be used by default. ", - ""); - I_Method1(void, setBuildKdTreesHint, IN, osgDB::ReaderWriter::Options::BuildKdTreesHint, hint, - Properties::NON_VIRTUAL, - __void__setBuildKdTreesHint__BuildKdTreesHint, - "Set whether the KdTrees should be built for geometry in the loader model. ", - ""); - I_Method0(osgDB::ReaderWriter::Options::BuildKdTreesHint, getBuildKdTreesHint, - Properties::NON_VIRTUAL, - __BuildKdTreesHint__getBuildKdTreesHint, - "Get whether the KdTrees should be built for geometry in the loader model. ", - ""); - I_Method1(void, setAuthenticationMap, IN, osgDB::AuthenticationMap *, authenticationMap, - Properties::NON_VIRTUAL, - __void__setAuthenticationMap__AuthenticationMap_P1, - "Set the password map to be used by plugins when access files from secure locations. ", - ""); - I_Method0(const osgDB::AuthenticationMap *, getAuthenticationMap, - Properties::NON_VIRTUAL, - __C5_AuthenticationMap_P1__getAuthenticationMap, - "Get the password map to be used by plugins when access files from secure locations. ", - ""); - I_Method2(void, setPluginData, IN, const std::string &, s, IN, void *, v, - Properties::NON_VIRTUAL, - __void__setPluginData__C5_std_string_R1__void_P1, - "Sets a plugindata value PluginData with a string. ", - ""); - I_Method1(void *, getPluginData, IN, const std::string &, s, - Properties::NON_VIRTUAL, - __void_P1__getPluginData__C5_std_string_R1, - "Get a value from the PluginData. ", - ""); - I_Method1(const void *, getPluginData, IN, const std::string &, s, - Properties::NON_VIRTUAL, - __C5_void_P1__getPluginData__C5_std_string_R1, - "Get a value from the PluginData. ", - ""); - I_Method1(void, removePluginData, IN, const std::string &, s, - Properties::NON_VIRTUAL, - __void__removePluginData__C5_std_string_R1, - "Remove a value from the PluginData. ", - ""); - I_Method2(void, setPluginStringData, IN, const std::string &, s, IN, const std::string &, v, - Properties::NON_VIRTUAL, - __void__setPluginStringData__C5_std_string_R1__C5_std_string_R1, - "Sets a plugindata value PluginData with a string. ", - ""); - I_Method1(std::string, getPluginStringData, IN, const std::string &, s, - Properties::NON_VIRTUAL, - __std_string__getPluginStringData__C5_std_string_R1, - "Get a string from the PluginStrData. ", - ""); - I_Method1(const std::string, getPluginStringData, IN, const std::string &, s, - Properties::NON_VIRTUAL, - __C5_std_string__getPluginStringData__C5_std_string_R1, - "Get a value from the PluginData. ", - ""); - I_Method1(void, removePluginStringData, IN, const std::string &, s, - Properties::NON_VIRTUAL, - __void__removePluginStringData__C5_std_string_R1, - "Remove a value from the PluginData. ", - ""); - I_SimpleProperty(osgDB::AuthenticationMap *, AuthenticationMap, - 0, - __void__setAuthenticationMap__AuthenticationMap_P1); - I_SimpleProperty(osgDB::ReaderWriter::Options::BuildKdTreesHint, BuildKdTreesHint, - __BuildKdTreesHint__getBuildKdTreesHint, - __void__setBuildKdTreesHint__BuildKdTreesHint); - I_SimpleProperty(const std::string &, DatabasePath, - 0, - __void__setDatabasePath__C5_std_string_R1); - I_SimpleProperty(osgDB::FilePathList &, DatabasePathList, - __FilePathList_R1__getDatabasePathList, - 0); - I_SimpleProperty(osgDB::ReaderWriter::Options::CacheHintOptions, ObjectCacheHint, - __CacheHintOptions__getObjectCacheHint, - __void__setObjectCacheHint__CacheHintOptions); - I_SimpleProperty(const std::string &, OptionString, - __C5_std_string_R1__getOptionString, - __void__setOptionString__C5_std_string_R1); - I_IndexedProperty(void *, PluginData, - __void_P1__getPluginData__C5_std_string_R1, - __void__setPluginData__C5_std_string_R1__void_P1, - 0); - I_IndexedProperty(std::string, PluginStringData, - __std_string__getPluginStringData__C5_std_string_R1, - __void__setPluginStringData__C5_std_string_R1__C5_std_string_R1, - 0); -END_REFLECTOR - BEGIN_ENUM_REFLECTOR(osgDB::ReaderWriter::ReadResult::ReadStatus) I_DeclaringFile("osgDB/ReaderWriter"); I_EnumLabel(osgDB::ReaderWriter::ReadResult::NOT_IMPLEMENTED); @@ -670,7 +491,3 @@ BEGIN_VALUE_REFLECTOR(osgDB::ReaderWriter::WriteResult) ""); END_REFLECTOR -TYPE_NAME_ALIAS(std::deque< std::string >, osgDB::FilePathList) - -STD_VECTOR_REFLECTOR(std::deque< std::string >) - diff --git a/src/osgWrappers/osgDB/Registry.cpp b/src/osgWrappers/osgDB/Registry.cpp index 876b7c6bc..2bcb64160 100644 --- a/src/osgWrappers/osgDB/Registry.cpp +++ b/src/osgWrappers/osgDB/Registry.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -78,6 +79,12 @@ END_REFLECTOR TYPE_NAME_ALIAS(std::vector< osg::ref_ptr< osgDB::ReaderWriter > >, osgDB::Registry::ReaderWriterList) +TYPE_NAME_ALIAS(class osgDB::FindFileCallback, osgDB::Registry::FindFileCallback) + +TYPE_NAME_ALIAS(class osgDB::ReadFileCallback, osgDB::Registry::ReadFileCallback) + +TYPE_NAME_ALIAS(class osgDB::WriteFileCallback, osgDB::Registry::WriteFileCallback) + BEGIN_OBJECT_REFLECTOR(osgDB::Registry) I_DeclaringFile("osgDB/Registry"); I_BaseType(osg::Referenced); @@ -225,6 +232,41 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Registry) __bool__writeObject__C5_osg_Object_R1__Output_R1, "", ""); + I_Method1(void, setFindFileCallback, IN, osgDB::Registry::FindFileCallback *, cb, + Properties::NON_VIRTUAL, + __void__setFindFileCallback__FindFileCallback_P1, + "Set the Registry callback to use in place of the default findFile calls. ", + ""); + I_Method0(osgDB::Registry::FindFileCallback *, getFindFileCallback, + Properties::NON_VIRTUAL, + __FindFileCallback_P1__getFindFileCallback, + "Get the findFile callback. ", + ""); + I_Method0(const osgDB::Registry::FindFileCallback *, getFindFileCallback, + Properties::NON_VIRTUAL, + __C5_FindFileCallback_P1__getFindFileCallback, + "Get the const findFile callback. ", + ""); + I_Method3(std::string, findDataFile, IN, const std::string &, fileName, IN, const osgDB::Options *, options, IN, osgDB::CaseSensitivity, caseSensitivity, + Properties::NON_VIRTUAL, + __std_string__findDataFile__C5_std_string_R1__C5_Options_P1__CaseSensitivity, + "", + ""); + I_Method3(std::string, findDataFileImplementation, IN, const std::string &, fileName, IN, const osgDB::Options *, options, IN, osgDB::CaseSensitivity, caseSensitivity, + Properties::NON_VIRTUAL, + __std_string__findDataFileImplementation__C5_std_string_R1__C5_Options_P1__CaseSensitivity, + "", + ""); + I_Method3(std::string, findLibraryFile, IN, const std::string &, fileName, IN, const osgDB::Options *, options, IN, osgDB::CaseSensitivity, caseSensitivity, + Properties::NON_VIRTUAL, + __std_string__findLibraryFile__C5_std_string_R1__C5_Options_P1__CaseSensitivity, + "", + ""); + I_Method3(std::string, findLibraryFileImplementation, IN, const std::string &, fileName, IN, const osgDB::Options *, options, IN, osgDB::CaseSensitivity, caseSensitivity, + Properties::NON_VIRTUAL, + __std_string__findLibraryFileImplementation__C5_std_string_R1__C5_Options_P1__CaseSensitivity, + "", + ""); I_Method1(void, setReadFileCallback, IN, osgDB::Registry::ReadFileCallback *, cb, Properties::NON_VIRTUAL, __void__setReadFileCallback__ReadFileCallback_P1, @@ -240,64 +282,64 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Registry) __C5_ReadFileCallback_P1__getReadFileCallback, "Get the const readFile callback. ", ""); - I_Method4(osgDB::ReaderWriter::ReadResult, openArchive, IN, const std::string &, fileName, IN, osgDB::ReaderWriter::ArchiveStatus, status, IN, unsigned int, indexBlockSizeHint, IN, const osgDB::ReaderWriter::Options *, options, + I_Method4(osgDB::ReaderWriter::ReadResult, openArchive, IN, const std::string &, fileName, IN, osgDB::ReaderWriter::ArchiveStatus, status, IN, unsigned int, indexBlockSizeHint, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_ReadResult__openArchive__C5_std_string_R1__ReaderWriter_ArchiveStatus__unsigned_int__C5_ReaderWriter_Options_P1, + __ReaderWriter_ReadResult__openArchive__C5_std_string_R1__ReaderWriter_ArchiveStatus__unsigned_int__C5_Options_P1, "", ""); - I_Method4(osgDB::ReaderWriter::ReadResult, openArchiveImplementation, IN, const std::string &, fileName, IN, osgDB::ReaderWriter::ArchiveStatus, status, IN, unsigned int, indexBlockSizeHint, IN, const osgDB::ReaderWriter::Options *, options, + I_Method4(osgDB::ReaderWriter::ReadResult, openArchiveImplementation, IN, const std::string &, fileName, IN, osgDB::ReaderWriter::ArchiveStatus, status, IN, unsigned int, indexBlockSizeHint, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_ReadResult__openArchiveImplementation__C5_std_string_R1__ReaderWriter_ArchiveStatus__unsigned_int__C5_ReaderWriter_Options_P1, + __ReaderWriter_ReadResult__openArchiveImplementation__C5_std_string_R1__ReaderWriter_ArchiveStatus__unsigned_int__C5_Options_P1, "", ""); - I_MethodWithDefaults3(osgDB::ReaderWriter::ReadResult, readObject, IN, const std::string &, fileName, , IN, const osgDB::ReaderWriter::Options *, options, , IN, bool, buildKdTreeIfRequired, true, + I_MethodWithDefaults3(osgDB::ReaderWriter::ReadResult, readObject, IN, const std::string &, fileName, , IN, const osgDB::Options *, options, , IN, bool, buildKdTreeIfRequired, true, Properties::NON_VIRTUAL, - __ReaderWriter_ReadResult__readObject__C5_std_string_R1__C5_ReaderWriter_Options_P1__bool, + __ReaderWriter_ReadResult__readObject__C5_std_string_R1__C5_Options_P1__bool, "", ""); - I_Method2(osgDB::ReaderWriter::ReadResult, readObjectImplementation, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method2(osgDB::ReaderWriter::ReadResult, readObjectImplementation, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_ReadResult__readObjectImplementation__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_ReadResult__readObjectImplementation__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method2(osgDB::ReaderWriter::ReadResult, readImage, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method2(osgDB::ReaderWriter::ReadResult, readImage, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_ReadResult__readImage__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_ReadResult__readImage__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method2(osgDB::ReaderWriter::ReadResult, readImageImplementation, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method2(osgDB::ReaderWriter::ReadResult, readImageImplementation, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_ReadResult__readImageImplementation__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_ReadResult__readImageImplementation__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method2(osgDB::ReaderWriter::ReadResult, readHeightField, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method2(osgDB::ReaderWriter::ReadResult, readHeightField, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_ReadResult__readHeightField__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_ReadResult__readHeightField__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method2(osgDB::ReaderWriter::ReadResult, readHeightFieldImplementation, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method2(osgDB::ReaderWriter::ReadResult, readHeightFieldImplementation, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_ReadResult__readHeightFieldImplementation__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_ReadResult__readHeightFieldImplementation__C5_std_string_R1__C5_Options_P1, "", ""); - I_MethodWithDefaults3(osgDB::ReaderWriter::ReadResult, readNode, IN, const std::string &, fileName, , IN, const osgDB::ReaderWriter::Options *, options, , IN, bool, buildKdTreeIfRequired, true, + I_MethodWithDefaults3(osgDB::ReaderWriter::ReadResult, readNode, IN, const std::string &, fileName, , IN, const osgDB::Options *, options, , IN, bool, buildKdTreeIfRequired, true, Properties::NON_VIRTUAL, - __ReaderWriter_ReadResult__readNode__C5_std_string_R1__C5_ReaderWriter_Options_P1__bool, + __ReaderWriter_ReadResult__readNode__C5_std_string_R1__C5_Options_P1__bool, "", ""); - I_Method2(osgDB::ReaderWriter::ReadResult, readNodeImplementation, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method2(osgDB::ReaderWriter::ReadResult, readNodeImplementation, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_ReadResult__readNodeImplementation__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_ReadResult__readNodeImplementation__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method2(osgDB::ReaderWriter::ReadResult, readShader, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method2(osgDB::ReaderWriter::ReadResult, readShader, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_ReadResult__readShader__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_ReadResult__readShader__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method2(osgDB::ReaderWriter::ReadResult, readShaderImplementation, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method2(osgDB::ReaderWriter::ReadResult, readShaderImplementation, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_ReadResult__readShaderImplementation__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_ReadResult__readShaderImplementation__C5_std_string_R1__C5_Options_P1, "", ""); I_Method1(void, setWriteFileCallback, IN, osgDB::Registry::WriteFileCallback *, cb, @@ -315,69 +357,69 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Registry) __C5_WriteFileCallback_P1__getWriteFileCallback, "Get the const writeFile callback. ", ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeObject, IN, const osg::Object &, obj, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method3(osgDB::ReaderWriter::WriteResult, writeObject, IN, const osg::Object &, obj, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_WriteResult__writeObject__C5_osg_Object_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_WriteResult__writeObject__C5_osg_Object_R1__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeObjectImplementation, IN, const osg::Object &, obj, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method3(osgDB::ReaderWriter::WriteResult, writeObjectImplementation, IN, const osg::Object &, obj, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_WriteResult__writeObjectImplementation__C5_osg_Object_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_WriteResult__writeObjectImplementation__C5_osg_Object_R1__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeImage, IN, const osg::Image &, obj, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method3(osgDB::ReaderWriter::WriteResult, writeImage, IN, const osg::Image &, obj, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_WriteResult__writeImage__C5_osg_Image_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_WriteResult__writeImage__C5_osg_Image_R1__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeImageImplementation, IN, const osg::Image &, obj, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method3(osgDB::ReaderWriter::WriteResult, writeImageImplementation, IN, const osg::Image &, obj, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_WriteResult__writeImageImplementation__C5_osg_Image_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_WriteResult__writeImageImplementation__C5_osg_Image_R1__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeHeightField, IN, const osg::HeightField &, obj, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method3(osgDB::ReaderWriter::WriteResult, writeHeightField, IN, const osg::HeightField &, obj, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_WriteResult__writeHeightField__C5_osg_HeightField_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_WriteResult__writeHeightField__C5_osg_HeightField_R1__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeHeightFieldImplementation, IN, const osg::HeightField &, obj, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method3(osgDB::ReaderWriter::WriteResult, writeHeightFieldImplementation, IN, const osg::HeightField &, obj, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_WriteResult__writeHeightFieldImplementation__C5_osg_HeightField_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_WriteResult__writeHeightFieldImplementation__C5_osg_HeightField_R1__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeNode, IN, const osg::Node &, node, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method3(osgDB::ReaderWriter::WriteResult, writeNode, IN, const osg::Node &, node, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_WriteResult__writeNode__C5_osg_Node_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_WriteResult__writeNode__C5_osg_Node_R1__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeNodeImplementation, IN, const osg::Node &, node, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method3(osgDB::ReaderWriter::WriteResult, writeNodeImplementation, IN, const osg::Node &, node, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_WriteResult__writeNodeImplementation__C5_osg_Node_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_WriteResult__writeNodeImplementation__C5_osg_Node_R1__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeShader, IN, const osg::Shader &, obj, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method3(osgDB::ReaderWriter::WriteResult, writeShader, IN, const osg::Shader &, obj, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_WriteResult__writeShader__C5_osg_Shader_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_WriteResult__writeShader__C5_osg_Shader_R1__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeShaderImplementation, IN, const osg::Shader &, obj, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, + I_Method3(osgDB::ReaderWriter::WriteResult, writeShaderImplementation, IN, const osg::Shader &, obj, IN, const std::string &, fileName, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __ReaderWriter_WriteResult__writeShaderImplementation__C5_osg_Shader_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, + __ReaderWriter_WriteResult__writeShaderImplementation__C5_osg_Shader_R1__C5_std_string_R1__C5_Options_P1, "", ""); - I_Method2(void, _buildKdTreeIfRequired, IN, osgDB::ReaderWriter::ReadResult &, result, IN, const osgDB::ReaderWriter::Options *, options, + I_Method2(void, _buildKdTreeIfRequired, IN, osgDB::ReaderWriter::ReadResult &, result, IN, const osgDB::Options *, options, Properties::NON_VIRTUAL, - __void___buildKdTreeIfRequired__ReaderWriter_ReadResult_R1__C5_ReaderWriter_Options_P1, + __void___buildKdTreeIfRequired__ReaderWriter_ReadResult_R1__C5_Options_P1, "", ""); - I_Method1(void, setBuildKdTreesHint, IN, osgDB::ReaderWriter::Options::BuildKdTreesHint, hint, + I_Method1(void, setBuildKdTreesHint, IN, osgDB::Options::BuildKdTreesHint, hint, Properties::NON_VIRTUAL, - __void__setBuildKdTreesHint__ReaderWriter_Options_BuildKdTreesHint, + __void__setBuildKdTreesHint__Options_BuildKdTreesHint, "Set whether the KdTrees should be built for geometry in the loader model. ", ""); - I_Method0(osgDB::ReaderWriter::Options::BuildKdTreesHint, getBuildKdTreesHint, + I_Method0(osgDB::Options::BuildKdTreesHint, getBuildKdTreesHint, Properties::NON_VIRTUAL, - __ReaderWriter_Options_BuildKdTreesHint__getBuildKdTreesHint, + __Options_BuildKdTreesHint__getBuildKdTreesHint, "Get whether the KdTrees should be built for geometry in the loader model. ", ""); I_Method1(void, setKdTreeBuilder, IN, osg::KdTreeBuilder *, builder, @@ -430,19 +472,19 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Registry) __bool__getCreateNodeFromImage, "", ""); - I_Method1(void, setOptions, IN, osgDB::ReaderWriter::Options *, opt, + I_Method1(void, setOptions, IN, osgDB::Options *, opt, Properties::NON_VIRTUAL, - __void__setOptions__ReaderWriter_Options_P1, + __void__setOptions__Options_P1, "", ""); - I_Method0(osgDB::ReaderWriter::Options *, getOptions, + I_Method0(osgDB::Options *, getOptions, Properties::NON_VIRTUAL, - __ReaderWriter_Options_P1__getOptions, + __Options_P1__getOptions, "", ""); - I_Method0(const osgDB::ReaderWriter::Options *, getOptions, + I_Method0(const osgDB::Options *, getOptions, Properties::NON_VIRTUAL, - __C5_ReaderWriter_Options_P1__getOptions, + __C5_Options_P1__getOptions, "", ""); I_Method0(void, initFilePathLists, @@ -603,18 +645,18 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Registry) __ReaderWriter_ReadResult__read__C5_ReadFunctor_R1, "", ""); - I_ProtectedMethod2(osgDB::ReaderWriter::ReadResult, readImplementation, IN, const osgDB::Registry::ReadFunctor &, readFunctor, IN, osgDB::ReaderWriter::Options::CacheHintOptions, cacheHint, + I_ProtectedMethod2(osgDB::ReaderWriter::ReadResult, readImplementation, IN, const osgDB::Registry::ReadFunctor &, readFunctor, IN, osgDB::Options::CacheHintOptions, cacheHint, Properties::NON_VIRTUAL, Properties::NON_CONST, - __ReaderWriter_ReadResult__readImplementation__C5_ReadFunctor_R1__ReaderWriter_Options_CacheHintOptions, + __ReaderWriter_ReadResult__readImplementation__C5_ReadFunctor_R1__Options_CacheHintOptions, "", ""); I_SimpleProperty(osgDB::AuthenticationMap *, AuthenticationMap, __AuthenticationMap_P1__getAuthenticationMap, __void__setAuthenticationMap__AuthenticationMap_P1); - I_SimpleProperty(osgDB::ReaderWriter::Options::BuildKdTreesHint, BuildKdTreesHint, - __ReaderWriter_Options_BuildKdTreesHint__getBuildKdTreesHint, - __void__setBuildKdTreesHint__ReaderWriter_Options_BuildKdTreesHint); + I_SimpleProperty(osgDB::Options::BuildKdTreesHint, BuildKdTreesHint, + __Options_BuildKdTreesHint__getBuildKdTreesHint, + __void__setBuildKdTreesHint__Options_BuildKdTreesHint); I_SimpleProperty(bool, CreateNodeFromImage, __bool__getCreateNodeFromImage, __void__setCreateNodeFromImage__bool); @@ -624,15 +666,18 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Registry) I_SimpleProperty(osgDB::FileCache *, FileCache, __FileCache_P1__getFileCache, __void__setFileCache__FileCache_P1); + I_SimpleProperty(osgDB::Registry::FindFileCallback *, FindFileCallback, + __FindFileCallback_P1__getFindFileCallback, + __void__setFindFileCallback__FindFileCallback_P1); I_SimpleProperty(osg::KdTreeBuilder *, KdTreeBuilder, __osg_KdTreeBuilder_P1__getKdTreeBuilder, __void__setKdTreeBuilder__osg_KdTreeBuilder_P1); I_SimpleProperty(const osgDB::FilePathList &, LibraryFilePathList, __C5_FilePathList_R1__getLibraryFilePathList, __void__setLibraryFilePathList__C5_FilePathList_R1); - I_SimpleProperty(osgDB::ReaderWriter::Options *, Options, - __ReaderWriter_Options_P1__getOptions, - __void__setOptions__ReaderWriter_Options_P1); + I_SimpleProperty(osgDB::Options *, Options, + __Options_P1__getOptions, + __void__setOptions__Options_P1); I_SimpleProperty(osgDB::Registry::ReadFileCallback *, ReadFileCallback, __ReadFileCallback_P1__getReadFileCallback, __void__setReadFileCallback__ReadFileCallback_P1); @@ -647,48 +692,10 @@ BEGIN_OBJECT_REFLECTOR(osgDB::Registry) __void__setWriteFileCallback__WriteFileCallback_P1); END_REFLECTOR -BEGIN_OBJECT_REFLECTOR(osgDB::Registry::ReadFileCallback) - I_DeclaringFile("osgDB/Registry"); - I_VirtualBaseType(osg::Referenced); - I_Constructor0(____ReadFileCallback, - "", - ""); - I_Method4(osgDB::ReaderWriter::ReadResult, openArchive, IN, const std::string &, filename, IN, osgDB::ReaderWriter::ArchiveStatus, status, IN, unsigned int, indexBlockSizeHint, IN, const osgDB::ReaderWriter::Options *, useObjectCache, - Properties::VIRTUAL, - __ReaderWriter_ReadResult__openArchive__C5_std_string_R1__ReaderWriter_ArchiveStatus__unsigned_int__C5_ReaderWriter_Options_P1, - "", - ""); - I_Method2(osgDB::ReaderWriter::ReadResult, readObject, IN, const std::string &, filename, IN, const osgDB::ReaderWriter::Options *, options, - Properties::VIRTUAL, - __ReaderWriter_ReadResult__readObject__C5_std_string_R1__C5_ReaderWriter_Options_P1, - "", - ""); - I_Method2(osgDB::ReaderWriter::ReadResult, readImage, IN, const std::string &, filename, IN, const osgDB::ReaderWriter::Options *, options, - Properties::VIRTUAL, - __ReaderWriter_ReadResult__readImage__C5_std_string_R1__C5_ReaderWriter_Options_P1, - "", - ""); - I_Method2(osgDB::ReaderWriter::ReadResult, readHeightField, IN, const std::string &, filename, IN, const osgDB::ReaderWriter::Options *, options, - Properties::VIRTUAL, - __ReaderWriter_ReadResult__readHeightField__C5_std_string_R1__C5_ReaderWriter_Options_P1, - "", - ""); - I_Method2(osgDB::ReaderWriter::ReadResult, readNode, IN, const std::string &, filename, IN, const osgDB::ReaderWriter::Options *, options, - Properties::VIRTUAL, - __ReaderWriter_ReadResult__readNode__C5_std_string_R1__C5_ReaderWriter_Options_P1, - "", - ""); - I_Method2(osgDB::ReaderWriter::ReadResult, readShader, IN, const std::string &, filename, IN, const osgDB::ReaderWriter::Options *, options, - Properties::VIRTUAL, - __ReaderWriter_ReadResult__readShader__C5_std_string_R1__C5_ReaderWriter_Options_P1, - "", - ""); -END_REFLECTOR - BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgDB::Registry::ReadFunctor) I_DeclaringFile("osgDB/Registry"); - I_Constructor2(IN, const std::string &, filename, IN, const osgDB::ReaderWriter::Options *, options, - ____ReadFunctor__C5_std_string_R1__C5_ReaderWriter_Options_P1, + I_Constructor2(IN, const std::string &, filename, IN, const osgDB::Options *, options, + ____ReadFunctor__C5_std_string_R1__C5_Options_P1, "", ""); I_Method1(osgDB::ReaderWriter::ReadResult, doRead, IN, osgDB::ReaderWriter &, rw, @@ -709,39 +716,6 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgDB::Registry::ReadFunctor) I_PublicMemberProperty(std::string, _filename); END_REFLECTOR -BEGIN_OBJECT_REFLECTOR(osgDB::Registry::WriteFileCallback) - I_DeclaringFile("osgDB/Registry"); - I_VirtualBaseType(osg::Referenced); - I_Constructor0(____WriteFileCallback, - "", - ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeObject, IN, const osg::Object &, obj, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, - Properties::VIRTUAL, - __ReaderWriter_WriteResult__writeObject__C5_osg_Object_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, - "", - ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeImage, IN, const osg::Image &, obj, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, - Properties::VIRTUAL, - __ReaderWriter_WriteResult__writeImage__C5_osg_Image_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, - "", - ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeHeightField, IN, const osg::HeightField &, obj, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, - Properties::VIRTUAL, - __ReaderWriter_WriteResult__writeHeightField__C5_osg_HeightField_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, - "", - ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeNode, IN, const osg::Node &, obj, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, - Properties::VIRTUAL, - __ReaderWriter_WriteResult__writeNode__C5_osg_Node_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, - "", - ""); - I_Method3(osgDB::ReaderWriter::WriteResult, writeShader, IN, const osg::Shader &, obj, IN, const std::string &, fileName, IN, const osgDB::ReaderWriter::Options *, options, - Properties::VIRTUAL, - __ReaderWriter_WriteResult__writeShader__C5_osg_Shader_R1__C5_std_string_R1__C5_ReaderWriter_Options_P1, - "", - ""); -END_REFLECTOR - BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgDB::ReaderWriter >) I_DeclaringFile("osg/ref_ptr"); I_Constructor0(____ref_ptr,