[8342] | 1 | /*! |
---|
[8343] | 2 | * @file md3_model.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 | */ |
---|
[8342] | 7 | |
---|
[8343] | 8 | #ifndef _MD3_MODEL_H |
---|
| 9 | #define _MD3_MODEL_H |
---|
[8342] | 10 | |
---|
[8343] | 11 | #include <string> |
---|
[8439] | 12 | #include "interactive_model.h" |
---|
[8342] | 13 | |
---|
| 14 | |
---|
[8351] | 15 | namespace md3 |
---|
| 16 | { |
---|
| 17 | |
---|
[8354] | 18 | |
---|
[8357] | 19 | class MD3Data; |
---|
[8551] | 20 | class MD3BoneFrame; |
---|
[8552] | 21 | class MD3Mesh; |
---|
[8553] | 22 | class MD3Tag; |
---|
[8591] | 23 | class MD3AnimationCfg; |
---|
[8553] | 24 | |
---|
[8552] | 25 | struct MD3Normal; |
---|
[8357] | 26 | |
---|
[8552] | 27 | |
---|
[8439] | 28 | class MD3Model : public InteractiveModel |
---|
[8342] | 29 | { |
---|
| 30 | |
---|
[8343] | 31 | public: |
---|
[8353] | 32 | MD3Model(std::string filename, float scaling); |
---|
[8343] | 33 | ~MD3Model(); |
---|
[8342] | 34 | |
---|
[8439] | 35 | virtual void setAnimation(int animNum, int playbackMode = 0) {} |
---|
[8342] | 36 | |
---|
[8563] | 37 | virtual void tick(float dt); |
---|
[8565] | 38 | virtual void draw() const; |
---|
[8549] | 39 | |
---|
| 40 | |
---|
[8343] | 41 | private: |
---|
[8579] | 42 | |
---|
| 43 | void autoAssemblePlayerModel(std::string filename, float scaling); |
---|
| 44 | |
---|
[8565] | 45 | void draw(MD3Data* data) const; |
---|
[8563] | 46 | void tick(float dt, MD3Data* data); |
---|
[8550] | 47 | |
---|
[8565] | 48 | void drawMesh(MD3Mesh* mesh, sVec3D* frame) const; |
---|
| 49 | void drawVertexNormals(sVec3D* frame, MD3Normal* normals) const; |
---|
| 50 | void drawBoneFrame(MD3BoneFrame* frame) const; |
---|
[8552] | 51 | |
---|
[8634] | 52 | MD3BoneFrame* interpolateBoneFrame(MD3Data* data, MD3BoneFrame* currBoneFrame, MD3BoneFrame* nextBoneFrame, float frac); |
---|
| 53 | sVec3D* interpolateMeshFrame(MD3Data* data, sVec3D* currMeshFrame, sVec3D* nextMeshFrame, float frac, MD3Mesh* mesh, int i); |
---|
| 54 | MD3Normal* interpolateVertexNormals(MD3Data* data, MD3Normal* curNormals, MD3Normal* nextNormals, float frac, MD3Mesh* mesh, int i); |
---|
| 55 | float* interpolateTransformation(MD3Data* data, MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac, int i); |
---|
[8552] | 56 | |
---|
[8550] | 57 | private: |
---|
[8354] | 58 | MD3Data* md3Data; //!< reference to the md3 model data |
---|
[8549] | 59 | |
---|
| 60 | bool bDrawBones; //!< draws the bone frames too |
---|
[8552] | 61 | bool bDrawNormals; //!< draw the normals |
---|
[8556] | 62 | |
---|
[8597] | 63 | MD3AnimationCfg* config; //!< the config file parsed |
---|
| 64 | |
---|
[8565] | 65 | |
---|
[8357] | 66 | }; |
---|
[8354] | 67 | |
---|
[8351] | 68 | } |
---|
[8342] | 69 | |
---|
[8343] | 70 | #endif /* _MD3_MODEL_H */ |
---|