//------------------------------------------------------------------------------------
// irr::scene::ISceneNodeAnimator wrappers
//------------------------------------------------------------------------------------

class BMXISceneNodeAnimator : public ISceneNodeAnimator
{
public:

	BMXBinder binder;

	void (*BMXISceneNodeAnimator_animateNode)(s32 binding,ISceneNode* node,u32 timeMs);
	ESCENE_NODE_ANIMATOR_TYPE (*BMXISceneNodeAnimator_getType)(s32 binding);
	ISceneNodeAnimator* (*BMXISceneNodeAnimator_createClone)(s32 binding,ISceneNode* node, ISceneManager* newManager);
	bool (*BMXISceneNodeAnimator_isEventReceiverEnabled)(s32 binding);
	bool (*BMXISceneNodeAnimator_OnEvent)(s32 binding, const SEvent& event);
	bool (*BMXISceneNodeAnimator_hasFinished)(s32 binding);

	BMXBinder* getBinder()
	{
		return &binder;
	}

	BMXISceneNodeAnimator() : ISceneNodeAnimator()
	{
		BMXISceneNodeAnimator_animateNode=0;
		BMXISceneNodeAnimator_getType=0;
		BMXISceneNodeAnimator_createClone=0;
		BMXISceneNodeAnimator_isEventReceiverEnabled=0;
		BMXISceneNodeAnimator_OnEvent=0;
		BMXISceneNodeAnimator_hasFinished=0;
	}

	virtual bool isEventReceiverEnabled() const
	{
		if (BMXISceneNodeAnimator_isEventReceiverEnabled) 
			return BMXISceneNodeAnimator_isEventReceiverEnabled(binder.binding);
		return ISceneNodeAnimator::isEventReceiverEnabled();
	}

	virtual bool OnEvent(const SEvent& event)
	{
		if (BMXISceneNodeAnimator_OnEvent)
			return BMXISceneNodeAnimator_OnEvent(binder.binding, event);
		return ISceneNodeAnimator::OnEvent(event);
	}
			
	void bindAnimateNode(void (*bind_animateNode)(s32 binding,ISceneNode* node,u32 timeMs))
	{
		BMXISceneNodeAnimator_animateNode=bind_animateNode;
	}

	virtual void animateNode(ISceneNode* node,u32 timeMs)
	{
		if (BMXISceneNodeAnimator_animateNode)
			BMXISceneNodeAnimator_animateNode(binder.binding,node,timeMs);
	}	
	
	virtual ESCENE_NODE_ANIMATOR_TYPE getType()
	{
		if (BMXISceneNodeAnimator_getType)
			return BMXISceneNodeAnimator_getType(binder.binding);
		else return ISceneNodeAnimator::getType();
	}	
	
	virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0) 
	{
		if (BMXISceneNodeAnimator_createClone)
			return BMXISceneNodeAnimator_createClone(binder.binding,node,newManager);
		else return 0;
	}

	virtual bool hasFinished() const
	{
		if (BMXISceneNodeAnimator_hasFinished) 
			return BMXISceneNodeAnimator_hasFinished(binder.binding);
		return ISceneNodeAnimator::hasFinished();
	}
	
};

extern "C"
{
	BMXBinder* IrrScene_BMXISceneNodeAnimator_getBinder(BMXISceneNodeAnimator* sa)
	{
		if (sa)
			return sa->getBinder();
		else return 0;
	}
	
	BMXISceneNodeAnimator* IrrScene_BMXISceneNodeAnimator_new()
	{
		return new BMXISceneNodeAnimator();
	}

	void IrrScene_BMXISceneNodeAnimator_bindIsEventReceiverEnabled(BMXISceneNodeAnimator* sa, bool (*bind_isEventReceiverEnabled)(s32 binding))
	{
		if (sa)
			sa->BMXISceneNodeAnimator_isEventReceiverEnabled=bind_isEventReceiverEnabled;
	}

	void IrrScene_BMXISceneNodeAnimator_bindOnEvent(BMXISceneNodeAnimator* sa, bool (*bind_OnEvent)(s32 binding, const SEvent& event))
	{
		if (sa)
			sa->BMXISceneNodeAnimator_OnEvent=bind_OnEvent;
	}
	
	void IrrScene_BMXISceneNodeAnimator_bindAnimateNode(BMXISceneNodeAnimator* sa,void (*bind_animateNode)(s32 binding,ISceneNode* node,u32 timeMs))
	{
		if (sa)
			sa->bindAnimateNode(bind_animateNode);
	}
	
	void IrrScene_BMXISceneNodeAnimator_bindGetType(BMXISceneNodeAnimator* sa,ESCENE_NODE_ANIMATOR_TYPE (*bind_getType)(s32 binding))
	{
		if (sa) {
			//BMXISceneNodeAnimator::getType = bind_getType;
			sa->BMXISceneNodeAnimator_getType=bind_getType;			
		}
	}

	void IrrScene_BMXISceneNodeAnimator_bindCreateClone(BMXISceneNodeAnimator* sa,ISceneNodeAnimator* (*bind_createClone)(s32 binding,ISceneNode* node, ISceneManager* newManager))
	{
		if (sa)
			sa->BMXISceneNodeAnimator_createClone=bind_createClone;
	}

	void IrrScene_BMXISceneNodeAnimator_bindHasFinished(BMXISceneNodeAnimator* sa, bool (*bind_hasFinished)(s32 binding))
	{
		if (sa)
			sa->BMXISceneNodeAnimator_hasFinished=bind_hasFinished;
	}

	ESCENE_NODE_ANIMATOR_TYPE IrrScene_BMXISceneNodeAnimator_getType(BMXISceneNodeAnimator* sa)
	{
		if (sa)
			return sa->getType();
	}

	ISceneNodeAnimator* IrrScene_BMXISceneNodeAnimator_createClone(BMXISceneNodeAnimator* sa,ISceneNode* node, ISceneManager* newManager=0)
	{
		if (sa)
			return sa->createClone(node,newManager);
		else return 0;
	}	
}
	
