#include #include #include #include #include #include #include #include #include #include #include #include #if defined(_WIN32) && !defined(__CYGWIN__) #include #else #include #endif using namespace osg; class ReaderWriterTGZ : public osgDB::ReaderWriter { public: virtual const char* className() const { return "TGZ Database Reader/Writer"; } virtual bool acceptsExtension(const std::string& extension) const { return osgDB::equalCaseInsensitive(extension,"tgz"); } virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(file); if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; osg::notify(osg::NOTICE)<<"file="< local_options = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new osgDB::ReaderWriter::Options; local_options->getDatabasePathList().push_front(dirname); osg::notify(osg::NOTICE)<<"local_options->getDatabasePathList().="<getDatabasePathList().front()<addChild( node ); } } // restorre original state of the automatic generation of images to geode's. osgDB::Registry::instance()->setCreateNodeFromImage(prevCreateNodeFromImage); #if defined(_WIN32) && !defined(__CYGWIN__) sprintf( command, "erase /F /Q /S \"%s\"", dirname ); #else sprintf( command, "rm -rf %s", dirname ); #endif osg::notify(osg::NOTICE)<<"Running command '"<getNumChildren() == 0 ) { grp->unref(); return ReadResult::FILE_NOT_HANDLED; } return grp; } }; // now register with sgRegistry to instantiate the above // reader/writer. osgDB::RegisterReaderWriterProxy g_readerWriter_TGZ_Proxy;