diff -Naurw include/ISceneNodeAnimator.h include/ISceneNodeAnimator.h --- include/ISceneNodeAnimator.h 2005-08-20 22:17:46.000000000 +0200 +++ include/ISceneNodeAnimator.h 2005-10-17 17:29:40.000000000 +0200 @@ -7,6 +7,7 @@ #include "IUnknown.h" #include "vector3d.h" +#include "irrArray.h" #include "ESceneNodeAnimatorTypes.h" #include "IAttributeExchangingObject.h" @@ -14,6 +15,29 @@ { class ISceneNode; + //! Enumeration for specifying which type of event was fired when a callback is called + enum EANIMATOR_EVENT + { + //! To receive any animator event + EAE_ANY, + + //! Event representing that the scene node animator is starting. + EAE_START, + + //! Event representing that the scene node animator is stoppiong. + EAE_STOP, + + //! Event representing that the scene node animator has gone through a loop + EAE_LOOP, + + //! Event representing a waypoint in the spline animator has been passed + EAE_WAYPOINT, + + EAE_COUNT + }; + + typedef bool (*SceneNodeAnimatorCallback)(ISceneNode* node, EANIMATOR_EVENT event, void* userData ); + //! Animates a scene node. Can animate position, rotation, material, and so on. /** A scene node animator is able to animate a scene node in a very simple way. It may change its position, rotation, scale and/or material. There are lots of animators @@ -38,6 +62,27 @@ { return ESNAT_UNKNOWN; } + + //! set callback function + virtual void setCallback( SceneNodeAnimatorCallback callback, EANIMATOR_EVENT event, void* userData = 0 ) + { + struct CallbackStruct callbackStruct; + callbackStruct.Callback = callback; + callbackStruct.Event = event; + callbackStruct.UserData = userData; + CallbackList.push_back( callbackStruct ); + } + + protected: + struct CallbackStruct + { + SceneNodeAnimatorCallback Callback; + EANIMATOR_EVENT Event; + void* UserData; + }; + + core::array CallbackList; + }; } // end namespace scene } // end namespace irr