[8342] | 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 | |
---|
[8526] | 14 | typedef enum MD3AnimationType { |
---|
[8525] | 15 | LEGS = 0, //!< animation only applicatble to the legs. top level model loaded from lower.md3 |
---|
| 16 | TORSO, //!< animation only applicatboe to the torso. normaly loaded from upper.md3 |
---|
| 17 | BOTH, //!< animation is applicable on both |
---|
| 18 | ALL, //!< animation is applicable to all submodels |
---|
[8342] | 19 | |
---|
[8525] | 20 | NUM_ANIMATION_TYPE //!< number of animations |
---|
| 21 | }; |
---|
[8342] | 22 | |
---|
[8525] | 23 | |
---|
[8526] | 24 | typedef struct MD3AnimationMap { |
---|
| 25 | std::string animationName; |
---|
| 26 | MD3AnimationType animationType; |
---|
| 27 | }; |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | |
---|
[8342] | 32 | /** |
---|
| 33 | * a class with metadata describing an MD3 model animation |
---|
| 34 | */ |
---|
| 35 | class MD3Animation |
---|
| 36 | { |
---|
| 37 | |
---|
| 38 | public: |
---|
[8351] | 39 | MD3Animation(); |
---|
| 40 | MD3Animation(std::string line); |
---|
| 41 | virtual ~MD3Animation(); |
---|
[8342] | 42 | |
---|
[8351] | 43 | void init(); |
---|
| 44 | |
---|
[8526] | 45 | std::string toString() |
---|
| 46 | { |
---|
| 47 | return std::string("Name: " + this->name); |
---|
| 48 | } |
---|
[8342] | 49 | |
---|
| 50 | |
---|
| 51 | public: |
---|
[8526] | 52 | MD3AnimationType type; //!< specifies for what parts of a model this animation is appilcable (e.g. LEGS) |
---|
| 53 | std::string name; //!< name of the animation |
---|
[8342] | 54 | |
---|
[8526] | 55 | int offset; //!< for LEGS animation, this is the offset value to skip TORSO frames |
---|
| 56 | int first; //!< first frame |
---|
| 57 | int numFrames; //!< the number of frames in the anumation. < 0 means that all available frames used |
---|
| 58 | int numLoopFrames; //!< number of looping frames |
---|
| 59 | int fps; //!< frames per second |
---|
[8342] | 60 | |
---|
[8526] | 61 | static MD3AnimationMap animationList[25]; //!< the animation list |
---|
[8342] | 62 | }; |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | #endif /* _MD3_ANIMATION_H */ |
---|