>>Hi Frédéric,

>>The below is quite a long message, so I'll pick on items that I can
>>shed light on straight away.

ok, sorry il will try to be more concise

>>Finally the http:// is a special case that osgDB::Registry looks for,
>>and automatically load the .net plugin to handle such files.  Since
>>you're working on your own custom format this hardwaring won't be
>>possible, but perhaps osgDB::Rigistry::ReadFileCallback can be used to
>>catch your special filenames and then manage things.

I have tried this solution :
I have defined a class Sp3dReadFileCallback : public Registry::ReadFileCallback.

For each of the readXXX function i do something like that :

  virtual ReaderWriter::ReadResult readNode(const std::string& filename, const 
ReaderWriter::Options* options)
    {
      // Is this is a sp3d://xxxx url, use the Sp3dReaderWriter directly
      //
      ReaderWriter *ptSp3dReader = 
Registry::instance()->getReaderWriterForExtension("sp3d") ;
      if( ptSp3dReader && isSp3dServerUrl( filename ) )
         return ptSp3dReader->readNode( filename, options ) ;

      // else if a previously defined ReadFileCallback wad defined, use it.
      // m_ptPreviousReadFileCallback was initialized in constructor with 
getReadFileCallback...
      //
      if( m_ptPreviousReadFileCallback )
            // not called in my case since m_ptPreviousReadFileCallback  is NULL
            return m_ptPreviousReadFileCallback->readNode( filename, options ) ;
      else
           // use default registry handling
           return Registry::instance()->readNodeImplementation( filename, 
options ) ;
    }

This works for my protocol but this fails for all local loadings !!!

I am probably missing something. Particulary I am not sure about what to do
if the filename is not a sp3d url...

Any ideas ?

oooups, this was not really a short post...

>>Robert.


On 6/13/06, Frédéric Trastour <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I am working on a driver very similar to the '.net' one. This driver just 
> uses a different
> network protocol (not the http/get of the net driver but a proprietary one).
>
> I have used the code of the net driver as a starting point for my driver.
> I have just removed the cache mecanism ( later, i will use the cache managed 
> by my application )
> and I have changed the download stuff in order to use my protocol.
>
> I can successfully use my driver with osgviewer :
>
>     ./osgviewerd.exe sp3d://localhost:2468/3d/747.ive.sp3d
>
> The problem I have concerns osg archive.
> This works locally :
>
>     ./osgviewerd.exe ./archive.osga                              load the 
> archive and display the first file
>     ./osgviewerd.exe ./archive.osga/747.ive                load the archive 
> and display the file 747.ive
>     ./osgviewerd.exe ./archive.osga/capitole_p2.ive  load the archive and 
> display the file capitole_p2.ive
>
> but this fails with both my driver and the .net one.
>
> I have seen that  in net driver do some stuff about archive processing :
>
>       virtual ReadResult openArchive(const string& fileName,ArchiveStatus 
> status, unsigned int , const Options*
options)
> const {
>              osg::notify(osg::NOTICE) << "osgPlugin::openArchive " << 
> fileName << endl;
>              if (status!=READ)
>                return ReadResult(ReadResult::FILE_NOT_HANDLED);
>              else
>                return readFile(ARCHIVE,fileName,options);
>       }
>
>         ReadResult readFile(ObjectType objectType, osgDB::ReaderWriter* rw, 
> std::istream& fin, const Options *options)
> const
>         {
>             switch(objectType)
>             {
>             case(OBJECT): return rw->readObject(fin,options);
>             case(ARCHIVE): return rw->openArchive(fin,options);
>             case(IMAGE): return rw->readImage(fin,options);
>             case(HEIGHTFIELD): return rw->readHeightField(fin,options);
>             case(NODE): return rw->readNode(fin,options);
>             default: break;
>             }
>             return ReadResult::FILE_NOT_HANDLED;
>         }
>
> ...
>
>        if (objectType==ARCHIVE && readResult.validArchive())
>             {
>                 // attach the socket istream to the archive to keep it alive.
>                 osgDB::Archive* archive = readResult.getArchive();
>                 archive->setUserData(sio.get());
>             }
>
> ...
>
> and I have replicated this in my driver. The problem is that I can't load an 
> archive neither
> with the net driver nor with mine (.sp3d).
>
> ./osgviewerd.exe http://localhost/geogp/archive.osga
>
> doesn't work.
>
> Another thing I do not understand is that the net driver is loaded 
> automatically with the following url :
>
> http://localhost/geogp/toto.ive    (note that no .net needs to be appended).
>
> Is it possible to automatically load my driver for this type of url :
>
> sp3d://localhost/toto.ive
>
> for now I have to append the .sp3d extension.
>
> Thanks in advance for any help, I am totally new to OSG  and this is a really 
> large
> library. I don't know how to search first...
>
> I hope my poor english will be understood :(
>
> _________________________________________________________________
> Frédéric Trastour - SpacEyes - [EMAIL PROTECTED]
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/
>
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to