Hi Julian,

The primary reason for only having a single callback for each of the Camera
initial, pre, post and final DrawCallback is keeping the Camera API clean
and minimal.  If we were to have a list of callbacks for each of these
types of callbacks we'd end up with one very large API, all for very small
number of users that would need it.

This same issue arises elsewhere in the OSG such as general NodeCallback,
but I came up with an appropriate of nesting callbacks to allow one to have
multiple callbacks nested within each other so they form a kinda of linked
list.  The advantage with this approach is that you retain the single set
of entry points to set/getting the callback attached to the node, and for
the case of scene graph traversal callbacks you enable one to customize the
traversal.

If we are to add multiple callbacks support into osg::Camera it would
probably be least intrusive to do it via nesting as well.  In svn/trunk
version of the OSG I introduced a new Callback base class that provides
nesting, but looking at osg::Camera I see that I didn't roll this out to
osg::Camera.  Potentially we could do this, I'll have a think about it.
The first step would be to subclass osg::Camera::DrawCallback from
osg::Callback instead of osg::Object.  The next step would be to allow one
to get/get the intial, pre, post and final DrawCallback API to use
osg::Callback rather than osg::Camera::DrawCallback, although this step has
the potential for breaking the API for end users.

Prior to any of these changes you can implement your own support for
multiple callbacks by creating and MyMultipleDrawCallbacks subclass from
osg::Camera::DrawCallback and then let it have a list of DrawCallback that
it calls.

Robert.



On 23 December 2014 at 23:03, Julien Valentin <[email protected]>
wrote:

> Hi,
> Tell me I'm dumb but I'm kind of surprise that ones can't add several
> Camera postdraw callbacks.
> Is there a reason for it?
>
> Ex:I'm using osg::OcclusionQueryNodes in my scene, so when I set the
> PostDrawCallBack of the Camera during CullTraversal it replaces the one
> setted up by   osg::OcclusionQueryNode cull traversal
>
> Thank you!
>
> Cheers,
> Julien
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=62179#62179
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to