AnimationChannel.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef ANIMATIONCHANNEL_H_
  2. #define ANIMATIONCHANNEL_H_
  3. #include "Object.h"
  4. namespace gameplay
  5. {
  6. class AnimationChannel : public Object
  7. {
  8. public:
  9. enum InterpolationTypes
  10. {
  11. LINEAR = 1,
  12. BEZIER = 2,
  13. CARDINAL = 3,
  14. HERMITE = 4,
  15. BSPLINE = 5,
  16. STEP = 6
  17. };
  18. /**
  19. * Constructor.
  20. */
  21. AnimationChannel(void);
  22. /**
  23. * Destructor.
  24. */
  25. virtual ~AnimationChannel(void);
  26. virtual unsigned int getTypeId(void) const;
  27. virtual const char* getElementName(void) const;
  28. virtual void writeBinary(FILE* file);
  29. virtual void writeText(FILE* file);
  30. void setTargetId(const std::string str);
  31. void setTargetAttribute(unsigned int attrib);
  32. void setKeyTimes(const std::vector<float>& values);
  33. void setKeyValues(const std::vector<float>& values);
  34. void setTangentsIn(const std::vector<float>& values);
  35. void setTangentsOut(const std::vector<float>& values);
  36. void setInterpolations(const std::vector<unsigned int>& values);
  37. const std::vector<float>& getKeyValues() const;
  38. /**
  39. * Returns the interpolation type value for the given string or zero if not valid.
  40. * Example: "LINEAR" returns AnimationChannel::LINEAR
  41. *
  42. * @param str Interpolation such as "LINEAR" or "BSPLINE".
  43. *
  44. * @return A value from InterpolationTypes enum or zero if not valid.
  45. */
  46. static unsigned int getInterpolationType(const char* str);
  47. private:
  48. std::string _targetId;
  49. unsigned int _targetAttrib;
  50. std::vector<float> _keytimes;
  51. std::vector<float> _keyValues;
  52. std::vector<float> _tangentsIn;
  53. std::vector<float> _tangentsOut;
  54. std::vector<unsigned int> _interpolations;
  55. };
  56. }
  57. #endif