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

@@ -50,7 +50,7 @@ void Widget::setExtents(const osg::BoundingBoxf& bb)
void Widget::updateFocus(osg::NodeVisitor& nv)
{
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(&nv);
osgGA::EventVisitor* ev = nv.asEventVisitor();
osgGA::GUIActionAdapter* aa = ev ? ev->getActionAdapter() : 0;
if (ev && aa)
{
@@ -214,7 +214,7 @@ void Widget::traverseImplementation(osg::NodeVisitor& nv)
if (!_graphicsInitialized && nv.getVisitorType()!=osg::NodeVisitor::CULL_VISITOR) createGraphics();
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(&nv);
osgGA::EventVisitor* ev = nv.asEventVisitor();
if (ev)
{
updateFocus(nv);