IAnimatedMesh.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 "IMesh.h"
  6. namespace irr
  7. {
  8. namespace scene
  9. {
  10. //! Interface for an animated mesh.
  11. /** There are already simple implementations of this interface available so
  12. you don't have to implement this interface on your own if you need to:
  13. You might want to use irr::scene::SAnimatedMesh, irr::scene::SMesh,
  14. irr::scene::SMeshBuffer etc. */
  15. class IAnimatedMesh : public IMesh
  16. {
  17. public:
  18. //! Gets the maximum frame number, 0 if the mesh is static.
  19. virtual f32 getMaxFrameNumber() const = 0;
  20. //! Gets the animation speed of the animated mesh.
  21. /** \return The number of frames per second to play the
  22. animation with by default. If the amount is 0,
  23. it is a static, non animated mesh. */
  24. virtual f32 getAnimationSpeed() const = 0;
  25. //! Sets the animation speed of the animated mesh.
  26. /** \param fps Number of frames per second to play the
  27. animation with by default. If the amount is 0,
  28. it is not animated. The actual speed is set in the
  29. scene node the mesh is instantiated in.*/
  30. virtual void setAnimationSpeed(f32 fps) = 0;
  31. //! Returns the IMesh interface for a frame.
  32. /** \param frame: Frame number, >= 0, <= getMaxFrameNumber()
  33. Linear interpolation is used if this is between two frames.
  34. \return Returns the animated mesh for the given frame */
  35. virtual IMesh *getMesh(f32 frame) = 0;
  36. //! Returns the type of the animated mesh.
  37. /** In most cases it is not necessary to use this method.
  38. This is useful for making a safe downcast. For example,
  39. if getMeshType() returns EAMT_MD2 it's safe to cast the
  40. IAnimatedMesh to IAnimatedMeshMD2.
  41. \returns Type of the mesh. */
  42. E_ANIMATED_MESH_TYPE getMeshType() const override
  43. {
  44. return EAMT_UNKNOWN;
  45. }
  46. };
  47. } // end namespace scene
  48. } // end namespace irr