2
0

IBoneSceneNode.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 "ISceneNode.h"
  6. namespace irr
  7. {
  8. namespace scene
  9. {
  10. //! Enumeration for different bone animation modes
  11. enum E_BONE_ANIMATION_MODE
  12. {
  13. //! The bone is usually animated, unless it's parent is not animated
  14. EBAM_AUTOMATIC = 0,
  15. //! The bone is animated by the skin, if it's parent is not animated then animation will resume from this bone onward
  16. EBAM_ANIMATED,
  17. //! The bone is not animated by the skin
  18. EBAM_UNANIMATED,
  19. //! Not an animation mode, just here to count the available modes
  20. EBAM_COUNT
  21. };
  22. enum E_BONE_SKINNING_SPACE
  23. {
  24. //! local skinning, standard
  25. EBSS_LOCAL = 0,
  26. //! global skinning
  27. EBSS_GLOBAL,
  28. EBSS_COUNT
  29. };
  30. //! Names for bone animation modes
  31. const c8 *const BoneAnimationModeNames[] = {
  32. "automatic",
  33. "animated",
  34. "unanimated",
  35. 0,
  36. };
  37. //! Interface for bones used for skeletal animation.
  38. /** Used with ISkinnedMesh and IAnimatedMeshSceneNode. */
  39. class IBoneSceneNode : public ISceneNode
  40. {
  41. public:
  42. IBoneSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id = -1) :
  43. ISceneNode(parent, mgr, id), positionHint(-1), scaleHint(-1), rotationHint(-1) {}
  44. //! Get the index of the bone
  45. virtual u32 getBoneIndex() const = 0;
  46. //! Sets the animation mode of the bone.
  47. /** \return True if successful. (Unused) */
  48. virtual bool setAnimationMode(E_BONE_ANIMATION_MODE mode) = 0;
  49. //! Gets the current animation mode of the bone
  50. virtual E_BONE_ANIMATION_MODE getAnimationMode() const = 0;
  51. //! Get the axis aligned bounding box of this node
  52. const core::aabbox3d<f32> &getBoundingBox() const override = 0;
  53. //! Returns the relative transformation of the scene node.
  54. // virtual core::matrix4 getRelativeTransformation() const = 0;
  55. //! The animation method.
  56. void OnAnimate(u32 timeMs) override = 0;
  57. //! The render method.
  58. /** Does nothing as bones are not visible. */
  59. void render() override {}
  60. //! How the relative transformation of the bone is used
  61. virtual void setSkinningSpace(E_BONE_SKINNING_SPACE space) = 0;
  62. //! How the relative transformation of the bone is used
  63. virtual E_BONE_SKINNING_SPACE getSkinningSpace() const = 0;
  64. //! Updates the absolute position based on the relative and the parents position
  65. virtual void updateAbsolutePositionOfAllChildren() = 0;
  66. s32 positionHint;
  67. s32 scaleHint;
  68. s32 rotationHint;
  69. };
  70. } // end namespace scene
  71. } // end namespace irr