AnimationValue.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef ANIMATIONVALUE_H_
  2. #define ANIMATIONVALUE_H_
  3. #include "Animation.h"
  4. namespace gameplay
  5. {
  6. /**
  7. * Defines a running animation value which can have one or more floats.
  8. */
  9. class AnimationValue
  10. {
  11. friend class AnimationClip;
  12. public:
  13. /**
  14. * Gets the value at the specified index.
  15. *
  16. * @param index The index of the component to get the value for.
  17. *
  18. * @return The float value at the specified index.
  19. */
  20. float getFloat(unsigned int index) const;
  21. /**
  22. * Sets the value at the specified index.
  23. *
  24. * @param index The index of the component to set the value for.
  25. * @param value The value to set the component to.
  26. */
  27. void setFloat(unsigned int index, float value);
  28. /**
  29. * Copies one or more float values from this AnimationValue into the specified array.
  30. *
  31. * @param index The index to start copying from.
  32. * @param values Pointer to float array to copy values into.
  33. * @param count Number of values to copy.
  34. */
  35. void getFloats(unsigned int index, float* values, unsigned int count) const;
  36. /**
  37. * Copies one or more float values into the AnimationValue.
  38. *
  39. * @param index The index of the first component to set the value for.
  40. * @param values Array of values to copy into the AnimationValue.
  41. * @param count Number of values to in the array to copy in.
  42. */
  43. void setFloats(unsigned int index, float* values, unsigned int count);
  44. private:
  45. /**
  46. * Constructor.
  47. */
  48. AnimationValue();
  49. /**
  50. * Constructor.
  51. */
  52. AnimationValue(unsigned int componentCount);
  53. /**
  54. * Constructor.
  55. */
  56. AnimationValue(const AnimationValue& copy);
  57. /**
  58. * Destructor.
  59. */
  60. ~AnimationValue();
  61. /**
  62. * Hidden copy assignment operator.
  63. */
  64. AnimationValue& operator=(const AnimationValue& v);
  65. unsigned int _componentCount; // The number of float values for the property.
  66. unsigned int _componentSize; // The number of bytes of memory the property is.
  67. float* _value; // The current value of the property.
  68. };
  69. }
  70. #endif