// // RedMixAnimationBakeModel.hpp // cocos2d_libs // // Created by Liang zhong on 2022/11/12. // #ifndef RedMixAnimationBakeModel_h #define RedMixAnimationBakeModel_h #include "RedAnimationBakeModel.h" #include "RedSpineBakeManage.h" #include struct MIX_BAKE_FRAME_PLAY { bool slotCanBemixed; cocos2d::Texture2D *texture; BlendFunc blendFuc; cocos2d::TrianglesCommand::Triangles preTriangles; cocos2d::TrianglesCommand::Triangles nextTriangles; cocos2d::TrianglesCommand::Triangles currentTriangles; }; struct link_Bone_Point{ Point nextPos; Point prePos; }; //x1+(x2-x1)currentFrame/totalFrame; class RedMixAnimationBakeModel:public RedAnimationBakeModel{ public: static bool animationCanbeMix(std::string aPreAniName,std::string aNextAniName,std::string aFileName); ~RedMixAnimationBakeModel(); bool setMixInfo(int currentFrame,float mixTime,const std::map aPreAniBakeFrame,std::string aNextAniName,std::string aPreAniName,std::string aFileName,Point aDis); bool isMixAnimation() override; int getSlotCount() override; cocos2d::Texture2D* getTexture(int slotIndex); BlendFunc getBlendFunc(int slotIndex); cocos2d::TrianglesCommand::Triangles getTriangles(int slotIndex,float aRealCurrentBakeFrame); RedAnimationBakeModel *getNextAnimation(); std::vector getMixBakeFrameArrAllKey(); const Point& getABakeModePoint(std::string aName,int aFrame) override; private: RedAnimationBakeModel *nextAnimation = nullptr; //下一个要播放的动画 RedAnimationBakeModel *preAnimation = nullptr; //下一个要播放的动画 std::map preBakeFrameArr; std::map nextBakeFrameArr; std::map mixBakeFrameArr; std::map mixLinkBone; Point currentDisPos; //用来处理两个Node连接初始位子偏移问题 Point currentBonePos; //当前骨骼位移,临时变量,防止getABakeModePoint自动释放pos用 }; #endif /* RedMixAnimationBakeModel_h */