Commit 3fc3dcbb authored by Daniel Trstenjak's avatar Daniel Trstenjak
Browse files

OcclusionQueryNode: don't override existing callbacks in camera

parent 048ece35
......@@ -320,15 +320,20 @@ QueryGeometry::drawImplementation( osg::RenderInfo& renderInfo ) const
osg::Camera* cam = renderInfo.getCurrentCamera();
// Add callbacks if necessary.
if (!cam->getPostDrawCallback())
RetrieveQueriesCallback* rqcb = cam->findPostDrawCallback<RetrieveQueriesCallback>();
if (!rqcb)
{
RetrieveQueriesCallback* rqcb = new RetrieveQueriesCallback( ext );
cam->setPostDrawCallback( rqcb );
rqcb = new RetrieveQueriesCallback( ext );
cam->addPostDrawCallback( rqcb );
ClearQueriesCallback* cqcb = cam->findPreDrawCallback<ClearQueriesCallback>();
if (!cqcb)
{
cqcb = new ClearQueriesCallback;
cam->addPreDrawCallback( cqcb );
}
ClearQueriesCallback* cqcb = new ClearQueriesCallback;
cqcb->_rqcb = rqcb;
cam->setPreDrawCallback( cqcb );
}
// Get TestResult from Camera map
......@@ -343,7 +348,6 @@ QueryGeometry::drawImplementation( osg::RenderInfo& renderInfo ) const
}
}
// Issue query
if (!tr->_init)
{
......@@ -358,9 +362,6 @@ QueryGeometry::drawImplementation( osg::RenderInfo& renderInfo ) const
return;
}
// Add TestResult to RQCB.
RetrieveQueriesCallback* rqcb = dynamic_cast<
RetrieveQueriesCallback* >( cam->getPostDrawCallback() );
if (!rqcb)
{
OSG_FATAL << "osgOQ: QG: Invalid RQCB." << std::endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment