Hi Brett, A number of the plugins support reading a writing from istream/ostream which means you can implement your std::streambuffer and attach to the stream and then pass this to the plugin. This technique allows you to do items like compression/decompression/encription/decription. Have a look at the osga and curl plugins as they provide examples of using streams this way.
Robert. On Wed, Oct 1, 2008 at 5:02 PM, brettwiesner <[EMAIL PROTECTED]> wrote: > Hi, > > I've got a requirement to ship certain 3rd party model data only in an > encrypted format. So I wrote my own loader that does the encryption/ > decryption but uses the IVE loader for everything. This works except for > files that reference other files. The master file is encrypted, but the > referenced files are saved out as .ive's. > > Ideally all I would have to do is subclass ReaderWriterIVE and override the > following stream methods: > > virtual osgDB::ReaderWriter::ReadResult readObject(std::istream& fin, > const osgDB::ReaderWriter::Options* options) const; > > virtual osgDB::ReaderWriter::ReadResult readImage(std::istream& fin, > const osgDB::ReaderWriter::Options* options) const; > > virtual osgDB::ReaderWriter::ReadResult readNode(std::istream& fin, > const osgDB::ReaderWriter::Options* options) const; > > virtual osgDB::ReaderWriter::WriteResult writeObject(const osg::Object& > object, > std::ostream& fout, const osgDB::ReaderWriter::Options* options) const; > > virtual osgDB::ReaderWriter::WriteResult writeImage(const osg::Image& > image, > std::ostream& fout, const osgDB::ReaderWriter::Options* options) const; > > virtual osgDB::ReaderWriter::WriteResult writeNode(const osg::Node& node, > std::ostream& fout, const osgDB::ReaderWriter::Options* options) const; > > For writing I could get the raw data from the ive loader encrypt it and > write it out. For reading I could decrypt the data, then pass the > unencrypted data up to the ive loader for use. > > There is one fatal flaw... I can't subclass the ReaderWriterIVE plugin. :( > > 1) Has anyone besides me ever wanted to derive from a file loader? Would it > make sense to keep the logic in a lib with headers, then have another > library that is just the plugin? > > 2) Is there some other mechanism in OSG that will let me do this? > > Thanks, > Brett > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

