25 #ifndef WGEFUNCTORCALLBACK_H
26 #define WGEFUNCTORCALLBACK_H
29 #include <boost/signals2.hpp>
33 #include <osg/NodeCallback>
35 #include "WGECallbackTraits.h"
45 template <
typename Type = osg::Node >
52 typedef osg::ref_ptr< WGEFunctorCallback >
SPtr;
57 typedef osg::ref_ptr< const WGEFunctorCallback >
ConstSPtr;
82 virtual void operator()( Type* handled, osg::NodeVisitor* nv );
91 virtual void update( osg::NodeVisitor* nv, Type* handled );
101 template <
typename Type >
109 template <
typename Type >
115 template <
typename Type >
119 m_functor( handled );
123 template <
typename Type >
126 operator()( handled, nv );
129 #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.