Re: [osg-users] How do I Subclass a file loader?

2008-10-04 Thread Robert Osfield
Hi Brett, You can override the reading and writing at a high level by doing using a Registry::ReadFileCallback and WriteFileCallback. You could use this to intercept all the the write of .ive and adapt them. Or just disable the change the ProxyNode's filename so that it includes an extension

Re: [osg-users] How do I Subclass a file loader?

2008-10-02 Thread Robert Osfield
Hi Brett, You need to read up about deriving your own custom std::streambuf, once you understand this part then adapting existing plugins to use your encrypted stream will be straightforward. You could even be lazy a use a stringstream like the curl plugin does. Please look into this stuff -

Re: [osg-users] How do I Subclass a file loader?

2008-10-02 Thread brettwiesner
Robert, OK, I'm reading up on basic_streambufchar now. In the meantime, maybe you can help me understand how I can use a derived streambuf with the existing IVE loader. Aren't I going to run into the same problem? When the IVE loader comes across a proxy node, it will write out the node

Re: [osg-users] How do I Subclass a file loader?

2008-10-02 Thread Robert Osfield
HI Brett, Please follow the suggestions already made. The osga plugin already implementents a custom std::streambuf, and the curl plugin uses a stingstream to adapt an external stream into something that the other OSG plugins can use. Robert. On Thu, Oct 2, 2008 at 3:47 PM, brettwiesner [EMAIL

Re: [osg-users] How do I Subclass a file loader?

2008-10-02 Thread brettwiesner
Robert, Maybe some code will help Let's say I write my own ReaderWriter that reads and writes encrypted ive files or eive files. class ReaderWriterEive : public osgDB::ReaderWriter { public virtual bool acceptsExtension(const std::string extension) const { // Accepts eive as an

Re: [osg-users] How do I Subclass a file loader?

2008-10-02 Thread Jean-Sébastien Guay
Hi Brett, I'm wondering, if you suspect that ProxyNodes (and thus PagedLOD nodes as well) would be a problem, why don't you just run a visitor that would find those, and change their extension to eive (or whatever you want)? Then if you write the top-level file, it will write the referenced

Re: [osg-users] How do I Subclass a file loader?

2008-10-02 Thread Jean-Sébastien Guay
Hi Brett, As expected, the visitor goes and changes the names of all the referenced files. Then the top level file is written out. The proxy nodes try to write themselves out but since the files they reference (referencedFile.eive) doesn't exist, nothing is written out. I don't quite know

Re: [osg-users] How do I Subclass a file loader?

2008-10-02 Thread brettwiesner
Hi, I'm going to try one more thing... In my readerWriter, I can unregister the real IVE loader, and register my encrypted ive loader. This way, my loader gets called when a .ive is written out/ read in. I'll actually call the real IVE loader for all read and writes, but the recursive proxy

Re: [osg-users] How do I Subclass a file loader?

2008-10-02 Thread Thrall, Bryan
brettwiesner wrote on Thursday, October 02, 2008 2:22 PM: Jean, I did try my original solution which is how I know it writes out .ive files. I also just implemented the visitor solution to see what happens. As expected, the visitor goes and changes the names of all the referenced files.

[osg-users] How do I Subclass a file loader?

2008-10-01 Thread brettwiesner
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

Re: [osg-users] How do I Subclass a file loader?

2008-10-01 Thread Thrall, Bryan
brettwiesner wrote on Wednesday, October 01, 2008 11:02 AM: 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

Re: [osg-users] How do I Subclass a file loader?

2008-10-01 Thread brettwiesner
Bryan, Thanks for the reply. See inline... You could implement your own loader with a different file extension (say, .enc) that does the en/decryption and then calls the IVE loader to load the resulting data. The curl loader does something like this. This is what I did originally. There

Re: [osg-users] How do I Subclass a file loader?

2008-10-01 Thread Robert Osfield
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

Re: [osg-users] How do I Subclass a file loader?

2008-10-01 Thread brettwiesner
Hey Robert, I'm confused about what you mean here. Many plugins have read/ write methods that take istreams/ ostreams (ReaderWriterIVE being one of them). However, since I can't subclass them I can't attach to the stream. For example, in ReaderWriterIVE::writeNode() a std::ofstream is

Re: [osg-users] How do I Subclass a file loader?

2008-10-01 Thread Thrall, Bryan
brettwiesner wrote on Wednesday, October 01, 2008 3:27 PM: Hey Robert, I'm confused about what you mean here. Many plugins have read/ write methods that take istreams/ ostreams (ReaderWriterIVE being one of them). However, since I can't subclass them I can't attach to the stream. For