| 1 | /*! |
|---|
| 2 | * @file md_model_structure.h |
|---|
| 3 | */ |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | #ifndef _MD3_MODEL_STRUCTURE_H |
|---|
| 8 | #define _MD3_MODEL_STRUCTURE_H |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | #include "vector.h" |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | //! compressed vertex data: char insetead of float, the value will be expanded by the scale value. only for loading |
|---|
| 15 | typedef struct |
|---|
| 16 | { |
|---|
| 17 | unsigned char v[3]; //!< the vector of the vertex |
|---|
| 18 | unsigned char lightNormalIndex; //!< the index of the light normal |
|---|
| 19 | } sVertex; |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | //! compressed texture offset data: coords scaled by the texture size. Only for loading |
|---|
| 23 | typedef struct |
|---|
| 24 | { |
|---|
| 25 | short s; //!< the s,t coordinates of a texture |
|---|
| 26 | short t; //!< the s,t coordinates of a texture |
|---|
| 27 | } sTexCoor; |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | //! holds tha informations about a md2 frame |
|---|
| 31 | typedef struct |
|---|
| 32 | { |
|---|
| 33 | sVec3D scale; //!< scales values of the model |
|---|
| 34 | sVec3D translate; //!< translates the model |
|---|
| 35 | char name[16]; //!< frame name: something like "run32" |
|---|
| 36 | sVertex pVertices[1]; //!< first vertex of thes frame |
|---|
| 37 | } sFrame; |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | //! holds the information about a triangle |
|---|
| 41 | typedef struct |
|---|
| 42 | { |
|---|
| 43 | unsigned short indexToVertices[3]; //!< index to the verteces of the triangle |
|---|
| 44 | unsigned short indexToTexCoor[3]; //!< index to the texture coordinates |
|---|
| 45 | } sTriangle; |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | //! the command list of the md2 model, very md2 specific |
|---|
| 50 | typedef struct |
|---|
| 51 | { |
|---|
| 52 | float s; //!< texture coordinate 1 |
|---|
| 53 | float t; //!< texture coordinate 2 |
|---|
| 54 | int vertexIndex; //!< index of the vertex in the vertex list |
|---|
| 55 | } glCommandVertex; |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | //! a md2 animation definition |
|---|
| 59 | typedef struct |
|---|
| 60 | { |
|---|
| 61 | int firstFrame; //!< first frame of the animation |
|---|
| 62 | int lastFrame; //!< last frame of the animation |
|---|
| 63 | int fps; //!< speed: number of frames per second |
|---|
| 64 | int bStoppable; //!< 1 if the animation is stoppable 0 else |
|---|
| 65 | } sAnim; |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | //! animation state definition |
|---|
| 69 | typedef struct |
|---|
| 70 | { |
|---|
| 71 | int startFrame; //!< the start frame of an animation |
|---|
| 72 | int endFrame; //!< last frame of the animation |
|---|
| 73 | int fps; //!< fps of the animaion (speed) |
|---|
| 74 | |
|---|
| 75 | float localTime; //!< the local time |
|---|
| 76 | float lastTime; //!< last time stamp |
|---|
| 77 | float interpolationState; //!< the state of the animation [0..1] |
|---|
| 78 | |
|---|
| 79 | int type; //!< animation type |
|---|
| 80 | |
|---|
| 81 | int currentFrame; //!< the current frame |
|---|
| 82 | int nextFrame; //!< the next frame in the list |
|---|
| 83 | int numPlays; //!< the number of times, this has been played in series |
|---|
| 84 | |
|---|
| 85 | int animPlaybackMode; //!< the playback mode |
|---|
| 86 | } sAnimState; |
|---|
| 87 | |
|---|
| 88 | #endif /* _MD3_MODEL_STRUCTURE_H */ |
|---|