Merge pull request #760 from LaurensVoerman/readObject

implement readObject for all relevant readerWriters
This commit is contained in:
OpenSceneGraph git repository 2019-06-14 15:28:46 +01:00 committed by GitHub
commit 21c0affe66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 284 additions and 40 deletions

View File

@ -92,6 +92,11 @@ class ReaderWriter3DC : public osgDB::ReaderWriter
virtual const char* className() const { return "3DC point cloud reader"; } 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 virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const
{ {
std::string ext = osgDB::getLowerCaseFileExtension(file); std::string ext = osgDB::getLowerCaseFileExtension(file);

View File

@ -171,7 +171,18 @@ public:
virtual const char* className() const { return "3DS Auto Studio Reader/Writer"; } 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 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 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. virtual ReadResult doReadNode(std::istream& fin, const Options* options, const std::string & fileNamelib3ds) const; ///< Subfunction of readNode()s functions.

View File

@ -19,8 +19,19 @@ class ReaderWriterIV : public osgDB::ReaderWriter
return osgDB::equalCaseInsensitive(extension, "iv") ? true : false; 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, virtual ReadResult readNode(const std::string& filename,
const osgDB::ReaderWriter::Options*) const; 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, virtual ReadResult readNode(std::istream& fin,
const osgDB::ReaderWriter::Options* = NULL) const; const osgDB::ReaderWriter::Options* = NULL) const;

View File

@ -78,7 +78,10 @@ class ReaderWriterAC : public osgDB::ReaderWriter
} }
virtual const char* className() const { return "AC3D Database Reader"; } 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 virtual ReadResult readNode(const std::string& file,const Options* options) const
{ {
std::string ext = osgDB::getFileExtension(file); std::string ext = osgDB::getFileExtension(file);
@ -110,6 +113,10 @@ class ReaderWriterAC : public osgDB::ReaderWriter
result.getNode()->setName(fileName); result.getNode()->setName(fileName);
return result; 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 virtual ReadResult readNode(std::istream& fin, const Options* options) const
{ {
std::string header; std::string header;

View File

@ -18,6 +18,11 @@ public:
virtual bool acceptsExtension(const std::string& extension) const; 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, virtual ReadResult readNode(const std::string& file,
const Options* options) const; const Options* options) const;
}; };

View File

@ -365,12 +365,22 @@ public:
virtual const char* className() const virtual const char* className() const
{ return "BVH Motion Reader"; } { 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 virtual ReadResult readNode(std::istream& stream, const osgDB::ReaderWriter::Options* options) const
{ {
ReadResult rr = BvhMotionBuilder::instance()->buildBVH( stream, options ); ReadResult rr = BvhMotionBuilder::instance()->buildBVH( stream, options );
return rr; 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 virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const
{ {
std::string ext = osgDB::getLowerCaseFileExtension( file ); std::string ext = osgDB::getLowerCaseFileExtension( file );

View File

@ -40,7 +40,18 @@ public:
const char* className() const { return "COLLADA 1.4.x DAE reader/writer"; } 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; 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; ReadResult readNode(const std::string&, const Options* = NULL) const;
WriteResult writeNode(const osg::Node&, const std::string&, const Options* = NULL) const; WriteResult writeNode(const osg::Node&, const std::string&, const Options* = NULL) const;

View File

@ -44,6 +44,11 @@ public:
return "ReaderWriterDirectShow"; 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 virtual ReadResult readImage(const std::string & filename, const osgDB::ReaderWriter::Options * options) const
{ {
const std::string ext = osgDB::getLowerCaseFileExtension(filename); const std::string ext = osgDB::getLowerCaseFileExtension(filename);

View File

@ -40,6 +40,11 @@ public:
virtual const char* className() const { return "Autodesk DXF Reader/Writer"; } 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; virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options*) const;

View File

@ -132,6 +132,11 @@ public:
return "ReaderWriterFFmpeg"; 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 virtual ReadResult readImage(const std::string & filename, const osgDB::ReaderWriter::Options* options) const
{ {
const std::string ext = osgDB::getLowerCaseFileExtension(filename); const std::string ext = osgDB::getLowerCaseFileExtension(filename);

View File

@ -129,6 +129,10 @@ public:
return model.release(); 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 virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
{ {

View File

@ -52,6 +52,11 @@ public:
return "ReaderWriterGStreamer"; 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 virtual ReadResult readImage(const std::string & filename, const osgDB::ReaderWriter::Options* options) const
{ {
const std::string ext = osgDB::getLowerCaseFileExtension(filename); const std::string ext = osgDB::getLowerCaseFileExtension(filename);

View File

@ -69,6 +69,11 @@ public:
virtual const char* className() const { return "HDR Image Reader"; } 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 virtual ReadResult readImage(const std::string &_file, const osgDB::ReaderWriter::Options *_opts) const
{ {
std::string filepath = osgDB::findDataFile(_file, _opts); std::string filepath = osgDB::findDataFile(_file, _opts);

View File

@ -43,7 +43,18 @@ public:
ReaderWriterKTX(); ReaderWriterKTX();
virtual const char* className() const; 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 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 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; virtual WriteResult writeObject(const osg::Object& object, const std::string& file, const osgDB::ReaderWriter::Options* options) const;

View File

@ -34,6 +34,11 @@ class ReaderWriterLAS : public osgDB::ReaderWriter
virtual const char* className() const { return "LAS point cloud reader"; } 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 virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const
{ {
std::string ext = osgDB::getLowerCaseFileExtension(file); std::string ext = osgDB::getLowerCaseFileExtension(file);
@ -51,6 +56,11 @@ class ReaderWriterLAS : public osgDB::ReaderWriter
return readNode(ifs, options); return readNode(ifs, options);
} }
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 { virtual ReadResult readNode(std::istream& ifs, const Options* options) const {
// Reading options // Reading options
bool _verbose = false; bool _verbose = false;

View File

@ -231,6 +231,11 @@ class LOGOReaderWriter : public osgDB::ReaderWriter
virtual const char* className() const { return "Logo Database Reader/Writer"; } 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 virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const
{ {
std::string ext = osgDB::getLowerCaseFileExtension(file); std::string ext = osgDB::getLowerCaseFileExtension(file);

View File

@ -53,6 +53,11 @@ public:
return "Quake MD2 Reader"; 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; virtual ReadResult readNode (const std::string& filename, const osgDB::ReaderWriter::Options* options) const;
}; };

View File

@ -17,6 +17,11 @@ public:
virtual bool acceptsExtension(const std::string& extension) const; 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, virtual ReadResult readNode(const std::string& file,
const Options* options) const; const Options* options) const;
}; };

View File

@ -50,12 +50,26 @@ public:
return archive.get(); return archive.get();
} }
virtual ReadResult readImage(const std::string& file,const Options* options) const enum ReadType
{
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); ReadResult result = openArchive(file, osgDB::Archive::READ);
if (!result.validArchive()) return result; if (!result.validArchive()) return result;
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());
}
// copy the incoming options if possible so that plugin options can be applied to files // copy the incoming options if possible so that plugin options can be applied to files
// inside the archive // inside the archive
@ -66,44 +80,44 @@ public:
local_options->setDatabasePath(file); local_options->setDatabasePath(file);
ReadResult result_2 = result.getArchive()->readImage(result.getArchive()->getMasterFileName(),local_options.get()); ReadResult result_2;
switch (type) {
default:
if (!options || (options->getObjectCacheHint() & osgDB::ReaderWriter::Options::CACHE_ARCHIVES)) 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
{ {
// register the archive so that it is cached for future use. return readMasterFile(READ_OBJECT, file, options);
osgDB::Registry::instance()->addToArchiveCache(file, result.getArchive());
} }
return result_2; virtual ReadResult readImage(const std::string& file, const Options* options) const
{
return readMasterFile(READ_IMAGE, file, options);
}
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 virtual ReadResult readNode(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;
// copy the incoming options if possible so that plugin options can be applied to files
// inside the archive
osg::ref_ptr<osgDB::ReaderWriter::Options> 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: protected:

View File

@ -76,6 +76,11 @@ public:
virtual const char* className() const { return "OSGJS json Writer"; } 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 ReadResult readNode(const std::string& fileName, const Options* options) const;
virtual WriteResult writeNode(const Node& node, virtual WriteResult writeNode(const Node& node,

View File

@ -34,6 +34,11 @@ class sgReaderWriterOSGTGZ : public osgDB::ReaderWriter
virtual const char* className() const { return "OSGTGZ Database Reader/Writer"; } 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 virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const
{ {
std::string ext = osgDB::getFileExtension(file); std::string ext = osgDB::getFileExtension(file);

View File

@ -163,9 +163,19 @@ public:
osgDB::XmlNode::Properties::const_iterator findProperty(osgDB::XmlNode* cur, const char* token) const; 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, virtual ReadResult readNode(const std::string& fileName,
const osgDB::ReaderWriter::Options* options) const; 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; virtual ReadResult readNode(std::istream& fin, const Options* options) const;
ReadResult readNode(osgDB::XmlNode::Input& input, osgDB::ReaderWriter::Options* options) const; ReadResult readNode(osgDB::XmlNode::Input& input, osgDB::ReaderWriter::Options* options) const;

View File

@ -45,6 +45,12 @@ public:
} }
virtual const char* className() const { return "ReaderWriterPLY"; } 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; virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options*) const;
protected: protected:
}; };

View File

@ -226,6 +226,11 @@ class ReaderWriterPNM : public osgDB::ReaderWriter
virtual const char* className() const { return "PNM Image Reader/Writer"; } 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 virtual ReadResult readImage(std::istream& fin, const osgDB::ReaderWriter::Options* options=NULL) const
{ {
int ppmtype = 0; /* P1, P2, etc. */ int ppmtype = 0; /* P1, P2, etc. */
@ -375,6 +380,11 @@ class ReaderWriterPNM : public osgDB::ReaderWriter
return pOsgImage; 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 virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const
{ {
std::string ext = osgDB::getLowerCaseFileExtension(file); std::string ext = osgDB::getLowerCaseFileExtension(file);

View File

@ -209,6 +209,11 @@ public:
acceptsLiveExtension(extension); 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 virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const
{ {
std::string ext = osgDB::getLowerCaseFileExtension(file); std::string ext = osgDB::getLowerCaseFileExtension(file);
@ -364,6 +369,11 @@ public:
return image.release(); 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 virtual ReadResult readImage (std::istream& is, const osgDB::ReaderWriter::Options* options=NULL) const
{ {
std::string filename = ""; std::string filename = "";

View File

@ -100,6 +100,11 @@ public:
virtual const char* className() const { return "rotation pseudo-loader"; } 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 virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
{ {
std::string ext = osgDB::getLowerCaseFileExtension(fileName); std::string ext = osgDB::getLowerCaseFileExtension(fileName);

View File

@ -108,6 +108,11 @@ public:
return osgDB::equalCaseInsensitive( extension, EXTENSION_NAME ); 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 virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
{ {
std::string ext = osgDB::getLowerCaseFileExtension(fileName); std::string ext = osgDB::getLowerCaseFileExtension(fileName);

View File

@ -80,6 +80,11 @@ public:
virtual const char* className() const { return "osgShadow pseudo-loader"; } 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 virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
{ {
std::string ext = osgDB::getLowerCaseFileExtension(fileName); std::string ext = osgDB::getLowerCaseFileExtension(fileName);

View File

@ -110,6 +110,11 @@ public:
return "STL Reader"; 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 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; virtual WriteResult writeNode(const osg::Node& node, const std::string& fileName, const Options* = NULL) const;

View File

@ -25,6 +25,11 @@ class ReaderWriterTerrain : public osgDB::ReaderWriter
virtual const char* className() const { return "Terrain 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 virtual osgDB::ReaderWriter::ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* opt) const
{ {
std::string ext = osgDB::getLowerCaseFileExtension(file); std::string ext = osgDB::getLowerCaseFileExtension(file);

View File

@ -33,6 +33,11 @@ class ReaderWriterTGZ : public osgDB::ReaderWriter
supportsExtension("tgz","Tar gzip'd archive format"); 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 virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const
{ {
std::string ext = osgDB::getLowerCaseFileExtension(file); std::string ext = osgDB::getLowerCaseFileExtension(file);

View File

@ -101,6 +101,11 @@ public:
virtual const char* className() const { return "translation pseudo-loader"; } 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 virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
{ {
std::string ext = osgDB::getLowerCaseFileExtension(fileName); std::string ext = osgDB::getLowerCaseFileExtension(fileName);

View File

@ -85,6 +85,10 @@ public:
virtual const char* className() const { return "VRML2 Reader/Writer"; } 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(const std::string&, const osgDB::Options *options) const;
// virtual ReadResult readNode(std::istream& fin, const osgDB::Options* options) const; // virtual ReadResult readNode(std::istream& fin, const osgDB::Options* options) const;

View File

@ -61,7 +61,18 @@ public:
return "DirectX Reader"; 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 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; virtual ReadResult readNode(std::istream& fin, const osgDB::ReaderWriter::Options* options) const;
private: private:

View File

@ -106,6 +106,10 @@ class ReaderWriterZIP : public osgDB::ReaderWriter
return result; 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 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()); 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 virtual ReadResult readNode(std::istream& fin,const osgDB::ReaderWriter::Options* options) const
{ {
osgDB::ReaderWriter::ReadResult result = openArchive(fin, options); osgDB::ReaderWriter::ReadResult result = openArchive(fin, options);