Changeset 8354 in orxonox.OLD for branches/bsp_model/src/lib
- Timestamp:
- Jun 14, 2006, 1:41:58 AM (18 years ago)
- Location:
- branches/bsp_model/src/lib/graphics/importer/md3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/md3/md3_data.cc
r8353 r8354 47 47 this->fileName = ""; 48 48 this->skinFileName = ""; 49 50 49 51 this->loadModel(modelFileName); 50 this->loadSkin(skinFileName);52 // this->loadSkin(skinFileName); 51 53 } 52 54 … … 78 80 FILE *pFile; //file stream 79 81 // char* buffer; //buffer for frame data 82 int fileOffset = 0; // file data offset 80 83 81 84 … … 85 88 return false; 86 89 90 PRINTF(0)("opening file: %s\n", fileName.c_str()); 87 91 pFile = fopen(fileName.c_str(), "rb"); 88 92 if( unlikely(!pFile)) … … 93 97 this->header = new MD3Header; 94 98 fread(this->header, 1, sizeof(MD3Header), pFile); 99 fileOffset += sizeof(MD3Header); 95 100 /* check for the header version: make sure its a md2 file :) */ 96 if( unlikely(this->header->version != MD 2_VERSION) && unlikely(this->header->ident != MD2_IDENT))101 if( unlikely(this->header->version != MD3_VERSION) && unlikely(this->header->ident != MD3_IDENT)) 97 102 { 98 103 PRINTF(1)("Couldn't load file %s: invalid file format: stop loading\n", fileName.c_str()); … … 100 105 } 101 106 102 107 //header debug: 108 PRINTF(0)("MD3 Header debug section======================================\n"); 109 printf("ident: %i\n", this->header->ident); 110 printf("version: %i\n", this->header->version); 111 printf("filename: %s\n", this->header->filename); 112 printf("boneFrameNum: %i\n", this->header->boneFrameNum); 113 printf("tag number: %i\n", this->header->tagNum); 114 printf("mesh number: %i\n", this->header->meshNum); 115 printf("max tex num: %i\n", this->header->maxTexNum); 116 printf("bone frame start: %i\n", this->header->boneFrameStart); 117 printf("tag start: %i\n", this->header->tagStart); 118 printf("mesh start: %i\n", this->header->meshStart); 119 printf("fileSize: %i\n", this->header->fileSize); 120 121 122 // check if the filesize is correct 123 if( this->header->fileSize > this->header->tagStart && 124 this->header->fileSize >= this->header->meshStart) 125 { 126 bool bBoneFrames, bTags, bMeshes; 127 bBoneFrames = ( this->header->boneFrameNum == 0); 128 bTags = ( this->header->tagNum == 0); 129 bMeshes = ( this->header->meshNum == 0); 130 131 // read different parts of the model in correct order 132 while( !(bBoneFrames && bTags && bMeshes)) 133 { 134 if( fileOffset == this->header->boneFrameStart && !bBoneFrames) 135 {} 136 else if( fileOffset == this->header->tagStart && !bTags) 137 {} 138 else if( fileOffset == this->header->meshStart && !bMeshes) 139 {} 140 } 141 142 } 103 143 104 144 #if 0 -
branches/bsp_model/src/lib/graphics/importer/md3/md3_data.h
r8353 r8354 27 27 28 28 //! These are the needed defines for the max values when loading .MD2 files 29 #define MD 2_IDENT (('2'<<24) + ('P'<<16) + ('D'<<8) + 'I') //!< the md2 identifier tag in the bin file30 #define MD 2_VERSION 8//!< the md2 version in the header29 #define MD3_IDENT (('4'<<24) + ('P'<<16) + ('D'<<8) + 'I') //!< the md2 identifier tag in the bin file 30 #define MD3_VERSION 15 //!< the md2 version in the header 31 31 #define MD2_MAX_TRIANGLES 4096 //!< maximal triangles count 32 32 #define MD2_MAX_VERTICES 2048 //!< maximal vertices count … … 58 58 int meshNum; //!< number of mesh 59 59 int maxTexNum; //!< number of texture 60 60 61 int boneFrameStart; //!< start of bone frames 61 62 int tagStart; //!< start of the tag 62 63 int meshStart; //!< mesh start 64 63 65 int fileSize; //!< file size 64 66 }; -
branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc
r8353 r8354 17 17 #include "md3_model.h" 18 18 19 #include "md3_data.h" 19 20 20 21 … … 27 28 MD3Model::MD3Model(std::string filename, float scaling) 28 29 { 29 30 this->md3Data = new MD3Data(filename, filename, scaling); 30 31 } 31 32 -
branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h
r8353 r8354 13 13 14 14 15 class MD3BoneFrame;16 class MD3Mesh;17 18 19 15 namespace md3 20 16 { 17 18 class MD3BoneFrame; 19 class MD3Mesh; 20 class MD3Data; 21 21 22 22 class MD3Model : public Model … … 30 30 31 31 private: 32 MD3Data* md3Data; //!< reference to the md3 model data 33 32 34 std::string filename; //!< the name of the file as recorded in the .md3 file 33 35 std::string loadFilename; //!< filename of the actual file from which data was loaded
Note: See TracChangeset
for help on using the changeset viewer.