Hi,

I very like the capability of osg::Node to register any number of update, 
event and cull callbacks. This allows for a nice modular approach with each 
module registering callbacks for anything they wish without disturbing others.

I came to a problem that Camera can register just one Initial-,Pre-,Post-, and 
Final-DrawCallback. Surely, I can register my own "callback container" that 
would call all my registered callback. But that is not compatible with OSG-
registered Callbacks, for instance OcclusionQueryNode would overwrite my 
callback container. Could we possibly make the similar approach for the camera 
as for osg::Node? I can volunteer to make the first iteration for osg-
submissions, if the community and Robert thinks that it is a good idea.


My idea for implementation would be to append
ref_ptr<DrawCallback> _nestedCallback into the Camera::DrawCallback structure, 
append Camera::add*Callback() and Camera::remove*Callback()
and make Camera::callCallbacks(DrawCallback *cb) with a parameter giving 
pointer to the first DrawCallback of Initial-,Pre-,Post-, and Final-
DrawCallback list.
An alternative would be to let the user call nested callbacks from 
DrawCallback::operator(), but as we would always want (probably) to call all 
the callbacks and never stop in the middle of the work, I personally like the 
first approach more and it is more compatibility-friendly, as users will not 
need to modify their existing callbacks to get the new multi-callback 
capability. But I am ok with any approach.


Do you think it is a good idea?
John

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to