OcclusionQueryNode: don't override existing callbacks in camera
This commit is contained in:
parent
048ece358a
commit
3fc3dcbb56
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user