25 #ifndef WGEFUNCTORCALLBACK_H
26 #define WGEFUNCTORCALLBACK_H
28 #include <boost/signals2.hpp>
31 #include <osg/NodeCallback>
33 #include "WGECallbackTraits.h"
43 template <
typename Type = osg::Node >
50 typedef osg::ref_ptr< WGEFunctorCallback >
SPtr;
55 typedef osg::ref_ptr< const WGEFunctorCallback >
ConstSPtr;
80 virtual void operator()( Type* handled, osg::NodeVisitor* nv );
89 virtual void update( osg::NodeVisitor* nv, Type* handled );
99 template <
typename Type >
107 template <
typename Type >
113 template <
typename Type >
117 m_functor( handled );
121 template <
typename Type >
124 operator()( handled, nv );
127 #endif // WGEFUNCTORCALLBACK_H
boost::function< void(Type *)> FunctorType
The type of functor supported in this callback.
FunctorType m_functor
The functor getting called each callback.
osg::ref_ptr< const WGEFunctorCallback > ConstSPtr
Const shared pointer.
virtual void operator()(Type *handled, osg::NodeVisitor *nv)
This operator gets called by OSG every update cycle.
This callback allows you a simple usage of callbacks in your module.
static void traverse(CallbackType *inst, HandledType *handled, osg::NodeVisitor *nv)
Call traversal method if existing for the specific callback type.
osg::ref_ptr< WGEFunctorCallback > SPtr
Shared pointer.
virtual ~WGEFunctorCallback()
Destructor.
WGEFunctorCallback(FunctorType functor)
Default constructor.
This class is needed as OSG does not define a uniform callback type.
virtual void update(osg::NodeVisitor *nv, Type *handled)
This gets called by OSG every update cycle.