00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef CAL_MORPHTARGETMIXER_H
00013 #define CAL_MORPHTARGETMIXER_H
00014
00015
00016 #include "cal3d/global.h"
00017 #include <cal3d/coremorphkeyframe.h>
00018 #include <cal3d/coreanimatedmorph.h>
00019
00020 class CalModel;
00021
00022
00023 class CAL3D_API CalMorphTargetMixer
00024 {
00025 public:
00026 CalMorphTargetMixer(CalModel *model);
00027 ~CalMorphTargetMixer() { }
00028
00029 bool blend(int id, float weight, float delayIn, float delayOut, bool looping);
00030 bool manualBlend(int id, float weight, float time);
00031 bool clear(int id, float delay);
00032 bool copy( const CalMorphTargetMixer& inOther );
00033 float getCurrentWeight(int id) const;
00034
00035 const std::string& getMorphName(int id) const;
00036 int getTrackCount(int id) const;
00037 const std::list<CalCoreMorphTrack>& getMorphTracks(int id) const;
00038 int getKeyframeCount(int id) const;
00039 float getDuration(int id) const;
00040 int getMorphTargetCount() const;
00041 void update(float deltaTime);
00042
00043 float CalcKeyframeWeight(const std::vector<CalCoreMorphKeyframe> &keyframes, float elapsedTime);
00044 private:
00045
00046 struct MorphAnimData
00047 {
00048 bool isManual;
00049 int animatedMorphID;
00050
00051 float weight;
00052 bool looping;
00053
00054 float playTime;
00055 float currentWeight;
00056 float fadeIn;
00057 float fadeInTime;
00058 float fadeOut;
00059 float fadeOutTime;
00060 };
00061
00062 std::vector<MorphAnimData> mAnimList;
00063
00064 CalModel *m_pModel;
00065
00066 void SetTrackWeights(const CalCoreAnimatedMorph& morph, MorphAnimData& data);
00067
00068 void ApplyWeightToMorphMesh(const std::string &morphMeshName, float trackWeight);
00069 };
00070
00071 #endif
00072
00073