| 1 | /*! | 
|---|
| 2 |  * @file md3_animation.h | 
|---|
| 3 |  * | 
|---|
| 4 |  * Code heavely inspired by: JAVA MD3 Model Viewer - A Java based Quake 3 model viewer | 
|---|
| 5 |  * Copyright (C) 1999 Erwin 'KLR8' Vervaet | 
|---|
| 6 |  */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef _MD3_ANIMATION_H | 
|---|
| 9 | #define _MD3_ANIMATION_H | 
|---|
| 10 |  | 
|---|
| 11 | #include <string> | 
|---|
| 12 |  | 
|---|
| 13 | namespace md3 | 
|---|
| 14 | { | 
|---|
| 15 |  | 
|---|
| 16 | typedef enum MD3AnimationType { | 
|---|
| 17 |   LEGS      = 0,             //!< animation only applicatble to the legs. top level model loaded from lower.md3 | 
|---|
| 18 |   TORSO,                     //!< animation only applicatboe to the torso. normaly loaded from upper.md3 | 
|---|
| 19 |   BOTH,                      //!< animation is applicable on both | 
|---|
| 20 |   ALL,                       //!< animation is applicable to all submodels | 
|---|
| 21 |  | 
|---|
| 22 |   NUM_ANIMATION_TYPE         //!< number of animations | 
|---|
| 23 | }; | 
|---|
| 24 |  | 
|---|
| 25 |  | 
|---|
| 26 | typedef struct MD3AnimationMap { | 
|---|
| 27 |   std::string        animationName; | 
|---|
| 28 |   MD3AnimationType   animationType; | 
|---|
| 29 | }; | 
|---|
| 30 |  | 
|---|
| 31 |  | 
|---|
| 32 |  | 
|---|
| 33 |  | 
|---|
| 34 | /** | 
|---|
| 35 |  * a class with metadata describing an MD3 model animation | 
|---|
| 36 |  */ | 
|---|
| 37 | class MD3Animation | 
|---|
| 38 | { | 
|---|
| 39 |  | 
|---|
| 40 |   public: | 
|---|
| 41 |     MD3Animation(); | 
|---|
| 42 |     virtual ~MD3Animation(); | 
|---|
| 43 |  | 
|---|
| 44 |     void init(); | 
|---|
| 45 |  | 
|---|
| 46 |     std::string toString() { return std::string("Name: " + this->name); } | 
|---|
| 47 |  | 
|---|
| 48 |  | 
|---|
| 49 |   public: | 
|---|
| 50 |     MD3AnimationType      type;                      //!< specifies for what parts of a model this animation is appilcable (e.g. LEGS) | 
|---|
| 51 |     std::string           name;                      //!< name of the animation | 
|---|
| 52 |  | 
|---|
| 53 |     int                   offset;                    //!< for LEGS animation, this is the offset value to skip TORSO frames | 
|---|
| 54 |     int                   first;                     //!< first frame | 
|---|
| 55 |     int                   numFrames;                 //!< the number of frames in the anumation. < 0 means that all available frames used | 
|---|
| 56 |     int                   numLoopFrames;             //!< number of looping frames | 
|---|
| 57 |     int                   fps;                       //!< frames per second | 
|---|
| 58 |  | 
|---|
| 59 |     static MD3AnimationMap animationList[25];         //!< the animation list | 
|---|
| 60 | }; | 
|---|
| 61 |  | 
|---|
| 62 | } | 
|---|
| 63 | #endif /* _MD3_ANIMATION_H */ | 
|---|