CBoneSceneNode.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. // Used with SkinnedMesh and IAnimatedMeshSceneNode, for boned meshes
  6. #include "IBoneSceneNode.h"
  7. #include <optional>
  8. namespace irr
  9. {
  10. namespace scene
  11. {
  12. class CBoneSceneNode : public IBoneSceneNode
  13. {
  14. public:
  15. //! constructor
  16. CBoneSceneNode(ISceneNode *parent, ISceneManager *mgr,
  17. s32 id = -1, u32 boneIndex = 0,
  18. const std::optional<std::string> &boneName = std::nullopt);
  19. //! Returns the index of the bone
  20. u32 getBoneIndex() const override;
  21. //! Sets the animation mode of the bone. Returns true if successful.
  22. bool setAnimationMode(E_BONE_ANIMATION_MODE mode) override;
  23. //! Gets the current animation mode of the bone
  24. E_BONE_ANIMATION_MODE getAnimationMode() const override;
  25. //! returns the axis aligned bounding box of this node
  26. const core::aabbox3d<f32> &getBoundingBox() const override;
  27. /*
  28. //! Returns the relative transformation of the scene node.
  29. //core::matrix4 getRelativeTransformation() const override;
  30. */
  31. void OnAnimate(u32 timeMs) override;
  32. void updateAbsolutePositionOfAllChildren() override;
  33. //! How the relative transformation of the bone is used
  34. void setSkinningSpace(E_BONE_SKINNING_SPACE space) override
  35. {
  36. SkinningSpace = space;
  37. }
  38. E_BONE_SKINNING_SPACE getSkinningSpace() const override
  39. {
  40. return SkinningSpace;
  41. }
  42. private:
  43. void helper_updateAbsolutePositionOfAllChildren(ISceneNode *Node);
  44. u32 BoneIndex;
  45. core::aabbox3d<f32> Box;
  46. E_BONE_ANIMATION_MODE AnimationMode;
  47. E_BONE_SKINNING_SPACE SkinningSpace;
  48. };
  49. } // end namespace scene
  50. } // end namespace irr