25 #ifndef WGEFUNCTORCALLBACK_H
26 #define WGEFUNCTORCALLBACK_H
30 #include <boost/signals2.hpp>
32 #include <osg/NodeCallback>
34 #include "WGECallbackTraits.h"
44 template <
typename Type = osg::Node >
51 typedef osg::ref_ptr< WGEFunctorCallback >
SPtr;
56 typedef osg::ref_ptr< const WGEFunctorCallback >
ConstSPtr;
81 virtual void operator()( Type* handled, osg::NodeVisitor* nv );
90 virtual void update( osg::NodeVisitor* nv, Type* handled );
100 template <
typename Type >
108 template <
typename Type >
114 template <
typename Type >
118 m_functor( handled );
122 template <
typename Type >
125 operator()( handled, nv );
This class is needed as OSG does not define a uniform callback type.
static void traverse(CallbackType *inst, HandledType *handled, osg::NodeVisitor *nv)
Call traversal method if existing for the specific callback type.
This callback allows you a simple usage of callbacks in your module.
WGEFunctorCallback(FunctorType functor)
Default constructor.
virtual void operator()(Type *handled, osg::NodeVisitor *nv)
This operator gets called by OSG every update cycle.
FunctorType m_functor
The functor getting called each callback.
virtual ~WGEFunctorCallback()
Destructor.
osg::ref_ptr< WGEFunctorCallback > SPtr
Shared pointer.
boost::function< void(Type *)> FunctorType
The type of functor supported in this callback.
osg::ref_ptr< const WGEFunctorCallback > ConstSPtr
Const shared pointer.
virtual void update(osg::NodeVisitor *nv, Type *handled)
This gets called by OSG every update cycle.