Changeset 8550 in orxonox.OLD for branches/bsp_model/src/lib/graphics/importer/md3/md3_data.h
- Timestamp:
- Jun 17, 2006, 1:47:43 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/md3/md3_data.h
r8549 r8550 40 40 class MD3Mesh; 41 41 42 //! This holds the header information that is read in at the beginning of the file: id software definition43 struct MD3Header44 {45 int ident; //!< This is used to identify the file46 int version; //!< The version number of the file (Must be 8)42 //! This holds the header information that is read in at the beginning of the file: id software definition 43 typedef struct MD3Header 44 { 45 int ident; //!< This is used to identify the file 46 int version; //!< The version number of the file (Must be 8) 47 47 48 char filename[68]; //!< The filename of the model48 char filename[68]; //!< The filename of the model 49 49 50 int boneFrameNum; //!< number of frames51 int tagNum; //!< number of tags52 int meshNum; //!< number of mesh53 int maxTexNum; //!< number of texture50 int boneFrameNum; //!< number of frames 51 int tagNum; //!< number of tags 52 int meshNum; //!< number of mesh 53 int maxTexNum; //!< number of texture 54 54 55 int boneFrameStart; //!< start of bone frames56 int tagStart; //!< start of the tag57 int meshStart; //!< mesh start55 int boneFrameStart; //!< start of bone frames 56 int tagStart; //!< start of the tag 57 int meshStart; //!< mesh start 58 58 59 int fileSize; //!< file size 60 }; 59 int fileSize; //!< file size 60 }; 61 62 //!< holding the informations about the current animation state 63 typedef struct MD3AnimationState 64 { 65 int currentFrame; //!< currently rendered animation key frame of this model. Every part has its own current frame! 66 int nextFrame; //!< next animation key frame of the model. 67 float interpolationFraction; //!< interpolation position between currentFrame and nextFrame [0,1] 68 }; 69 70 71 //! class to store the md2 data in 72 class MD3Data : public BaseObject 73 { 74 public: 75 MD3Data(const std::string& modelFileName, const std::string& skinFileName, float scale = 1.0f); 76 virtual ~MD3Data(); 77 78 void addLinkedModel(int tagIndex, MD3Data* child); 79 80 81 private: 82 bool loadModel(const std::string& fileName); 83 bool loadSkin(const std::string& fileName = ""); 84 85 int readHeader(FILE* pFile, int fileOffset); 86 int readBoneFrames(FILE* pFile, int fileOffset); 87 int readTags(FILE* pFile, int fileOffset); 88 int readMeshes(FILE* pFile, int fileOffset); 89 90 91 int readMeshTriangles(FILE* pFile, int fileOffset, int mesh); 92 int readMeshTextures(FILE* pFile, int fileOffset, int mesh); 93 int readMeshTexVecs(FILE* pFile, int fileOffset, int mesh); 94 int readMeshVertices(FILE* pFile, int fileOffset, int mesh); 95 96 97 public: 98 99 MD3Header* header; //!< the header file 100 101 std::map<int, MD3Data*> sortedMap; //!< map 102 int parentTagIndex; //!< the tag index of the parent model 103 MD3Data* parent; //!< the parent model 104 105 std::string filename; //!< the name of the file as recorded in the .md3 file 106 std::string loadFilename; //!< filename of the actual file from which data was loaded 107 108 int boneFrameNum; //!< number of anumation key fames in the models 109 int tagNum; //!< number of tags 110 int meshNum; //!< number of meshes 111 112 int maxTextureNum; //!< maximum number of unique used in an md3 file 113 int boneFrameStart; //!< starting position of bone frame data structures 114 int tagStart; //!< starting position of tag-structures 115 116 int meshStart; //!< starting position of mesh structures 117 118 int fileSize; //!< file size 119 120 MD3AnimationState animationState; //!< the animation state of this model 121 122 MD3BoneFrame** boneFrames; //!< array of bone frames, contains the metadata (bounding box, tags,...) for each frame 123 MD3Mesh** meshes; //!< array of meshes in the model. each containing the mesh for each of the animation 61 124 62 125 63 126 64 //! class to store the md2 data in 65 class MD3Data : public BaseObject 66 { 67 public: 68 MD3Data(const std::string& modelFileName, const std::string& skinFileName, float scale = 1.0f); 69 virtual ~MD3Data(); 70 71 void addLinkedModel(int tagIndex, MD3Data* child); 72 73 74 private: 75 bool loadModel(const std::string& fileName); 76 bool loadSkin(const std::string& fileName = ""); 77 78 int readHeader(FILE* pFile, int fileOffset); 79 int readBoneFrames(FILE* pFile, int fileOffset); 80 int readTags(FILE* pFile, int fileOffset); 81 int readMeshes(FILE* pFile, int fileOffset); 82 83 84 int readMeshTriangles(FILE* pFile, int fileOffset, int mesh); 85 int readMeshTextures(FILE* pFile, int fileOffset, int mesh); 86 int readMeshTexVecs(FILE* pFile, int fileOffset, int mesh); 87 int readMeshVertices(FILE* pFile, int fileOffset, int mesh); 88 89 90 public: 91 92 MD3Header* header; //!< the header file 93 94 std::map<int, MD3Data*> sortedMap; //!< map 95 int parentTagIndex; //!< the tag index of the parent model 96 MD3Data* parent; //!< the parent model 97 98 std::string filename; //!< the name of the file as recorded in the .md3 file 99 std::string loadFilename; //!< filename of the actual file from which data was loaded 100 101 int boneFrameNum; //!< number of anumation key fames in the models 102 int tagNum; //!< number of tags 103 int meshNum; //!< number of meshes 104 105 int maxTextureNum; //!< maximum number of unique used in an md3 file 106 int boneFrameStart; //!< starting position of bone frame data structures 107 int tagStart; //!< starting position of tag-structures 108 109 int meshStart; //!< starting position of mesh structures 110 111 int fileSize; //!< file size 112 113 114 MD3BoneFrame** boneFrames; //!< array of bone frames, contains the metadata (bounding box, tags,...) for each frame 115 MD3Mesh** meshes; //!< array of meshes in the model. each containing the mesh for each of the animation 116 117 }; 127 }; 118 128 119 129
Note: See TracChangeset
for help on using the changeset viewer.