Hi Fabien, In fact the problem of wrapping callbacks was solved in a slightly different way: The OBJECT_CAST macro could be redefined when there are such requirements. It needs a little more coding but works well at present, I think. See the ClusterCullingCallback wrapper as an example. And dynamic_cast seems to cost more than static_cast in my opinion. What do you think?
Regards, Wang Rui 2010/3/8 Fabien Lavignotte <[email protected]>: > Oups, I forgot to attach one file for the removal of osgDB/ObjectWrapper > from osgDB/Registry header. > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of > Fabien Lavignotte > Sent: lundi 8 mars 2010 10:28 > To: OpenSceneGraph Submissions > Subject: [osg-submissions] Using the new serializer > > Hi Robert and Wang, > I have used the new serializer to save some custom OSG objects into the > new format. Great work! > I have met one problem, one of my custom object inherits from a drawable > callback, and ADD_OBJECT_SERIALIZER macro doesn't compile. Drawable > callback uses virtual inheritance on osg::Object, and so a dynamic_cast > is needed to convert to osg::Object. But, the ObjectSerializer uses a > static_cast. Just replacing static_cast with dynamic_cast in OBJECT_CAST > macro and it works. I don't think the runtime cost of dynamic_cast vs > static_cast will be a problem. > > Then, when i modify the osgDB/Serializer file, lot of files are > recompiled. This is because osgDB/Registry includes osgDB/ObjectWrapper, > that includes osgDB/Serializer. I remove the include and add a > pre-decleration to avoid too much bloat. > > Thanks, > Fabien Lavignotte > > > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ > > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ > > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > > _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
