[C++] The IN55 project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.5KB

  1. #ifndef __ANIMATION_H__
  2. #define __ANIMATION_H__
  3. #include <assimp/cimport.h>
  4. #include <assimp/scene.h>
  5. #include <assimp/postprocess.h>
  6. //#include <vertice.h>
  7. //#include <bone.h>
  8. //#include <interpolation.h>
  9. //#include <keyframe.h>
  10. #include <boneAnim.h>
  11. class Animation
  12. {
  13. private:
  14. BoneAnim **listBoneAnim;
  15. int nbBoneAnim;
  16. int currentindex;
  17. float animationTime;
  18. float ticksPerSecond;
  19. public:
  20. Animation(int nbBone, float t, float tps){
  21. nbBoneAnim = nbBone;
  22. animationTime = t;
  23. ticksPerSecond = tps;
  24. listBoneAnim = (BoneAnim**) malloc(nbBone*sizeof(BoneAnim*));
  25. currentindex=0;
  26. };
  27. void addBoneAnim(BoneAnim *bone){
  28. if(currentindex < nbBoneAnim){
  29. listBoneAnim[currentindex] = bone;
  30. currentindex++;
  31. }
  32. }
  33. BoneAnim* getBoneAnim(const aiString &boneName){
  34. int i=0;
  35. while ( i < nbBoneAnim && listBoneAnim[i]->getName() != boneName) {
  36. i++;
  37. }
  38. if (i < nbBoneAnim) {
  39. return listBoneAnim[i];
  40. } else {
  41. return NULL;
  42. }
  43. }
  44. float getDuration() { return animationTime; };
  45. float getTicksPerSecond() { return ticksPerSecond; };
  46. BoneAnim** getBonesAnims(){
  47. return listBoneAnim;
  48. }
  49. int getNbBonesAnim(){
  50. return nbBoneAnim;
  51. }
  52. };
  53. #endif