Fixed crash in handling of an osg::Callback attached to a Drawable as update callback.

Added handling of osg::Callback when attavhed to a Drawable as a cull callback.
This commit is contained in:
Robert Osfield 2016-11-23 18:19:59 +00:00
parent e89885a076
commit b04271f93e
2 changed files with 5 additions and 2 deletions

View File

@ -63,12 +63,11 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor
{
osg::DrawableUpdateCallback* drawable_callback = callback->asDrawableUpdateCallback();
osg::NodeCallback* node_callback = callback->asNodeCallback();
osg::CallbackObject* callback_object = callback->asCallbackObject();
if (drawable_callback) drawable_callback->update(this,&drawable);
if (node_callback) (*node_callback)(&drawable, this);
if ((!drawable_callback && !node_callback) || callback_object) callback_object->run(&drawable, this);
if (!drawable_callback && !node_callback) callback->run(&drawable, this);
}
handle_callbacks(drawable.getStateSet());

View File

@ -992,6 +992,10 @@ void CullVisitor::apply(osg::Drawable& drawable)
{
if( dcb->cull( this, &drawable, &_renderInfo ) == true ) return;
}
else
{
drawable.getCullCallback()->run(&drawable,this);
}
}
if (drawable.isCullingActive() && isCulled(bb)) return;