AnimatedModel.pkg 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. $#include "AnimatedModel.h"
  2. /// Animated model component.
  3. class AnimatedModel : public StaticModel
  4. {
  5. public:
  6. /// Set model.
  7. void SetModel(Model* model, bool createBones = true);
  8. /// Add an animation.
  9. AnimationState* AddAnimationState(Animation* animation);
  10. /// Remove an animation by animation pointer.
  11. void RemoveAnimationState(Animation* animation);
  12. /// Remove an animation by animation name.
  13. void RemoveAnimationState(const String& animationName);
  14. /// Remove an animation by animation name hash.
  15. void RemoveAnimationState(StringHash animationNameHash);
  16. /// Remove an animation by AnimationState pointer.
  17. void RemoveAnimationState(AnimationState* state);
  18. /// Remove an animation by index.
  19. void RemoveAnimationState(unsigned index);
  20. /// Remove all animations.
  21. void RemoveAllAnimationStates();
  22. /// Set animation LOD bias.
  23. void SetAnimationLodBias(float bias);
  24. /// Set animation LOD distance factor when not visible (default 0 = do not update at all when invisible.)
  25. void SetInvisibleLodFactor(float factor);
  26. /// Set vertex morph weight by index.
  27. void SetMorphWeight(unsigned index, float weight);
  28. /// Set vertex morph weight by name.
  29. void SetMorphWeight(const String& name, float weight);
  30. /// Set vertex morph weight by name hash.
  31. void SetMorphWeight(StringHash nameHash, float weight);
  32. /// Reset all vertex morphs to zero.
  33. void ResetMorphWeights();
  34. /// Return skeleton.
  35. Skeleton& GetSkeleton() { return skeleton_; }
  36. /// Return number of animation states.
  37. unsigned GetNumAnimationStates() const { return animationStates_.Size(); }
  38. /// Return animation state by animation pointer.
  39. AnimationState* GetAnimationState(Animation* animation) const;
  40. /// Return animation state by animation name.
  41. AnimationState* GetAnimationState(const String& animationName) const;
  42. /// Return animation state by animation name.
  43. AnimationState* GetAnimationState(const char* animationName) const;
  44. /// Return animation state by animation name hash.
  45. AnimationState* GetAnimationState(const StringHash animationNameHash) const;
  46. /// Return animation state by index.
  47. AnimationState* GetAnimationState(unsigned index) const;
  48. /// Return animation LOD bias.
  49. float GetAnimationLodBias() const { return animationLodBias_; }
  50. /// Return animation LOD distance factor when not visible.
  51. float GetInvisibleLodFactor() const { return invisibleLodFactor_; }
  52. /// Return number of vertex morphs.
  53. unsigned GetNumMorphs() const { return morphs_.Size(); }
  54. /// Return vertex morph weight by index.
  55. float GetMorphWeight(unsigned index) const;
  56. /// Return vertex morph weight by name.
  57. float GetMorphWeight(const String& name) const;
  58. /// Return vertex morph weight by name hash.
  59. float GetMorphWeight(StringHash nameHash) const;
  60. /// Return whether is the master (first) animated model.
  61. bool IsMaster() const { return isMaster_; }
  62. };