00001 #ifndef ANIMATEDMODEL_NFW342
00002 #define ANIMATEDMODEL_NFW342
00003
00004 #include "global.h"
00005 #include "SkinnedModel.h"
00006 #include "keyframes.h"
00007 class AnimationSet;
00008
00030 class AnimatedModel : public SkinnedModel {
00031 public:
00032 AnimatedModel( const std::string& modelName );
00033
00037 ~AnimatedModel();
00038
00044 int findSet( const std::string& setName ) const;
00045
00049 int getNumSets() const;
00050
00056 const std::string& getSetName( int setIdx ) const;
00057
00065 int findAnim( int setIdx, const std::string& animName ) const;
00066
00072 int getNumAnims( int setIdx ) const;
00073
00082 const std::string& getAnimName( int setIdx, int animIdx ) const;
00083
00091 int getActiveAnim( int setIdx ) const;
00092
00101 void setActiveAnim( int setIdx, int animIdx );
00102
00110 void setLooping( int setIdx, bool looping );
00111
00119 bool isLooping( int setIdx ) const;
00120
00126 void update( float dt );
00127
00128 private:
00129 void loadAnimations( LPDIRECTXFILEDATA xObj, const std::string& modelName );
00130 void loadSingleAnim( AKeysList& keysList, LPDIRECTXFILEDATA xObj );
00131 void loadSingleKeySet( AnimationKeys& keysList, void* dataPtr, DWORD keyType, DWORD keyCount );
00132
00133 void parseAnmFile( AKeysList& keysList, const std::string& modelName );
00134 AnimationSet* parseAsLine( std::istringstream& line );
00135 void parseBlLine( std::istringstream& line, BoneNameSet& boneSet );
00136
00137 void parseAnLine( std::istringstream& line, AKeysList& keysList, BoneNameSet& boneSet, AnimationSet& aSet );
00138
00142 void cleanUp();
00143
00144 typedef std::vector<AnimationSet*> ASetList;
00145 typedef ASetList::iterator ASetListIter;
00146 typedef ASetList::const_iterator ASetListCIter;
00147
00148 ASetList aSets;
00149 };
00150
00151 #endif
00152