- Cal3D 0.11 API Reference -

morphtargetmixer.h
1//****************************************************************************//
2// morphtargetmixer.h //
3// Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger //
4// 2008 Erik Johnson
5//****************************************************************************//
6// This library is free software; you can redistribute it and/or modify it //
7// under the terms of the GNU Lesser General Public License as published by //
8// the Free Software Foundation; either version 2.1 of the License, or (at //
9// your option) any later version. //
10//****************************************************************************//
11
12#ifndef CAL_MORPHTARGETMIXER_H
13#define CAL_MORPHTARGETMIXER_H
14
15
16#include "cal3d/global.h"
17#include <cal3d/coremorphkeyframe.h>
18#include <cal3d/coreanimatedmorph.h>
19
20class CalModel;
21
22
23class CAL3D_API CalMorphTargetMixer
24{
25public:
28
29 bool blend(int id, float weight, float delayIn, float delayOut, bool looping);
30 bool manualBlend(int id, float weight, float time);
31 bool clear(int id, float delay);
32 bool copy( const CalMorphTargetMixer& inOther );
33 float getCurrentWeight(int id) const;
34 //float getCurrentWeightBase() const;
35 const std::string& getMorphName(int id) const;
36 int getTrackCount(int id) const;
37 const std::list<CalCoreMorphTrack>& getMorphTracks(int id) const;
38 int getKeyframeCount(int id) const;
39 float getDuration(int id) const;
40 int getMorphTargetCount() const;
41 void update(float deltaTime);
42
43 float CalcKeyframeWeight(const std::vector<CalCoreMorphKeyframe> &keyframes, float elapsedTime);
44private:
45
46 struct MorphAnimData
47 {
48 bool isManual;
49 int animatedMorphID;
50
51 float weight;
52 bool looping;
53
54 float playTime;
55 float currentWeight;
56 float fadeIn;
57 float fadeInTime;
58 float fadeOut;
59 float fadeOutTime;
60 };
61
62 std::vector<MorphAnimData> mAnimList;
63
64 CalModel *m_pModel;
65
66 void SetTrackWeights(const CalCoreAnimatedMorph& morph, MorphAnimData& data);
67
68};
69
70#endif
71
72//****************************************************************************//
The core animatedMorph class.
Definition coreanimatedmorph.h:37
Definition model.h:31
float getDuration(int id) const
Get the duration of a morph target.
Definition morphtargetmixer.cpp:336
const std::string & getMorphName(int id) const
Get the name of a morph target animation.
Definition morphtargetmixer.cpp:253
int getKeyframeCount(int id) const
Get the number of keyframes for a morph target.
Definition morphtargetmixer.cpp:307
bool blend(int id, float weight, float delayIn, float delayOut, bool looping)
Interpolates the morph target weights based on an animation.
Definition morphtargetmixer.cpp:111
void update(float deltaTime)
Updates all morph targets.
Definition morphtargetmixer.cpp:375
int getMorphTargetCount() const
Returns the number of morph targets this morph target mixer mixes.
Definition morphtargetmixer.cpp:459
CalMorphTargetMixer(CalModel *model)
Constructs the morph target mixer instance.
Definition morphtargetmixer.cpp:34
int getTrackCount(int id) const
Get the number of tracks for a morph target.
Definition morphtargetmixer.cpp:271
bool copy(const CalMorphTargetMixer &inOther)
Copy data from one mixer (for the same core model) to another.
Definition morphtargetmixer.cpp:353
float getCurrentWeight(int id) const
Get the weight of a morph target.
Definition morphtargetmixer.cpp:230
const std::list< CalCoreMorphTrack > & getMorphTracks(int id) const
Get the tracks for a morph target.
Definition morphtargetmixer.cpp:289
bool clear(int id, float delay)
Fades a morph target out.
Definition morphtargetmixer.cpp:167
bool manualBlend(int id, float weight, float time)
Interpolates the morph target weights based on an animation.
Definition morphtargetmixer.cpp:53

Generated by The Cal3D Team with Doxygen 1.13.1