Hallo,

Imagine I have following situation of classes:

     osg::Object
      /     \
     /       \
   Base     osgText::Text
    |         |
    |         |
     \       /
      \     /
      DerivedText

I know, this is so called diamond polymorphism, which
is sometimes not good. However in my case I need such
a structure or better to say, there is no elegant way
to go around this.

Now I have specified my own ReaderWriter to serialize
the content of the DerivedText into a file. The format
is very similar to the .osg  file format, hence I
decided to use osgdb_osg plugin to write information
about osgText::Text into this file.

This is done by calling:
osgDB::ReaderWriter* rw =
osgDB::Registry::instance()->getReaderWriterForExtension("osg");
rw->writeObject(static_cast<const
osgText::Text&>(*derivedText), fout);

Using this there is no information written by the
plugin to the output stream.
The problem here is, that the call of 
static_cast<const
osgText::Text&>(*derivedText).className() returns the
name, which is given back by the
DerivedText::className() method and not the one given
back by the osgText::Text::className() and therefor
the Registry::writeObject() method can not find
appropriate DotOsgWrapper for this.

One could solve this by manually retrieving the
DotOsgWrapper from the osgDB::Registry. However there
is no such method like
osgDB::Registry::getDotOsgWrapper() method defined.
The  counterpart to this, namely addDotOsgWrapper,
method exist.

Is meant to be so, or is it a feature which we could
need?

Thanks in advance.





      Machen Sie Yahoo! zu Ihrer Startseite. Los geht's: 
http://de.yahoo.com/set
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to