Hi Robert, Hi Wojtek,
I think the easiest solution is to pass the RenderInfo reference to the
osg::Camera::DrawCallback::operator() method along with the camera
reference.  The original operator() method could even be left in place
if we're worried about breaking other things.  By default, the new
operator(const osg::Camera&, osg::RenderInfo&) method could simply call
the old operator(const osg::Camera&) method.  If
osgUtil::RenderStage::draw always calls the new method, everything
should continue to work as it already does, but the user would have the
option in the derived osg::Camera::DrawCallback class to override either
operator method.  In situations like mine, I would override the newer
one and grab the current view.  All existing code could continue to
override the old operator method, and things would function like normal.


For Example:

include/osg/Camera: (From line 396 on OSG2.2.0 tag)
        /** Draw callback for custom operations.*/
        struct DrawCallback : virtual public Object
        {
            DrawCallback() {}

            DrawCallback(const DrawCallback&,const CopyOp&) {}

            META_Object(osg,DrawCallback)
        
            virtual void operator () (const osg::Camera& /*camera*/)
const {}
            virtual void operator () (const osg::Camera& camera, 
                                      osg::RenderInfo&   rInfo) const {
this->operator()(camera); }
        };

src/osgUtil/RenderStage.cpp:
    void RenderStage::draw(osg::RenderInfo& renderInfo, RenderLeaf*&
previous) {
        ...
        // Starting at Line 942 in tag 2.2.0
        if (_camera && _camera->getPostDrawCallback())
        {
            // if we have a camera with a post draw callback invoke it.
            //(*(_camera->getPostDrawCallback()))(*_camera);
<- CURRENTLY ON OSG2.2.0 TAG
            (*(_camera->getPostDrawCallback()))(*_camera, renderInfo);
// My suggestion
        }
        ...
    }


This may not be the cleanest suggestion, but it will solve our problem
without breaking anything else.

Thanks,
Justin

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Wojciech Lewandowski
Sent: Friday, February 29, 2008 5:19 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Camera POST_RENDER vs. postDrawCallback ...
whowins?

Hi Robert,

> I'll be doing some merges this morning and once this done will spend a
> bit of time reflecting on this issue.

Thank You,  I don't opt for any specific solution. Anything what gives a

method to grab current State object will help. I gues Justin will say
the 
same if he would able to figure out current View...

Wojtek 

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

Reply via email to