AnimationChannel.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. const std::string& getTargetId() const;
  31. void setTargetId(const std::string str);
  32. void setTargetAttribute(unsigned int attrib);
  33. void setKeyTimes(const std::vector<float>& values);
  34. void setKeyValues(const std::vector<float>& values);
  35. void setTangentsIn(const std::vector<float>& values);
  36. void setTangentsOut(const std::vector<float>& values);
  37. void setInterpolations(const std::vector<unsigned int>& values);
  38. unsigned int getTargetAttribute() const;
  39. const std::vector<float>& getKeyValues() const;
  40. const std::vector<float>& getKeyTimes() const;
  41. const std::vector<float>& getTangentsIn() const;
  42. const std::vector<float>& getTangentsOut() const;
  43. const std::vector<unsigned int>& getInterpolationTypes() const;
  44. /**
  45. * Returns the interpolation type value for the given string or zero if not valid.
  46. * Example: "LINEAR" returns AnimationChannel::LINEAR
  47. *
  48. * @param str Interpolation such as "LINEAR" or "BSPLINE".
  49. *
  50. * @return A value from InterpolationTypes enum or zero if not valid.
  51. */
  52. static unsigned int getInterpolationType(const char* str);
  53. private:
  54. std::string _targetId;
  55. unsigned int _targetAttrib;
  56. std::vector<float> _keytimes;
  57. std::vector<float> _keyValues;
  58. std::vector<float> _tangentsIn;
  59. std::vector<float> _tangentsOut;
  60. std::vector<unsigned int> _interpolations;
  61. };
  62. }
  63. #endif