AnimationState.pkg 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. $#include "AnimationState.h"
  2. /// %Animation instance.
  3. class AnimationState
  4. {
  5. public:
  6. /// Construct with animated model and animation pointers.
  7. AnimationState(AnimatedModel* model, Animation* animation);
  8. /// Construct with root scene node and animation pointers.
  9. AnimationState(Node* node, Animation* animation);
  10. /// Destruct.
  11. ~AnimationState();
  12. /// Set start bone. Not supported in node animation mode.
  13. void SetStartBone(Bone* bone);
  14. /// Set looping enabled/disabled.
  15. void SetLooped(bool looped);
  16. /// Set blending weight.
  17. void SetWeight(float weight);
  18. /// Set time position. Does not fire animation triggers.
  19. void SetTime(float time);
  20. /// Modify blending weight.
  21. void AddWeight(float delta);
  22. /// Modify time position. %Animation triggers will be fired.
  23. void AddTime(float delta);
  24. /// Set blending layer.
  25. void SetLayer(unsigned char layer);
  26. /// Return animation.
  27. Animation* GetAnimation() const { return animation_; }
  28. /// Return start bone.
  29. Bone* GetStartBone() const;
  30. /// Return whether weight is nonzero.
  31. bool IsEnabled() const { return weight_ > 0.0f; }
  32. /// Return whether looped.
  33. bool IsLooped() const { return looped_; }
  34. /// Return blending weight.
  35. float GetWeight() const { return weight_; }
  36. /// Return time position.
  37. float GetTime() const { return time_; }
  38. /// Return animation length.
  39. float GetLength() const;
  40. /// Return blending layer.
  41. unsigned char GetLayer() const { return layer_; }
  42. /// Apply the animation at the current time position.
  43. void Apply();
  44. };