Ok, i see your point of view.
But to modify the OBJECT_CAST macro is a bit tricky, and the runtime
cost of a dynamic_cast compared to a static_cast is quite negligible in
practise. This is not a a critical performance loop.
Now, you decide, i will modify my own code if you want to keep it like
this.
Regards,
Fabien

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
Wang Rui
Sent: lundi 8 mars 2010 11:05
To: OpenSceneGraph Submissions
Subject: Re: [osg-submissions] Using the new serializer

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-openscene
> graph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegr
aph.org

______________________________________________________________________
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

Reply via email to