root/OpenSceneGraph/trunk/src/osgGA/EventHandler.cpp @ 13890

Revision 13890, 1.8 kB (checked in by robert, 36 hours ago)

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

Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2013 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#include <osgGA/GUIEventHandler>
15#include <osgGA/EventVisitor>
16
17using namespace osgGA;
18
19void EventHandler::operator()(osg::Node* node, osg::NodeVisitor* nv)
20{
21    osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
22    if (ev && ev->getActionAdapter() && !ev->getEvents().empty())
23    {
24        for(osgGA::EventQueue::Events::iterator itr = ev->getEvents().begin();
25            itr != ev->getEvents().end();
26            ++itr)
27        {
28            handle(itr->get(), node, nv);
29        }
30    }
31    if (node->getNumChildrenRequiringEventTraversal()>0 || _nestedCallback.valid()) traverse(node,nv);
32}
33
34void EventHandler::event(osg::NodeVisitor* nv, osg::Drawable* drawable)
35{
36    osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
37    if (ev && ev->getActionAdapter() && !ev->getEvents().empty())
38    {
39        for(osgGA::EventQueue::Events::iterator itr = ev->getEvents().begin();
40            itr != ev->getEvents().end();
41            ++itr)
42        {
43            handle(itr->get(), drawable, nv);
44        }
45    }
46}
47
48bool EventHandler::handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv)
49{
50    OSG_NOTICE<<"Handle event "<<event<<std::endl;
51    return false;
52}
Note: See TracBrowser for help on using the browser.