SkelAnimModelNodeCtrl.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef SKEL_ANIM_MODEL_NODE_CTRL_H
  2. #define SKEL_ANIM_MODEL_NODE_CTRL_H
  3. #include "Vec.h"
  4. #include "Controller.h"
  5. #include "Math.h"
  6. #include "RsrcPtr.h"
  7. #include "Properties.h"
  8. class Skeleton;
  9. class SkelAnim;
  10. class SkinNode;
  11. /// SkelAnim controls a ModelNode
  12. class SkelAnimModelNodeCtrl: public Controller
  13. {
  14. public:
  15. SkelAnimModelNodeCtrl(SkinNode& skelNode_);
  16. /// @name Accessors
  17. /// @{
  18. float getStep() const {return step;}
  19. float& getStep() {return step;}
  20. void setStep(float s) {step = s;}
  21. /// @}
  22. void update(float time);
  23. void set(const SkelAnim* skelAnim_) {skelAnim = skelAnim_;}
  24. private:
  25. float step;
  26. float frame;
  27. const SkelAnim* skelAnim; ///< The active skeleton animation
  28. SkinNode& skinNode; ///< Know your father
  29. /// @name The 3 steps of skeletal animation in 3 methods
  30. /// @{
  31. /// Interpolate
  32. /// @param[in] animation Animation
  33. /// @param[in] frame Frame
  34. /// @param[out] translations Translations vector
  35. /// @param[out] rotations Rotations vector
  36. static void interpolate(const SkelAnim& animation, float frame, Vec<Vec3>& translations, Vec<Mat3>& rotations);
  37. static void updateBoneTransforms(const Skeleton& skel, Vec<Vec3>& translations, Vec<Mat3>& rotations);
  38. /// Now with HW skinning it deforms only the debug skeleton
  39. static void deform(const Skeleton& skel, const Vec<Vec3>& translations, const Vec<Mat3>& rotations,
  40. Vec<Vec3>& heads, Vec<Vec3>& tails);
  41. /// @}
  42. };
  43. #endif