Changeset 4073 in orxonox.OLD for orxonox/branches/md2_loader/src/lib
- Timestamp:
- May 6, 2005, 1:08:50 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.h
r4072 r4073 5 5 We are deeply thankfull for all the wunderfull things id software made for us gamers! 6 6 7 The md2 file format is structured in a very simple way: it contains animations which are made out of 8 frames (so called keyframes). Each frame is a complete draweable model in a specific position. 9 A frame is a collection of vertex and its compagnions (normals, texture coordinates). 10 11 A typical model has about 200 frames, the maximum frame count is fixed by MD2_MAX_FRAMES to currently 12 512 frames. The maximal vetices count is set to 2048 verteces, not enough? 13 You just have to change the MD2_MAX_* values if it doesn't fit your purposes... 7 14 */ 8 15 … … 21 28 #define MD2_MAX_FRAMESIZE (MD2_MAX_VERTICES * 4 + 128) 22 29 23 //! This holds the header information that is read in at the beginning of the file 30 //! This stores the speed of the animation between each key frame - currently conflicting with the animation framework 31 #define kAnimationSpeed 5.0f 32 33 //! This holds the header information that is read in at the beginning of the file: id software definition 24 34 struct tMd2Header 25 35 { 26 int magic; //!< This is used to identify the file36 int ident; //!< This is used to identify the file 27 37 int version; //!< The version number of the file (Must be 8) 38 28 39 int skinWidth; //!< The skin width in pixels 29 40 int skinHeight; //!< The skin height in pixels 30 41 int frameSize; //!< The size in bytes the frames are 42 31 43 int numSkins; //!< The number of skins associated with the model 32 44 int numVertices; //!< The number of vertices (constant for each frame) … … 35 47 int numGlCommands; //!< The number of gl commands 36 48 int numFrames; //!< The number of animation frames 49 37 50 int offsetSkins; //!< The offset in the file for the skin data 38 51 int offsetTexCoords; //!< The offset in the file for the texture data … … 71 84 }; 72 85 73 // This stores the animation scale, translation and name information for a frame, plus verts86 //! This stores the animation scale, translation and name information for a frame, plus verts 74 87 struct tMd2AliasFrame 75 88 { … … 80 93 }; 81 94 82 // This stores the frames vertices after they have been transformed95 //! This stores the frames vertices after they have been transformed 83 96 struct tMd2Frame 84 97 { … … 87 100 }; 88 101 89 // This stores a skin name102 //! This stores a skin name 90 103 typedef char tMd2Skin[64]; 91 104 92 105 93 //! A class for representating a MD2Model 94 class MD2Model : public AbstractModel { 106 //! A class for representating a MD2Model it handles also all of the loading code 107 class MD2Model : public AbstractModel 108 { 95 109 96 110 public: 97 111 MD2Model(); 98 112 virtual ~MD2Model(); 113 114 bool importMD2(t3DModel *pModel, char *strFileName, char *strTexture); 115 116 private: 117 void readMD2Data(); 118 void parseAnimations(t3DModel *pModel); 119 void convertDataStructures(t3DModel *pModel); 120 void computeNormals(t3DModel *pModel); 121 void cleanUp(); 122 123 FILE *m_FilePointer; 124 tMd2Header m_Header; //!< The header data 125 tMd2Skin *m_pSkins; //!< The skin data 126 tMd2TexCoord *m_pTexCoords; //!< The texture coordinates 127 tMd2Face *m_pTriangles; //!< Face index information 128 tMd2Frame *m_pFrames; //!< The frames of animation (vertices) 129 }; 99 130 100 131 101 };102 103 132 #endif /* _MD2MODEL_H */
Note: See TracChangeset
for help on using the changeset viewer.