Changeset 8426 in orxonox.OLD for branches/bsp_model/src/lib/graphics/importer
- Timestamp:
- Jun 15, 2006, 12:20:38 AM (18 years ago)
- Location:
- branches/bsp_model/src/lib/graphics/importer/md3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/md3/md3_data.cc
r8423 r8426 101 101 while( !(bBoneFrames && bTags && bMeshes)) 102 102 { 103 printf("while \n");103 printf("while, fileOffset = %i\n", fileOffset); 104 104 if( fileOffset == this->header->boneFrameStart && !bBoneFrames) 105 105 { … … 156 156 int MD3Data::readHeader(FILE* pFile, int fileOffset) 157 157 { 158 PRINTF(0)("Reading Header\n"); 159 158 160 this->header = new MD3Header; 159 161 fread(this->header, 1, sizeof(MD3Header), pFile); … … 182 184 int MD3Data::readBoneFrames(FILE* pFile, int fileOffset) 183 185 { 186 PRINTF(0)("Reading Bone Frames\n"); 187 184 188 this->boneFrames = new MD3BoneFrame*[this->header->boneFrameNum]; 185 189 … … 202 206 int MD3Data::readTags(FILE* pFile, int fileOffset) 203 207 { 208 PRINTF(0)("Reading Tags\n"); 204 209 // this->boneFrames = new MD3BoneFrame*[this->header->boneFrameNum]; 205 210 … … 226 231 int MD3Data::readMeshes(FILE* pFile, int fileOffset) 227 232 { 228 int localFileOffset = fileOffset; //!< local file offset 233 PRINTF(0)("Reading Mesh Data\n"); 234 235 int localFileOffset = 0; //!< local file offset 229 236 230 237 this->meshes = new MD3Mesh*[this->header->meshNum]; … … 234 241 this->meshes[i] = new MD3Mesh(); 235 242 243 localFileOffset = 0; 236 244 bool bTriangles, bTexVecs, bVertices, bTextures; //!< the parts that have been read so far 237 245 … … 248 256 } 249 257 258 PRINTF(0)("MD3 Mesh Header debug section\n"); 259 printf("ident: %i\n", md->id); 260 printf("filename: %s\n", md->name); 261 printf("meshFrameNum: %i\n", md->meshFrameNum); 262 printf("textureNum: %i\n", md->textureNum); 263 printf("vertexNum: %i \n", md->vertexNum); 264 printf("triangleNum: %i\n", md->triangleNum); 265 printf("triangleStart: %i\n", md->triangleStart); 266 printf("textureStart: %i\n", md->textureStart); 267 printf("texVecStart: %i\n", md->texVecStart); 268 printf("vertexStart: %i\n", md->vertexStart); 269 printf("fileSize: %i\n", md->meshSize); 270 250 271 // check which parts to be loaded 251 272 bTriangles = ( this->meshes[i]->header->triangleNum == 0); … … 257 278 while( !(bTriangles && bTexVecs && bVertices && bTextures)) 258 279 { 280 PRINTF(0)("while2: localOffset = %i\n", localFileOffset); 259 281 if( localFileOffset == this->meshes[i]->header->triangleStart && !bTriangles) 260 282 { … … 279 301 } 280 302 } 281 return localFileOffset - fileOffset;303 return localFileOffset; 282 304 } 283 305 … … 289 311 int MD3Data::readMeshTriangles(FILE* pFile, int fileOffset, int mesh) 290 312 { 313 PRINTF(0)("Reading Mesh Triangles\n"); 291 314 // create the memomry to save the triangles 292 315 this->meshes[mesh]->triangles = new MD3Triangle[this->meshes[mesh]->header->triangleNum]; … … 302 325 int MD3Data::readMeshTextures(FILE* pFile, int fileOffset, int mesh) 303 326 { 327 PRINTF(0)("Reading Mesh Textures\n"); 328 304 329 // create the textures 305 330 this->meshes[mesh]->material = new Material[this->meshes[mesh]->header->textureNum]; … … 323 348 int MD3Data::readMeshTexVecs(FILE* pFile, int fileOffset, int mesh) 324 349 { 350 PRINTF(0)("Reading Mesh TexVecs\n"); 325 351 this->meshes[mesh]->texVecs = new MD3TexVecs[this->meshes[mesh]->header->vertexNum]; 326 352 fread(this->meshes[mesh]->texVecs, 1, sizeof(MD3TexVecs), pFile); … … 335 361 int MD3Data::readMeshVertices(FILE* pFile, int fileOffset, int mesh) 336 362 { 363 PRINTF(0)("Reading Mesh Vertices\n"); 364 337 365 // reserver memory for the vertex informations 338 366 this->meshes[mesh]->meshFrames = new sVec3D[this->meshes[mesh]->header->meshFrameNum * this->meshes[mesh]->header->vertexNum]; -
branches/bsp_model/src/lib/graphics/importer/md3/md3_data.h
r8382 r8426 27 27 28 28 //! These are the needed defines for the max values when loading .MD2 files 29 #define MD3_IDENT ((' 4'<<24) + ('P'<<16) + ('D'<<8) + 'I') //!< the md2identifier tag in the bin file29 #define MD3_IDENT (('3'<<24) + ('P'<<16) + ('D'<<8) + 'I') //!< the md3 identifier tag in the bin file 30 30 #define MD3_VERSION 15 //!< the md2 version in the header 31 31 #define MD2_MAX_TRIANGLES 4096 //!< maximal triangles count
Note: See TracChangeset
for help on using the changeset viewer.