From Glenn Waldron, "As you may recall, we discussed adding ReaderWriter::readObject() overrides to all the image plugins in order to facilitate future archive support. Attached are the necessary modifications. I tested JPEG, but not all the others... the code is identical though. Note that the DDS plugin already contained the readObject() implementations."

This commit is contained in:
Robert Osfield 2008-02-25 13:25:42 +00:00
parent d003972a5f
commit adbc15b5a1
8 changed files with 75 additions and 0 deletions

View File

@ -354,6 +354,16 @@ class ReaderWriterBMP : public osgDB::ReaderWriter
return pOsgImage; return pOsgImage;
} }
virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const
{
return readImage(fin, options);
}
virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const
{
return readImage(file, options);
}
virtual ReadResult readImage(std::istream& fin,const Options* =NULL) const virtual ReadResult readImage(std::istream& fin,const Options* =NULL) const
{ {
return readBMPStream(fin); return readBMPStream(fin);

View File

@ -375,6 +375,16 @@ class ReaderWriterGIF : public osgDB::ReaderWriter
return pOsgImage; return pOsgImage;
} }
virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const
{
return readImage(fin, options);
}
virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const
{
return readImage(file, 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
{ {
return readGIFStream(fin); return readGIFStream(fin);

View File

@ -784,6 +784,16 @@ class ReaderWriterJPEG : public osgDB::ReaderWriter
return pOsgImage; return pOsgImage;
} }
virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const
{
return readImage(fin, options);
}
virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const
{
return readImage(file, 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
{ {
return readJPGStream(fin); return readJPGStream(fin);

View File

@ -194,6 +194,11 @@ class ReaderWriterPIC : public osgDB::ReaderWriter
virtual const char* className() const { return "PIC Image Reader"; } virtual const char* className() const { return "PIC Image Reader"; }
virtual bool acceptsExtension(const std::string& extension) const { return osgDB::equalCaseInsensitive(extension,"pic"); } virtual bool acceptsExtension(const std::string& extension) const { return osgDB::equalCaseInsensitive(extension,"pic"); }
virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) 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

@ -281,6 +281,16 @@ class ReaderWriterPNG : public osgDB::ReaderWriter
return Z_DEFAULT_COMPRESSION; return Z_DEFAULT_COMPRESSION;
} }
virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const
{
return readImage(fin, options);
}
virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const
{
return readImage(file, options);
}
virtual ReadResult readImage(std::istream& fin,const Options* =NULL) const virtual ReadResult readImage(std::istream& fin,const Options* =NULL) const
{ {
return readPNGStream(fin); return readPNGStream(fin);

View File

@ -497,6 +497,16 @@ class ReaderWriterRGB : public osgDB::ReaderWriter
return image; return image;
} }
virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const
{
return readImage(fin, options);
}
virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const
{
return readImage(file, 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
{ {
return readRGBStream(fin); return readRGBStream(fin);

View File

@ -507,6 +507,16 @@ class ReaderWriterTGA : public osgDB::ReaderWriter
} }
virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const
{
return readImage(fin, options);
}
virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const
{
return readImage(file, options);
}
virtual ReadResult readImage(std::istream& fin,const Options* =NULL) const virtual ReadResult readImage(std::istream& fin,const Options* =NULL) const
{ {
return readTGAStream(fin); return readTGAStream(fin);

View File

@ -751,6 +751,16 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter
return WriteResult::FILE_SAVED; return WriteResult::FILE_SAVED;
} }
virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const
{
return readImage(fin, options);
}
virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const
{
return readImage(file, 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
{ {
return readTIFStream(fin); return readTIFStream(fin);