2
0

IAnimatedMesh.h 2.6 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. #pragma once
  5. #include "aabbox3d.h"
  6. #include "IMesh.h"
  7. namespace irr
  8. {
  9. namespace scene
  10. {
  11. //! Interface for an animated mesh.
  12. /** There are already simple implementations of this interface available so
  13. you don't have to implement this interface on your own if you need to:
  14. You might want to use irr::scene::SAnimatedMesh, irr::scene::SMesh,
  15. irr::scene::SMeshBuffer etc. */
  16. class IAnimatedMesh : public IMesh
  17. {
  18. public:
  19. //! Gets the frame count of the animated mesh.
  20. /** Note that the play-time is usually getFrameCount()-1 as it stops as soon as the last frame-key is reached.
  21. \return The amount of frames. If the amount is 1,
  22. it is a static, non animated mesh. */
  23. virtual u32 getFrameCount() const = 0;
  24. //! Gets the animation speed of the animated mesh.
  25. /** \return The number of frames per second to play the
  26. animation with by default. If the amount is 0,
  27. it is a static, non animated mesh. */
  28. virtual f32 getAnimationSpeed() const = 0;
  29. //! Sets the animation speed of the animated mesh.
  30. /** \param fps Number of frames per second to play the
  31. animation with by default. If the amount is 0,
  32. it is not animated. The actual speed is set in the
  33. scene node the mesh is instantiated in.*/
  34. virtual void setAnimationSpeed(f32 fps) = 0;
  35. //! Returns the IMesh interface for a frame.
  36. /** \param frame: Frame number as zero based index. The maximum
  37. frame number is getFrameCount() - 1;
  38. \param detailLevel: Level of detail. 0 is the lowest, 255 the
  39. highest level of detail. Most meshes will ignore the detail level.
  40. \param startFrameLoop: Because some animated meshes (.MD2) are
  41. blended between 2 static frames, and maybe animated in a loop,
  42. the startFrameLoop and the endFrameLoop have to be defined, to
  43. prevent the animation to be blended between frames which are
  44. outside of this loop.
  45. If startFrameLoop and endFrameLoop are both -1, they are ignored.
  46. \param endFrameLoop: see startFrameLoop.
  47. \return Returns the animated mesh based on a detail level. */
  48. virtual IMesh *getMesh(s32 frame, s32 detailLevel = 255, s32 startFrameLoop = -1, s32 endFrameLoop = -1) = 0;
  49. //! Returns the type of the animated mesh.
  50. /** In most cases it is not necessary to use this method.
  51. This is useful for making a safe downcast. For example,
  52. if getMeshType() returns EAMT_MD2 it's safe to cast the
  53. IAnimatedMesh to IAnimatedMeshMD2.
  54. \returns Type of the mesh. */
  55. E_ANIMATED_MESH_TYPE getMeshType() const override
  56. {
  57. return EAMT_UNKNOWN;
  58. }
  59. };
  60. } // end namespace scene
  61. } // end namespace irr