Show
Ignore:
Timestamp:
10/21/14 17:10:27 (9 days ago)
Author:
robert
Message:

Added shaders to support experimental shader based displacement mapping technique osgTerrain::ShaderTerrain?.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgGA/GUIEventHandler.cpp

    r13041 r13890  
    1717using namespace osgGA; 
    1818 
    19  
    20 void GUIEventHandler::operator()(osg::Node* node, osg::NodeVisitor* nv) 
     19// adapt EventHandler usage to old style GUIEventHandler usage 
     20bool GUIEventHandler::handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv) 
    2121{ 
    2222    osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv); 
    23     if (ev && ev->getActionAdapter() && !ev->getEvents().empty()) 
     23    osgGA::GUIEventAdapter* ea = event->asGUIEventAdapter(); 
     24    if (ea && ev && ev->getActionAdapter()) 
    2425    { 
    25         for(osgGA::EventQueue::Events::iterator itr = ev->getEvents().begin(); 
    26             itr != ev->getEvents().end(); 
    27             ++itr) 
    28         { 
    29             handleWithCheckAgainstIgnoreHandledEventsMask(*(*itr), *(ev->getActionAdapter()), node, nv); 
    30         } 
     26#if 1 
     27        bool handled = handle(*ea, *(ev->getActionAdapter()), object, nv); 
     28        if (handled) ea->setHandled(true); 
     29        return handled; 
     30#else 
     31        return handleWithCheckAgainstIgnoreHandledEventsMask(*ea, *(ev->getActionAdapter()), object, nv); 
     32#endif 
    3133    } 
    32     if (node->getNumChildrenRequiringEventTraversal()>0 || _nestedCallback.valid()) traverse(node,nv); 
     34    return false; 
    3335} 
    3436 
    35 void GUIEventHandler::event(osg::NodeVisitor* nv, osg::Drawable* drawable) 
    36 { 
    37     osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv); 
    38     if (ev && ev->getActionAdapter() && !ev->getEvents().empty()) 
    39     { 
    40         for(osgGA::EventQueue::Events::iterator itr = ev->getEvents().begin(); 
    41             itr != ev->getEvents().end(); 
    42             ++itr) 
    43         { 
    44             handleWithCheckAgainstIgnoreHandledEventsMask(*(*itr), *(ev->getActionAdapter()), drawable, nv); 
    45         } 
    46     } 
    47 } 
    48