Added asUpdate/Cull/EventVisitor and asCamera/asDrawable to osg::Object and usage of these within the code base to avoid dynamic_cast<> usage.

This commit is contained in:
Robert Osfield
2016-01-20 17:49:10 +00:00
parent 2e7cfe7efa
commit 8fc287c1b7
37 changed files with 118 additions and 63 deletions

View File

@@ -84,7 +84,7 @@ void ShadowTechnique::traverse(osg::NodeVisitor& nv)
}
else if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR)
{
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(&nv);
osgUtil::CullVisitor* cv = nv.asCullVisitor();
if (cv) cull(*cv);
else _shadowedScene->osg::Group::traverse(nv);
}

View File

@@ -168,8 +168,8 @@ VDSMCameraCullCallback::VDSMCameraCullCallback(ViewDependentShadowMap* vdsm, osg
void VDSMCameraCullCallback::operator()(osg::Node* node, osg::NodeVisitor* nv)
{
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
osg::Camera* camera = dynamic_cast<osg::Camera*>(node);
osgUtil::CullVisitor* cv = nv->asCullVisitor();
osg::Camera* camera = node->asCamera();
OSG_INFO<<"VDSMCameraCullCallback::operator()(osg::Node* "<<camera<<", osg::NodeVisitor* "<<cv<<")"<<std::endl;
#if 1