From 38727ed4b406d739f2fa639ab8cb344b6f3e7049 Mon Sep 17 00:00:00 2001 From: Laurens Voerman Date: Tue, 14 May 2019 14:25:30 +0200 Subject: [PATCH] implement readObject for all relevant readerWriters --- src/osgPlugins/3dc/ReaderWriter3DC.cpp | 5 ++ src/osgPlugins/3ds/ReaderWriter3DS.cpp | 11 +++ src/osgPlugins/Inventor/ReaderWriterIV.h | 11 +++ src/osgPlugins/ac/ac3d.cpp | 9 +- src/osgPlugins/bsp/ReaderWriterBSP.h | 5 ++ src/osgPlugins/bvh/ReaderWriterBVH.cpp | 10 +++ src/osgPlugins/dae/ReaderWriterDAE.h | 11 +++ .../directshow/ReaderWriterDirectShow.cpp | 5 ++ src/osgPlugins/dxf/ReaderWriterDXF.cpp | 5 ++ src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp | 5 ++ src/osgPlugins/gles/ReaderWriterGLES.cpp | 4 + .../gstreamer/ReaderWriterGStreamer.cpp | 5 ++ src/osgPlugins/hdr/ReaderWriterHDR.cpp | 5 ++ src/osgPlugins/ktx/ReaderWriterKTX.h | 11 +++ src/osgPlugins/las/ReaderWriterLAS.cpp | 12 ++- src/osgPlugins/logo/ReaderWriterLOGO.cpp | 5 ++ src/osgPlugins/md2/ReaderWriterMD2.cpp | 5 ++ src/osgPlugins/mdl/ReaderWriterMDL.h | 5 ++ src/osgPlugins/osga/ReaderWriterOSGA.cpp | 90 +++++++++++-------- src/osgPlugins/osgjs/ReaderWriterJSON.cpp | 5 ++ src/osgPlugins/osgtgz/ReaderWriterOSGTGZ.cpp | 5 ++ src/osgPlugins/p3d/ReaderWriterP3D.cpp | 10 +++ src/osgPlugins/ply/ReaderWriterPLY.cpp | 6 ++ src/osgPlugins/pnm/ReaderWriterPNM.cpp | 10 +++ src/osgPlugins/quicktime/ReaderWriterQT.cpp | 10 +++ src/osgPlugins/rot/ReaderWriterROT.cpp | 5 ++ src/osgPlugins/scale/ReaderWriterSCALE.cpp | 5 ++ .../shadow/ReaderWriterOsgShadow.cpp | 5 ++ src/osgPlugins/stl/ReaderWriterSTL.cpp | 5 ++ .../terrain/ReaderWriterOsgTerrain.cpp | 5 ++ src/osgPlugins/tgz/ReaderWriterTGZ.cpp | 5 ++ src/osgPlugins/trans/ReaderWriterTRANS.cpp | 5 ++ src/osgPlugins/vrml/ReaderWriterVRML2.h | 4 + src/osgPlugins/x/ReaderWriterDirectX.cpp | 11 +++ src/osgPlugins/zip/ReaderWriterZIP.cpp | 9 ++ 35 files changed, 284 insertions(+), 40 deletions(-) diff --git a/src/osgPlugins/3dc/ReaderWriter3DC.cpp b/src/osgPlugins/3dc/ReaderWriter3DC.cpp index d9cb3b567..f15a9e3f4 100644 --- a/src/osgPlugins/3dc/ReaderWriter3DC.cpp +++ b/src/osgPlugins/3dc/ReaderWriter3DC.cpp @@ -92,6 +92,11 @@ class ReaderWriter3DC : public osgDB::ReaderWriter virtual const char* className() const { return "3DC point cloud reader"; } + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } + virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(file); diff --git a/src/osgPlugins/3ds/ReaderWriter3DS.cpp b/src/osgPlugins/3ds/ReaderWriter3DS.cpp index e13f3022e..b76db0f32 100644 --- a/src/osgPlugins/3ds/ReaderWriter3DS.cpp +++ b/src/osgPlugins/3ds/ReaderWriter3DS.cpp @@ -171,7 +171,18 @@ public: virtual const char* className() const { return "3DS Auto Studio Reader/Writer"; } + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } + virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const; + virtual ReadResult readObject(std::istream& fin, const Options* options) const + { + return readNode(fin, options); + } + + virtual ReadResult readNode(std::istream& fin, const Options* options) const; virtual ReadResult doReadNode(std::istream& fin, const Options* options, const std::string & fileNamelib3ds) const; ///< Subfunction of readNode()s functions. diff --git a/src/osgPlugins/Inventor/ReaderWriterIV.h b/src/osgPlugins/Inventor/ReaderWriterIV.h index 7b3b10d16..5f5a3bfd6 100644 --- a/src/osgPlugins/Inventor/ReaderWriterIV.h +++ b/src/osgPlugins/Inventor/ReaderWriterIV.h @@ -19,8 +19,19 @@ class ReaderWriterIV : public osgDB::ReaderWriter return osgDB::equalCaseInsensitive(extension, "iv") ? true : false; } + virtual ReadResult readObject(const std::string& filename, const osgDB::ReaderWriter::Options* options) const + { + return readNode(filename, options); + } + virtual ReadResult readNode(const std::string& filename, const osgDB::ReaderWriter::Options*) const; + + virtual ReadResult readObject(std::istream& fin, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fin, options); + } + virtual ReadResult readNode(std::istream& fin, const osgDB::ReaderWriter::Options* = NULL) const; diff --git a/src/osgPlugins/ac/ac3d.cpp b/src/osgPlugins/ac/ac3d.cpp index 612e90cbd..d4f7535b1 100644 --- a/src/osgPlugins/ac/ac3d.cpp +++ b/src/osgPlugins/ac/ac3d.cpp @@ -78,7 +78,10 @@ class ReaderWriterAC : public osgDB::ReaderWriter } virtual const char* className() const { return "AC3D Database Reader"; } - + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } virtual ReadResult readNode(const std::string& file,const Options* options) const { std::string ext = osgDB::getFileExtension(file); @@ -110,6 +113,10 @@ class ReaderWriterAC : public osgDB::ReaderWriter result.getNode()->setName(fileName); return result; } + virtual ReadResult readObject(std::istream& fin, const Options* options) const + { + return readNode(fin, options); + } virtual ReadResult readNode(std::istream& fin, const Options* options) const { std::string header; diff --git a/src/osgPlugins/bsp/ReaderWriterBSP.h b/src/osgPlugins/bsp/ReaderWriterBSP.h index f203d4080..58b7a844b 100644 --- a/src/osgPlugins/bsp/ReaderWriterBSP.h +++ b/src/osgPlugins/bsp/ReaderWriterBSP.h @@ -18,6 +18,11 @@ public: virtual bool acceptsExtension(const std::string& extension) const; + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } + virtual ReadResult readNode(const std::string& file, const Options* options) const; }; diff --git a/src/osgPlugins/bvh/ReaderWriterBVH.cpp b/src/osgPlugins/bvh/ReaderWriterBVH.cpp index 4a425fce2..92329a03c 100644 --- a/src/osgPlugins/bvh/ReaderWriterBVH.cpp +++ b/src/osgPlugins/bvh/ReaderWriterBVH.cpp @@ -365,12 +365,22 @@ public: virtual const char* className() const { return "BVH Motion Reader"; } + virtual ReadResult readObject(std::istream& stream, const osgDB::ReaderWriter::Options* options) const + { + return readNode(stream, options); + } + virtual ReadResult readNode(std::istream& stream, const osgDB::ReaderWriter::Options* options) const { ReadResult rr = BvhMotionBuilder::instance()->buildBVH( stream, options ); return rr; } + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } + virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension( file ); diff --git a/src/osgPlugins/dae/ReaderWriterDAE.h b/src/osgPlugins/dae/ReaderWriterDAE.h index 2bea1bcf2..8ffcd36ce 100644 --- a/src/osgPlugins/dae/ReaderWriterDAE.h +++ b/src/osgPlugins/dae/ReaderWriterDAE.h @@ -40,7 +40,18 @@ public: const char* className() const { return "COLLADA 1.4.x DAE reader/writer"; } + virtual ReadResult readObject(std::istream& fin, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fin, options); + } + ReadResult readNode(std::istream&, const Options* = NULL) const; + + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } + ReadResult readNode(const std::string&, const Options* = NULL) const; WriteResult writeNode(const osg::Node&, const std::string&, const Options* = NULL) const; diff --git a/src/osgPlugins/directshow/ReaderWriterDirectShow.cpp b/src/osgPlugins/directshow/ReaderWriterDirectShow.cpp index f3c65e745..b1c57c335 100644 --- a/src/osgPlugins/directshow/ReaderWriterDirectShow.cpp +++ b/src/osgPlugins/directshow/ReaderWriterDirectShow.cpp @@ -43,6 +43,11 @@ public: { return "ReaderWriterDirectShow"; } + + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options) const + { + return readImage(file, options); + } virtual ReadResult readImage(const std::string & filename, const osgDB::ReaderWriter::Options * options) const { diff --git a/src/osgPlugins/dxf/ReaderWriterDXF.cpp b/src/osgPlugins/dxf/ReaderWriterDXF.cpp index e15a55f5d..a552c754d 100644 --- a/src/osgPlugins/dxf/ReaderWriterDXF.cpp +++ b/src/osgPlugins/dxf/ReaderWriterDXF.cpp @@ -40,6 +40,11 @@ public: virtual const char* className() const { return "Autodesk DXF Reader/Writer"; } + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } + virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options*) const; diff --git a/src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp b/src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp index 2d52bff23..068771a70 100644 --- a/src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp +++ b/src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp @@ -132,6 +132,11 @@ public: return "ReaderWriterFFmpeg"; } + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(file, options); + } + virtual ReadResult readImage(const std::string & filename, const osgDB::ReaderWriter::Options* options) const { const std::string ext = osgDB::getLowerCaseFileExtension(filename); diff --git a/src/osgPlugins/gles/ReaderWriterGLES.cpp b/src/osgPlugins/gles/ReaderWriterGLES.cpp index 363ca42a9..a15d8564e 100644 --- a/src/osgPlugins/gles/ReaderWriterGLES.cpp +++ b/src/osgPlugins/gles/ReaderWriterGLES.cpp @@ -129,6 +129,10 @@ public: return model.release(); } + virtual ReadResult readObject(const std::string& filename, const osgDB::ReaderWriter::Options* options) const + { + return readNode(filename, options); + } virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { diff --git a/src/osgPlugins/gstreamer/ReaderWriterGStreamer.cpp b/src/osgPlugins/gstreamer/ReaderWriterGStreamer.cpp index 7983b7499..56f52c1ba 100644 --- a/src/osgPlugins/gstreamer/ReaderWriterGStreamer.cpp +++ b/src/osgPlugins/gstreamer/ReaderWriterGStreamer.cpp @@ -52,6 +52,11 @@ public: return "ReaderWriterGStreamer"; } + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options) const + { + return readImage(file, options); + } + virtual ReadResult readImage(const std::string & filename, const osgDB::ReaderWriter::Options* options) const { const std::string ext = osgDB::getLowerCaseFileExtension(filename); diff --git a/src/osgPlugins/hdr/ReaderWriterHDR.cpp b/src/osgPlugins/hdr/ReaderWriterHDR.cpp index ae0238ebb..490e8e627 100644 --- a/src/osgPlugins/hdr/ReaderWriterHDR.cpp +++ b/src/osgPlugins/hdr/ReaderWriterHDR.cpp @@ -69,6 +69,11 @@ public: virtual const char* className() const { return "HDR Image Reader"; } + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options) const + { + return readImage(file, options); + } + virtual ReadResult readImage(const std::string &_file, const osgDB::ReaderWriter::Options *_opts) const { std::string filepath = osgDB::findDataFile(_file, _opts); diff --git a/src/osgPlugins/ktx/ReaderWriterKTX.h b/src/osgPlugins/ktx/ReaderWriterKTX.h index d640344a2..56459d709 100644 --- a/src/osgPlugins/ktx/ReaderWriterKTX.h +++ b/src/osgPlugins/ktx/ReaderWriterKTX.h @@ -43,7 +43,18 @@ public: ReaderWriterKTX(); virtual const char* className() const; + + virtual ReadResult readObject(std::istream& fin, const osgDB::ReaderWriter::Options* options) const + { + return readImage(fin, options); + } + virtual ReadResult readImage(std::istream& fin,const osgDB::ReaderWriter::Options* =NULL) const; + + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options) const + { + return readImage(file, options); + } virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const; virtual WriteResult writeObject(const osg::Object& object, const std::string& file, const osgDB::ReaderWriter::Options* options) const; diff --git a/src/osgPlugins/las/ReaderWriterLAS.cpp b/src/osgPlugins/las/ReaderWriterLAS.cpp index f5ab0e37d..547d546aa 100644 --- a/src/osgPlugins/las/ReaderWriterLAS.cpp +++ b/src/osgPlugins/las/ReaderWriterLAS.cpp @@ -34,6 +34,11 @@ class ReaderWriterLAS : public osgDB::ReaderWriter virtual const char* className() const { return "LAS point cloud reader"; } + virtual ReadResult readObject(const std::string& filename, const osgDB::ReaderWriter::Options* options) const + { + return readNode(filename, options); + } + virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(file); @@ -51,7 +56,12 @@ class ReaderWriterLAS : public osgDB::ReaderWriter return readNode(ifs, options); } - virtual ReadResult readNode(std::istream& ifs, const Options* options) const { + virtual ReadResult readObject(std::istream& fin, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fin, options); + } + + virtual ReadResult readNode(std::istream& ifs, const Options* options) const { // Reading options bool _verbose = false; bool _scale = true; diff --git a/src/osgPlugins/logo/ReaderWriterLOGO.cpp b/src/osgPlugins/logo/ReaderWriterLOGO.cpp index 0c6951634..fd168570f 100644 --- a/src/osgPlugins/logo/ReaderWriterLOGO.cpp +++ b/src/osgPlugins/logo/ReaderWriterLOGO.cpp @@ -231,6 +231,11 @@ class LOGOReaderWriter : public osgDB::ReaderWriter virtual const char* className() const { return "Logo Database Reader/Writer"; } + virtual ReadResult readObject(const std::string& filename, const osgDB::ReaderWriter::Options* options) const + { + return readNode(filename, options); + } + virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(file); diff --git a/src/osgPlugins/md2/ReaderWriterMD2.cpp b/src/osgPlugins/md2/ReaderWriterMD2.cpp index 7d4f4fb2d..d5c918d40 100644 --- a/src/osgPlugins/md2/ReaderWriterMD2.cpp +++ b/src/osgPlugins/md2/ReaderWriterMD2.cpp @@ -53,6 +53,11 @@ public: return "Quake MD2 Reader"; } + virtual ReadResult readObject(const std::string& filename, const osgDB::ReaderWriter::Options* options) const + { + return readNode(filename, options); + } + virtual ReadResult readNode (const std::string& filename, const osgDB::ReaderWriter::Options* options) const; }; diff --git a/src/osgPlugins/mdl/ReaderWriterMDL.h b/src/osgPlugins/mdl/ReaderWriterMDL.h index d9e2e29ff..871df382c 100644 --- a/src/osgPlugins/mdl/ReaderWriterMDL.h +++ b/src/osgPlugins/mdl/ReaderWriterMDL.h @@ -17,6 +17,11 @@ public: virtual bool acceptsExtension(const std::string& extension) const; + virtual ReadResult readObject(const std::string& filename, const osgDB::ReaderWriter::Options* options) const + { + return readNode(filename, options); + } + virtual ReadResult readNode(const std::string& file, const Options* options) const; }; diff --git a/src/osgPlugins/osga/ReaderWriterOSGA.cpp b/src/osgPlugins/osga/ReaderWriterOSGA.cpp index a5a705bd5..9f8111ad9 100644 --- a/src/osgPlugins/osga/ReaderWriterOSGA.cpp +++ b/src/osgPlugins/osga/ReaderWriterOSGA.cpp @@ -50,60 +50,74 @@ public: return archive.get(); } - virtual ReadResult readImage(const std::string& file,const Options* options) const + enum ReadType { - ReadResult result = openArchive(file,osgDB::Archive::READ); + READ_OBJECT, + READ_IMAGE, + READ_HEIGHT_FIELD, + READ_NODE, + READ_SHADER + }; + + virtual ReadResult readMasterFile(ReadType type, const std::string& file, const Options* options) const + { + ReadResult result = openArchive(file, osgDB::Archive::READ); if (!result.validArchive()) return result; - - // copy the incoming options if possible so that plugin options can be applied to files - // inside the archive - osg::ref_ptr local_options = - options? - new osgDB::ReaderWriter::Options( *options ) : - new osgDB::ReaderWriter::Options; - - local_options->setDatabasePath(file); - - ReadResult result_2 = result.getArchive()->readImage(result.getArchive()->getMasterFileName(),local_options.get()); - - if (!options || (options->getObjectCacheHint() & osgDB::ReaderWriter::Options::CACHE_ARCHIVES)) { // register the archive so that it is cached for future use. osgDB::Registry::instance()->addToArchiveCache(file, result.getArchive()); } - return result_2; + // copy the incoming options if possible so that plugin options can be applied to files + // inside the archive + osg::ref_ptr local_options = + options ? + new osgDB::ReaderWriter::Options(*options) : + new osgDB::ReaderWriter::Options; + + local_options->setDatabasePath(file); + + ReadResult result_2; + switch (type) { + default: + case READ_OBJECT: + return result.getArchive()->readObject(result.getArchive()->getMasterFileName(), local_options.get()); + case READ_IMAGE: + return result.getArchive()->readImage(result.getArchive()->getMasterFileName(), local_options.get()); + case READ_HEIGHT_FIELD: + return result.getArchive()->readHeightField(result.getArchive()->getMasterFileName(), local_options.get()); + case READ_NODE: + return result.getArchive()->readNode(result.getArchive()->getMasterFileName(), local_options.get()); + case READ_SHADER: + return result.getArchive()->readShader(result.getArchive()->getMasterFileName(), local_options.get()); + } + } + virtual ReadResult readObject(const std::string& file, const Options* options) const + { + return readMasterFile(READ_OBJECT, file, options); } - virtual ReadResult readNode(const std::string& file,const Options* options) const + virtual ReadResult readImage(const std::string& file, const Options* options) const { - ReadResult result = openArchive(file,osgDB::Archive::READ); + return readMasterFile(READ_IMAGE, file, options); + } - if (!result.validArchive()) return result; + virtual ReadResult readHeightField(const std::string& file, const Options* options) const + { + return readMasterFile(READ_HEIGHT_FIELD, file, options); + } + virtual ReadResult readNode(const std::string& file, const Options* options) const + { + return readMasterFile(READ_IMAGE, file, options); + } - // copy the incoming options if possible so that plugin options can be applied to files - // inside the archive - osg::ref_ptr local_options = - options? - new osgDB::ReaderWriter::Options( *options ) : - new osgDB::ReaderWriter::Options; - - local_options->setDatabasePath(file); - - ReadResult result_2 = result.getArchive()->readNode(result.getArchive()->getMasterFileName(),local_options.get()); - - - if (!options || (options->getObjectCacheHint() & osgDB::ReaderWriter::Options::CACHE_ARCHIVES)) - { - // register the archive so that it is cached for future use. - osgDB::Registry::instance()->addToArchiveCache(file, result.getArchive()); - } - - return result_2; + virtual ReadResult readShader(const std::string& file, const Options* options) const + { + return readMasterFile(READ_SHADER, file, options); } protected: diff --git a/src/osgPlugins/osgjs/ReaderWriterJSON.cpp b/src/osgPlugins/osgjs/ReaderWriterJSON.cpp index 7dc464961..20f70f624 100644 --- a/src/osgPlugins/osgjs/ReaderWriterJSON.cpp +++ b/src/osgPlugins/osgjs/ReaderWriterJSON.cpp @@ -76,6 +76,11 @@ public: virtual const char* className() const { return "OSGJS json Writer"; } + virtual ReadResult readObject(const std::string& filename, const osgDB::ReaderWriter::Options* options) const + { + return readNode(filename, options); + } + virtual ReadResult readNode(const std::string& fileName, const Options* options) const; virtual WriteResult writeNode(const Node& node, diff --git a/src/osgPlugins/osgtgz/ReaderWriterOSGTGZ.cpp b/src/osgPlugins/osgtgz/ReaderWriterOSGTGZ.cpp index 8c28fd83e..29857b603 100644 --- a/src/osgPlugins/osgtgz/ReaderWriterOSGTGZ.cpp +++ b/src/osgPlugins/osgtgz/ReaderWriterOSGTGZ.cpp @@ -34,6 +34,11 @@ class sgReaderWriterOSGTGZ : public osgDB::ReaderWriter virtual const char* className() const { return "OSGTGZ Database Reader/Writer"; } + virtual ReadResult readObject(const std::string& filename, const osgDB::ReaderWriter::Options* options) const + { + return readNode(filename, options); + } + virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getFileExtension(file); diff --git a/src/osgPlugins/p3d/ReaderWriterP3D.cpp b/src/osgPlugins/p3d/ReaderWriterP3D.cpp index 1311b548b..2bfae48ce 100644 --- a/src/osgPlugins/p3d/ReaderWriterP3D.cpp +++ b/src/osgPlugins/p3d/ReaderWriterP3D.cpp @@ -163,9 +163,19 @@ public: osgDB::XmlNode::Properties::const_iterator findProperty(osgDB::XmlNode* cur, const char* token) const; + virtual ReadResult readObject(const std::string& filename, const osgDB::ReaderWriter::Options* options) const + { + return readNode(filename, options); + } + virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const; + virtual ReadResult readObject(std::istream& fin, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fin, options); + } + virtual ReadResult readNode(std::istream& fin, const Options* options) const; ReadResult readNode(osgDB::XmlNode::Input& input, osgDB::ReaderWriter::Options* options) const; diff --git a/src/osgPlugins/ply/ReaderWriterPLY.cpp b/src/osgPlugins/ply/ReaderWriterPLY.cpp index 62ab80554..4231bebfb 100644 --- a/src/osgPlugins/ply/ReaderWriterPLY.cpp +++ b/src/osgPlugins/ply/ReaderWriterPLY.cpp @@ -45,6 +45,12 @@ public: } virtual const char* className() const { return "ReaderWriterPLY"; } + + virtual ReadResult readObject(const std::string& filename, const osgDB::ReaderWriter::Options* options) const + { + return readNode(filename, options); + } + virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options*) const; protected: }; diff --git a/src/osgPlugins/pnm/ReaderWriterPNM.cpp b/src/osgPlugins/pnm/ReaderWriterPNM.cpp index 499b745fb..0637326d5 100644 --- a/src/osgPlugins/pnm/ReaderWriterPNM.cpp +++ b/src/osgPlugins/pnm/ReaderWriterPNM.cpp @@ -226,6 +226,11 @@ class ReaderWriterPNM : public osgDB::ReaderWriter virtual const char* className() const { return "PNM Image Reader/Writer"; } + virtual ReadResult readObject(std::istream& fin, const Options* options) const + { + return readImage(fin,options); + } + virtual ReadResult readImage(std::istream& fin, const osgDB::ReaderWriter::Options* options=NULL) const { int ppmtype = 0; /* P1, P2, etc. */ @@ -375,6 +380,11 @@ class ReaderWriterPNM : public osgDB::ReaderWriter return pOsgImage; } + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options) const + { + return readImage(file,options); + } + virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(file); diff --git a/src/osgPlugins/quicktime/ReaderWriterQT.cpp b/src/osgPlugins/quicktime/ReaderWriterQT.cpp index a0846abf9..069148f06 100644 --- a/src/osgPlugins/quicktime/ReaderWriterQT.cpp +++ b/src/osgPlugins/quicktime/ReaderWriterQT.cpp @@ -209,6 +209,11 @@ public: acceptsLiveExtension(extension); } + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options) const + { + return readImage(file,options); + } + virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(file); @@ -364,6 +369,11 @@ public: return image.release(); } + virtual ReadResult readObject(std::istream& fin, const Options* options) const + { + return readImage(fin,options); + } + virtual ReadResult readImage (std::istream& is, const osgDB::ReaderWriter::Options* options=NULL) const { std::string filename = ""; diff --git a/src/osgPlugins/rot/ReaderWriterROT.cpp b/src/osgPlugins/rot/ReaderWriterROT.cpp index cf4d20399..6d2ea6e92 100644 --- a/src/osgPlugins/rot/ReaderWriterROT.cpp +++ b/src/osgPlugins/rot/ReaderWriterROT.cpp @@ -100,6 +100,11 @@ public: virtual const char* className() const { return "rotation pseudo-loader"; } + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } + virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(fileName); diff --git a/src/osgPlugins/scale/ReaderWriterSCALE.cpp b/src/osgPlugins/scale/ReaderWriterSCALE.cpp index 6b4da131d..22f01991f 100644 --- a/src/osgPlugins/scale/ReaderWriterSCALE.cpp +++ b/src/osgPlugins/scale/ReaderWriterSCALE.cpp @@ -108,6 +108,11 @@ public: return osgDB::equalCaseInsensitive( extension, EXTENSION_NAME ); } + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } + virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(fileName); diff --git a/src/osgPlugins/shadow/ReaderWriterOsgShadow.cpp b/src/osgPlugins/shadow/ReaderWriterOsgShadow.cpp index d31934908..767fe5769 100644 --- a/src/osgPlugins/shadow/ReaderWriterOsgShadow.cpp +++ b/src/osgPlugins/shadow/ReaderWriterOsgShadow.cpp @@ -80,6 +80,11 @@ public: virtual const char* className() const { return "osgShadow pseudo-loader"; } + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } + virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(fileName); diff --git a/src/osgPlugins/stl/ReaderWriterSTL.cpp b/src/osgPlugins/stl/ReaderWriterSTL.cpp index 5f8972325..9a749b861 100644 --- a/src/osgPlugins/stl/ReaderWriterSTL.cpp +++ b/src/osgPlugins/stl/ReaderWriterSTL.cpp @@ -110,6 +110,11 @@ public: return "STL Reader"; } + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } + virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options*) const; virtual WriteResult writeNode(const osg::Node& node, const std::string& fileName, const Options* = NULL) const; diff --git a/src/osgPlugins/terrain/ReaderWriterOsgTerrain.cpp b/src/osgPlugins/terrain/ReaderWriterOsgTerrain.cpp index a41799d54..ce7e7056f 100644 --- a/src/osgPlugins/terrain/ReaderWriterOsgTerrain.cpp +++ b/src/osgPlugins/terrain/ReaderWriterOsgTerrain.cpp @@ -25,6 +25,11 @@ class ReaderWriterTerrain : public osgDB::ReaderWriter virtual const char* className() const { return "Terrain ReaderWriter"; } + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } + virtual osgDB::ReaderWriter::ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* opt) const { std::string ext = osgDB::getLowerCaseFileExtension(file); diff --git a/src/osgPlugins/tgz/ReaderWriterTGZ.cpp b/src/osgPlugins/tgz/ReaderWriterTGZ.cpp index 6f1b7f81f..c6fb0ce52 100644 --- a/src/osgPlugins/tgz/ReaderWriterTGZ.cpp +++ b/src/osgPlugins/tgz/ReaderWriterTGZ.cpp @@ -33,6 +33,11 @@ class ReaderWriterTGZ : public osgDB::ReaderWriter supportsExtension("tgz","Tar gzip'd archive format"); } + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } + virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(file); diff --git a/src/osgPlugins/trans/ReaderWriterTRANS.cpp b/src/osgPlugins/trans/ReaderWriterTRANS.cpp index 0195c62b9..34e880b13 100644 --- a/src/osgPlugins/trans/ReaderWriterTRANS.cpp +++ b/src/osgPlugins/trans/ReaderWriterTRANS.cpp @@ -101,6 +101,11 @@ public: virtual const char* className() const { return "translation pseudo-loader"; } + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } + virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(fileName); diff --git a/src/osgPlugins/vrml/ReaderWriterVRML2.h b/src/osgPlugins/vrml/ReaderWriterVRML2.h index 2e996a486..061b7a55d 100644 --- a/src/osgPlugins/vrml/ReaderWriterVRML2.h +++ b/src/osgPlugins/vrml/ReaderWriterVRML2.h @@ -85,6 +85,10 @@ public: virtual const char* className() const { return "VRML2 Reader/Writer"; } + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } virtual ReadResult readNode(const std::string&, const osgDB::Options *options) const; // virtual ReadResult readNode(std::istream& fin, const osgDB::Options* options) const; diff --git a/src/osgPlugins/x/ReaderWriterDirectX.cpp b/src/osgPlugins/x/ReaderWriterDirectX.cpp index 03fe1f4a1..7b902c886 100644 --- a/src/osgPlugins/x/ReaderWriterDirectX.cpp +++ b/src/osgPlugins/x/ReaderWriterDirectX.cpp @@ -61,7 +61,18 @@ public: return "DirectX Reader"; } + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } + virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const; + + virtual ReadResult readObject(std::istream& fin, const Options* options) const + { + return readNode(fin,options); + } + virtual ReadResult readNode(std::istream& fin, const osgDB::ReaderWriter::Options* options) const; private: diff --git a/src/osgPlugins/zip/ReaderWriterZIP.cpp b/src/osgPlugins/zip/ReaderWriterZIP.cpp index d49c20d2e..8b044274e 100644 --- a/src/osgPlugins/zip/ReaderWriterZIP.cpp +++ b/src/osgPlugins/zip/ReaderWriterZIP.cpp @@ -106,6 +106,10 @@ class ReaderWriterZIP : public osgDB::ReaderWriter return result; } + virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const + { + return readNode(fileName, options); + } virtual osgDB::ReaderWriter::ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const { @@ -132,6 +136,11 @@ class ReaderWriterZIP : public osgDB::ReaderWriter return readNodeFromArchive(*archive, local_options.get()); } + virtual ReadResult readObject(std::istream& fin, const Options* options) const + { + return readNode(fin,options); + } + virtual ReadResult readNode(std::istream& fin,const osgDB::ReaderWriter::Options* options) const { osgDB::ReaderWriter::ReadResult result = openArchive(fin, options);