RedMixAnimationBakeModel.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // RedMixAnimationBakeModel.hpp
  3. // cocos2d_libs
  4. //
  5. // Created by Liang zhong on 2022/11/12.
  6. //
  7. #ifndef RedMixAnimationBakeModel_h
  8. #define RedMixAnimationBakeModel_h
  9. #include "RedAnimationBakeModel.h"
  10. #include "RedSpineBakeManage.h"
  11. #include <stdio.h>
  12. struct MIX_BAKE_FRAME_PLAY {
  13. bool slotCanBemixed;
  14. cocos2d::Texture2D *texture;
  15. BlendFunc blendFuc;
  16. cocos2d::TrianglesCommand::Triangles preTriangles;
  17. cocos2d::TrianglesCommand::Triangles nextTriangles;
  18. cocos2d::TrianglesCommand::Triangles currentTriangles;
  19. };
  20. struct link_Bone_Point{
  21. Point nextPos;
  22. Point prePos;
  23. };
  24. //x1+(x2-x1)currentFrame/totalFrame;
  25. class RedMixAnimationBakeModel:public RedAnimationBakeModel{
  26. public:
  27. static bool animationCanbeMix(std::string aPreAniName,std::string aNextAniName,std::string aFileName);
  28. ~RedMixAnimationBakeModel();
  29. bool setMixInfo(int currentFrame,float mixTime,const std::map<int,BKAE_FRAME_PLAY> aPreAniBakeFrame,std::string aNextAniName,std::string aPreAniName,std::string aFileName,Point aDis);
  30. bool isMixAnimation() override;
  31. int getSlotCount() override;
  32. cocos2d::Texture2D* getTexture(int slotIndex);
  33. BlendFunc getBlendFunc(int slotIndex);
  34. cocos2d::TrianglesCommand::Triangles getTriangles(int slotIndex,float aRealCurrentBakeFrame);
  35. RedAnimationBakeModel *getNextAnimation();
  36. std::vector<int> getMixBakeFrameArrAllKey();
  37. const Point& getABakeModePoint(std::string aName,int aFrame) override;
  38. private:
  39. RedAnimationBakeModel *nextAnimation = nullptr; //下一个要播放的动画
  40. RedAnimationBakeModel *preAnimation = nullptr; //下一个要播放的动画
  41. std::map<int,BKAE_FRAME_PLAY> preBakeFrameArr;
  42. std::map<int,BKAE_FRAME_PLAY> nextBakeFrameArr;
  43. std::map<int,MIX_BAKE_FRAME_PLAY> mixBakeFrameArr;
  44. std::map<std::string,link_Bone_Point> mixLinkBone;
  45. Point currentDisPos; //用来处理两个Node连接初始位子偏移问题
  46. Point currentBonePos; //当前骨骼位移,临时变量,防止getABakeModePoint自动释放pos用
  47. };
  48. #endif /* RedMixAnimationBakeModel_h */