Improvements to support for archives
This commit is contained in:
@@ -34,9 +34,25 @@ public:
|
||||
return archive.get();
|
||||
}
|
||||
|
||||
virtual ReadResult readObject(const std::string& /*fileName*/,const Options* =NULL) { return ReadResult(ReadResult::FILE_NOT_HANDLED); }
|
||||
virtual ReadResult readImage(const std::string& /*fileName*/,const Options* =NULL) { return ReadResult(ReadResult::FILE_NOT_HANDLED); }
|
||||
virtual ReadResult readHeightField(const std::string& /*fileName*/,const Options* =NULL) { return ReadResult(ReadResult::FILE_NOT_HANDLED); }
|
||||
virtual ReadResult readImage(const std::string& file,const Options* options)
|
||||
{
|
||||
ReadResult result = openArchive(file,osgDB::Archive::READ);
|
||||
|
||||
if (!result.validArchive()) return result;
|
||||
|
||||
|
||||
osg::ref_ptr<ReaderWriter::Options> local_options = new ReaderWriter::Options;
|
||||
local_options->setDatabasePath(file);
|
||||
|
||||
ReadResult result_2 = result.getArchive()->readImage(result.getArchive()->getMasterFileName(),local_options.get());
|
||||
|
||||
|
||||
// register the archive so that it is cached for future use.
|
||||
osgDB::Registry::instance()->addToArchiveCache(file, result.getArchive());
|
||||
|
||||
|
||||
return result_2;
|
||||
}
|
||||
|
||||
virtual ReadResult readNode(const std::string& file,const Options* options)
|
||||
{
|
||||
@@ -58,11 +74,6 @@ public:
|
||||
return result_2;
|
||||
}
|
||||
|
||||
virtual WriteResult writeObject(const osg::Object& /*obj*/,const std::string& /*fileName*/,const Options* =NULL) {return WriteResult(WriteResult::FILE_NOT_HANDLED); }
|
||||
virtual WriteResult writeImage(const osg::Image& /*image*/,const std::string& /*fileName*/,const Options* =NULL) {return WriteResult(WriteResult::FILE_NOT_HANDLED); }
|
||||
virtual WriteResult writeHeightField(const osg::HeightField& /*heightField*/,const std::string& /*fileName*/,const Options* =NULL) {return WriteResult(WriteResult::FILE_NOT_HANDLED); }
|
||||
virtual WriteResult writeNode(const osg::Node& /*node*/,const std::string& /*fileName*/,const Options* =NULL) { return WriteResult(WriteResult::FILE_NOT_HANDLED); }
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user