From 56bc0b14bc76696b084ba9c75b817603db3dd63d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 22 Nov 2012 09:49:24 +0000 Subject: [PATCH] Added explict handling of osg::Image, osg::HeightField, osg::Shader and osg::Node when doing writes to the archive. --- applications/osgarchive/osgarchive.cpp | 10 +++++++++- src/osgPlugins/osga/OSGA_Archive.cpp | 12 ++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/applications/osgarchive/osgarchive.cpp b/applications/osgarchive/osgarchive.cpp index 64b51057c..f3388524e 100644 --- a/applications/osgarchive/osgarchive.cpp +++ b/applications/osgarchive/osgarchive.cpp @@ -139,7 +139,15 @@ int main( int argc, char **argv ) if (obj.valid()) { std::cout<<" write to archive "<<*itr<writeObject(*obj, *itr); + osg::Image* image = dynamic_cast(obj.get()); + osg::HeightField* hf = dynamic_cast(obj.get()); + osg::Node* node = dynamic_cast(obj.get()); + osg::Shader* shader = dynamic_cast(obj.get()); + if (image) archive->writeImage(*image, *itr); + else if (hf) archive->writeHeightField(*hf, *itr); + else if (node) archive->writeNode(*node, *itr); + else if (shader) archive->writeShader(*shader, *itr); + else archive->writeObject(*obj, *itr); } } } diff --git a/src/osgPlugins/osga/OSGA_Archive.cpp b/src/osgPlugins/osga/OSGA_Archive.cpp index 09b384ad6..4a41b244d 100644 --- a/src/osgPlugins/osga/OSGA_Archive.cpp +++ b/src/osgPlugins/osga/OSGA_Archive.cpp @@ -753,7 +753,7 @@ struct OSGA_Archive::WriteImageFunctor : public OSGA_Archive::WriteFunctor _object(object) {} const osg::Image& _object; - virtual ReaderWriter::WriteResult doWrite(ReaderWriter& rw, std::ostream& output) const { return rw.writeImage(_object, output, _options); } + virtual ReaderWriter::WriteResult doWrite(ReaderWriter& rw, std::ostream& output) const { OSG_NOTICE<<"doWrite() rw.writeImage(), "<