2 #include "IAttributeFields.h" 16 AnimIndex():nIndex(-1), Provider(0), nCurrentFrame(0), nStartFrame(0), nEndFrame(0),loopType(0),nAnimID(0),nFramePlayed(0) {}
17 AnimIndex(
int nIndex_):nIndex(nIndex_), Provider(0), nCurrentFrame(0), nStartFrame(0), nEndFrame(0),loopType(0),nAnimID(0),nFramePlayed(0){}
18 AnimIndex(
int nIndex_, byte nProvider_):nIndex(nIndex_), Provider(nProvider_), nCurrentFrame(0), nStartFrame(0), nEndFrame(0),loopType(0),nAnimID(0),nFramePlayed(0){}
19 AnimIndex(
int nIndex_, byte nProvider_,
int nStartFrame_,
int nEndFrame_, byte loopType_):nIndex(nIndex_), Provider(nProvider_), nCurrentFrame(nStartFrame_), nStartFrame(nStartFrame_), nEndFrame(nEndFrame_),loopType(loopType_),nAnimID(0),nFramePlayed(0){}
20 AnimIndex(
int nIndex_, byte nProvider_,
int nStartFrame_,
int nEndFrame_, byte loopType_,
int nAnimID):nIndex(nIndex_), Provider(nProvider_), nCurrentFrame(nStartFrame_), nStartFrame(nStartFrame_), nEndFrame(nEndFrame_),loopType(loopType_),nAnimID(nAnimID),nFramePlayed(0){}
23 bool IsValid()
const {
return nIndex != -1;}
26 bool operator==(
const AnimIndex& right)
const {
return (this->nIndex == right.nIndex) && (this->Provider == right.Provider) && (this->loopType == right.loopType);}
27 bool operator!=(
const AnimIndex& right)
const {
return (this->nIndex != right.nIndex) || (this->Provider != right.Provider) || ((this->loopType != right.loopType));}
36 void Reset() {nCurrentFrame = nStartFrame;nFramePlayed=0;};
42 void AddCycle(){ nFramePlayed += (nEndFrame-nStartFrame);}
77 ATTRIBUTE_METHOD1(
CAnimInstanceBase, GetRenderCount_s,
int*) { *p1 = cls->GetRenderCount();
return S_OK; }
78 ATTRIBUTE_METHOD1(
CAnimInstanceBase, SetRenderCount_s,
int) { cls->SetRenderCount(p1);
return S_OK; }
80 ATTRIBUTE_METHOD1(
CAnimInstanceBase, IsAnimIDMapEnabled_s,
bool*) { *p1 = cls->IsAnimIDMapEnabled();
return S_OK; }
81 ATTRIBUTE_METHOD1(
CAnimInstanceBase, EnableAnimIDMap_s,
bool) { cls->EnableAnimIDMap(p1);
return S_OK; }
83 ATTRIBUTE_METHOD(
CAnimInstanceBase, ResetAnimation_s) { cls->ResetAnimation();
return S_OK; }
85 ATTRIBUTE_METHOD1(
CAnimInstanceBase, GetCurrentAnimation_s,
int*) { *p1 = cls->GetCurrentAnimation();
return S_OK; }
87 ATTRIBUTE_METHOD1(
CAnimInstanceBase, ShowMesh_s, DWORD) { cls->ShowMesh(p1);
return S_OK; }
89 ATTRIBUTE_METHOD1(
CAnimInstanceBase, GetSizeScale_s,
float*) { *p1 = cls->GetSizeScale();
return S_OK; }
90 ATTRIBUTE_METHOD1(
CAnimInstanceBase, SetSizeScale_s,
float) { cls->SetSizeScale(p1);
return S_OK; }
92 ATTRIBUTE_METHOD1(
CAnimInstanceBase, GetSpeedScale_s,
float*) { *p1 = cls->GetSpeedScale();
return S_OK; }
93 ATTRIBUTE_METHOD1(
CAnimInstanceBase, SetSpeedScale_s,
float) { cls->SetSpeedScale(p1);
return S_OK; }
95 ATTRIBUTE_METHOD1(
CAnimInstanceBase, IsUseGlobalTime_s,
bool*) { *p1 = cls->IsUseGlobalTime();
return S_OK; }
96 ATTRIBUTE_METHOD1(
CAnimInstanceBase, SetUseGlobalTime_s,
bool) { cls->SetUseGlobalTime(p1);
return S_OK; }
98 ATTRIBUTE_METHOD1(
CAnimInstanceBase, GetAnimFrame_s,
int*) { *p1 = cls->GetAnimFrame();
return S_OK; }
99 ATTRIBUTE_METHOD1(
CAnimInstanceBase, SetAnimFrame_s,
int) { cls->SetAnimFrame(p1);
return S_OK; }
101 ATTRIBUTE_METHOD1(
CAnimInstanceBase, IsAnimationEnabled_s,
bool*) { *p1 = cls->IsAnimationEnabled();
return S_OK; }
102 ATTRIBUTE_METHOD1(
CAnimInstanceBase, EnableAnimation_s,
bool) { cls->EnableAnimation(p1);
return S_OK; }
137 virtual int GetRenderCount();
138 virtual void SetRenderCount(
int nCount);
143 void EnableAnimIDMap(
bool bEnable);
148 bool IsAnimIDMapEnabled();
156 map<int, int>* GetAnimIDMap();
161 void ApplyLocalTransformToVec1(
float *pOut,
float* pV);
173 virtual void LoadAnimation(
const char * sName,
float * fSpeed,
bool bAppend =
false);
174 virtual void LoadAnimation(
int nAnimID,
float * fSpeed,
bool bAppend =
false);
175 virtual void LoadDefaultStandAnim(
float * fSpeed);
176 virtual void LoadDefaultWalkAnim(
float * fSpeed);
179 virtual bool HasAnimId(
int nAnimID);
183 virtual int GetCurrentAnimation();
187 virtual void ResetAnimation();
190 virtual void SetModelColor(
LinearColor modelColor);
193 virtual void ShowMesh(BOOL bShow,
int nIndex);
194 virtual void ShowMesh(DWORD dwBitfields);
197 virtual void SetLocalTransform(
Matrix4 mXForm);
200 virtual void AdvanceTime(
double dTimeDelta );
205 virtual void Animate(
double dTimeDelta,
int nRenderNumber=0 );
215 virtual void SetSizeScale(
float fScale);
217 virtual float GetSizeScale();
224 virtual void GetCurrentSize(
float * fWidth,
float * fDepth);
228 virtual void SetSpeedScale(
float fScale );
233 virtual float GetSpeedScale();
236 virtual void GetCurrentSpeed (
float* fSpeed);
239 virtual void GetSpeedOf(
const char * sName,
float * fSpeed);
246 virtual void SetUseGlobalTime(
bool bUseGlobalTime);
253 virtual bool IsUseGlobalTime();
258 virtual void SetAnimFrame(
int nFrame);
261 virtual int GetAnimFrame();
266 virtual void SetBlendingFactor(
float fBlendingFactor);
269 virtual bool HasAnimation(
int nAnimID);
274 virtual bool HasAlphaBlendedObjects();
277 virtual int GetValidAnimID(
int nAnimID);
280 void EnableAnimation(
bool bAnimated);
281 bool IsAnimationEnabled()
const;
bool m_bEnableAnimIDMap
whether the m_mapAnimIDs will be used.
Definition: AnimInstanceBase.h:128
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
ShadowVolume is a structure for storing shadow volume geometries.
Definition: ShadowVolume.h:39
It's used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
bool IsLooping() const
whether use looping
Definition: AnimInstanceBase.h:30
void MakeInvalid()
make this instance invalid.
Definition: AnimInstanceBase.h:39
abstract class for all animation instance implementation.
Definition: AnimInstanceBase.h:66
different physics engine has different winding order.
Definition: EventBinding.h:32
void AddCycle()
add total frames to nFramePlayed.
Definition: AnimInstanceBase.h:42
float m_fSizeScale
scale parameters
Definition: AnimInstanceBase.h:115
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
LightParams is a structure for which a shadow volume is built.
Definition: ShadowVolume.h:8
bool IsValid() const
whether index is valid
Definition: AnimInstanceBase.h:23
bool IsUndetermined() const
if animation is undetermined, we should refresh this structure from asset, possibly because the anima...
Definition: AnimInstanceBase.h:33
LinearColor m_modelColor
color of this model
Definition: AnimInstanceBase.h:107
Matrix4 m_mxLocalTransform
mesh local world xform: center in the origin
Definition: AnimInstanceBase.h:113
bool m_bEnableAnimation
whether animation is enabled, true by default.
Definition: AnimInstanceBase.h:130
bool operator==(const AnimIndex &right) const
two index are considered equal if nIndex and Provider are the same.
Definition: AnimInstanceBase.h:26
int m_nRenderCount
the last render frame count that this object is rendered.
Definition: AnimInstanceBase.h:118
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
it presents a given in bone animation providers or parax local model bone animation pools ...
Definition: AnimInstanceBase.h:13
A common interface for all classes implementing IAttributeFields By implementing this class's virtual...
Definition: IAttributeFields.h:59
virtual void GetCurrentRadius(float *fRadius)
normally this will read the radius of the current animation and calculate the correct size after scal...
Definition: AnimInstanceBase.h:221
map< int, int > m_mapAnimIDs
a mapping from one animation ID to another ID.
Definition: AnimInstanceBase.h:125
void Reset()
set the current frame to the start frame
Definition: AnimInstanceBase.h:36
A linear, 32-bit/component floating point RGBA color.
Definition: ParaColor.h:12
a list of CParameter{name, value} pairs of anything.
Definition: ParameterBlock.h:108