ISceneNodeAnimatorFactory.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #ifndef IRR_I_SCENE_NODE_ANIMATOR_FACTORY_H_INCLUDED
  5. #define IRR_I_SCENE_NODE_ANIMATOR_FACTORY_H_INCLUDED
  6. #include "IReferenceCounted.h"
  7. #include "ESceneNodeAnimatorTypes.h"
  8. namespace irr
  9. {
  10. namespace scene
  11. {
  12. class ISceneNode;
  13. class ISceneNodeAnimator;
  14. //! Interface for dynamic creation of scene node animators
  15. /** To be able to add custom scene node animators to Irrlicht and to make it possible for the
  16. scene manager to save and load those external animators, simply implement this
  17. interface and register it in you scene manager via ISceneManager::registerSceneNodeAnimatorFactory.
  18. Note: When implementing your own scene node factory, don't call ISceneNodeManager::grab() to
  19. increase the reference counter of the scene node manager. This is not necessary because the
  20. scene node manager will grab() the factory anyway, and otherwise cyclic references will
  21. be created and the scene manager and all its nodes won't get deallocated.
  22. */
  23. class ISceneNodeAnimatorFactory : public virtual IReferenceCounted
  24. {
  25. public:
  26. //! creates a scene node animator based on its type id
  27. /** \param type: Type of the scene node animator to add.
  28. \param target: Target scene node of the new animator.
  29. \return Returns pointer to the new scene node animator or null if not successful. You need to
  30. drop this pointer after calling this, see IReferenceCounted::drop() for details. */
  31. virtual ISceneNodeAnimator* createSceneNodeAnimator(ESCENE_NODE_ANIMATOR_TYPE type, ISceneNode* target) = 0;
  32. //! creates a scene node animator based on its type name
  33. /** \param typeName: Type of the scene node animator to add.
  34. \param target: Target scene node of the new animator.
  35. \return Returns pointer to the new scene node animator or null if not successful. You need to
  36. drop this pointer after calling this, see IReferenceCounted::drop() for details. */
  37. virtual ISceneNodeAnimator* createSceneNodeAnimator(const c8* typeName, ISceneNode* target) = 0;
  38. //! returns amount of scene node animator types this factory is able to create
  39. virtual u32 getCreatableSceneNodeAnimatorTypeCount() const = 0;
  40. //! returns type of a creatable scene node animator type
  41. /** \param idx: Index of scene node animator type in this factory. Must be a value between 0 and
  42. getCreatableSceneNodeTypeCount() */
  43. virtual ESCENE_NODE_ANIMATOR_TYPE getCreateableSceneNodeAnimatorType(u32 idx) const = 0;
  44. //! returns type name of a creatable scene node animator type
  45. /** \param idx: Index of scene node animator type in this factory. Must be a value between 0 and
  46. getCreatableSceneNodeAnimatorTypeCount() */
  47. virtual const c8* getCreateableSceneNodeAnimatorTypeName(u32 idx) const = 0;
  48. //! returns type name of a creatable scene node animator type
  49. /** \param type: Type of scene node animator.
  50. \return: Returns name of scene node animator type if this factory can create the type, otherwise 0. */
  51. virtual const c8* getCreateableSceneNodeAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type) const = 0;
  52. };
  53. } // end namespace scene
  54. } // end namespace irr
  55. #endif