My Project
MdxAnimInstance.h
1 //-----------------------------------------------------------------------------
2 // File: MultiAnimation.h
3 //
4 // Desc: Header file for the MultiAnimation library. This contains the
5 // declarations of
6 //
7 // MultiAnimFrame (no .cpp file)
8 // MultiAnimMC (MultiAnimationLib.cpp)
9 // CMultiAnimAllocateHierarchy (AllocHierarchy.cpp)
10 // CMultiAnim (MultiAnimationLib.cpp)
11 // CAnimInstance (AnimationInstance.cpp)
12 //
13 // Copyright (c) Microsoft Corporation. All rights reserved
14 //-----------------------------------------------------------------------------
15 #pragma once
16 #include "BaseObject.h"
17 #include "mdxfile/ModelUtils.h"
18 #include "AnimInstanceBase.h"
19 
20 namespace ParaEngine
21 {
24 {
25 public:
26  int nCurrentAnim;
28  int nNextAnim;
29  int currentFrame; // an absolute MDX frame
30  int blendingAnim;
31  int blendingFrame; // an absolute MDX frame with which the current motion is blended
32  float blendingFactor; // [0,1), blendingFrame*(blendingFactor)+(1-blendingFactor)*currentFrame
33 
35  DWORD dwShowMeshes;
36 
37 public:
39  {
40  nCurrentAnim = 0;
41  nNextAnim = -1;
42  currentFrame = -1;
43  blendingAnim = -1;
44  blendingFrame = 0;
45  blendingFactor = 0;
47  dwShowMeshes = 0xffffffff;
48  };
49 
50  void ShowMesh(BOOL bShow, int nIndex)
51  {
52  if(bShow)
53  dwShowMeshes = dwShowMeshes | (0x1<<nIndex);
54  else
55  dwShowMeshes = dwShowMeshes & (~(0x1<<nIndex));
56  };
57 };
58 
59 struct MDXEntity;
60 class ShadowVolume;
61 struct LightParams;
69 {
70 public:
71  CMdxAniInstance(void);
72  ~CMdxAniInstance(void);
73 
76 
78  MDXEntity* m_ppModel;
79 public:
80  void CopyAnimInfoToParaXModel();
81  void SaveAnimInfoFromParaXModel();
82 
83 public:
84  // -- for init and delete
85  HRESULT InitObject(MDXEntity* ppModel);
86  AssetEntity* GetPrimaryAsset(){return (AssetEntity*)m_ppModel;}; // used as KEY for batch rendering
87 
88  // -- CAnimInstanceBase virtual functions
89 
100  virtual void LoadAnimation(const char * sName, float * fSpeed,bool bAppend = false);
101  virtual void LoadAnimation(int nIndexAnim, float * fSpeed,bool bAppend = false);
102  virtual void LoadDefaultStandAnim(float * fSpeed);
103  virtual void LoadDefaultWalkAnim(float * fSpeed);
104 
105 
108  virtual void ShowMesh(BOOL bShow, int nIndex);
109  virtual void ShowMesh(DWORD dwBitfields);
110 
112  virtual void AdvanceTime( double dTimeDelta );
115  virtual HRESULT Draw( SceneState * sceneState, const Matrix4* mxWorld);
116  virtual void BuildShadowVolume(SceneState * sceneState, ShadowVolume * pShadowVolume, LightParams* pLight, Matrix4* mxWorld);
117 
119  virtual void SetSizeScale(float fScale);
122  virtual void GetCurrentRadius(float* fRadius);
125  virtual void GetCurrentSize(float * fWidth, float * fDepth);
127  virtual void SetSpeedScale( float fScale );
130  virtual void GetCurrentSpeed (float* fSpeed);
133  virtual void GetSpeedOf(const char * sName, float * fSpeed);
134 };
135 }
Animation instance that each mdx object owns.
Definition: MdxAnimInstance.h:23
ShadowVolume is a structure for storing shadow volume geometries.
Definition: ShadowVolume.h:39
It&#39;s used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
AnimInstance m_aiAnimIntance
MDX animation instance struct.
Definition: MdxAnimInstance.h:75
abstract class for all animation instance implementation.
Definition: AnimInstanceBase.h:66
different physics engine has different winding order.
Definition: EventBinding.h:32
LightParams is a structure for which a shadow volume is built.
Definition: ShadowVolume.h:8
int nNextAnim
-1 to use the default one
Definition: MdxAnimInstance.h:28
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
AnimInstance()
Definition: MdxAnimInstance.h:38
DWORD dwShowMeshes
bit field, the lowest bits is the first mesh, default to 0xffffffff
Definition: MdxAnimInstance.h:35
MDX file based Animation instance: must call SetSizeScale() at least once before drawing this object...
Definition: MdxAnimInstance.h:68
Base class for managed asset entity in ParaEngine.
Definition: AssetEntity.h:25
MDXEntity * m_ppModel
– 3d device objects
Definition: MdxAnimInstance.h:78