#ifndef CCALLBACKANIMATOR_H_INCLUDED
#define CCALLBACKANIMATOR_H_INCLUDED

#include "ISceneNodeAnimator.h"

// This little Animator is used to animate Trees to rotate
// around its center. So it looks like bending in the wind.....


typedef bool(*AnimatorCallbackPtr)(irr::scene::ISceneNode*, u32);

namespace irr
{
namespace scene
{
class CCallbackAnimator : public ISceneNodeAnimator
{
   public:
    //! constructor
   CCallbackAnimator(AnimatorCallbackPtr callBack,  u32 _now, u32 _userdata) :
    startTime(_now),userdata(_userdata)
   {
        callback = callBack;

//        callback = callBack;
   }

   virtual void animateNode(ISceneNode* node, u32 timeMs)
   {
/*
        float t = (timeMs-startTime);
        if (t < timeForRotation)
            return;
        startTime=timeMs;
*/

       	if (!callback(node,userdata))
            this->drop();
   }

   protected:

   u32 startTime;
   u32 userdata;
   AnimatorCallbackPtr callback;

};

} // end namespace scene
} // end namespace irr

#endif // CCALLBACKANIMATOR_H_INCLUDED
