Changeset 8375 in orxonox.OLD for branches/bsp_model/src/lib
- Timestamp:
- Jun 14, 2006, 11:59:40 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
r8374 r8375 224 224 int MD3Data::readMeshes(FILE* pFile, int fileOffset) 225 225 { 226 int localFileOffset = fileOffset; //!< local file offset 227 226 228 this->meshes = new MD3Mesh*[this->header->meshNum]; 227 229 … … 230 232 this->meshes[i] = new MD3Mesh(); 231 233 232 bool bTriangles, bTexVecs, bVertices, bTextures; //!< the parts that have been read so far234 bool bTriangles, bTexVecs, bVertices, bTextures; //!< the parts that have been read so far 233 235 234 236 //start reading mesh data 235 237 MD3MeshHeader* md = new MD3MeshHeader; 238 fread(md, 1, sizeof(MD3MeshHeader), pFile); 239 this->meshes[i]->header = md; 240 localFileOffset += sizeof(MD3MeshHeader); 241 242 if( unlikely(this->meshes[i]->header->id != MD3_IDENT)) 243 { 244 PRINTF(1)("Wrong MD3 mesh file tag, file %s could be corrupt\n", this->filename.c_str()); 245 return false; 246 } 247 248 // check which parts to be loaded 249 bTriangles = ( this->meshes[i]->header->triangleNum == 0); 250 bTexVecs = ( this->meshes[i]->header->vertexNum == 0); 251 bVertices = ( this->meshes[i]->header->meshFrameNum == 0); 252 bTextures = ( this->meshes[i]->header->textureNum == 0); 253 254 // now read the data block whise 255 while( !(bTriangles && bTexVecs && bVertices && bTextures)) 256 { 257 if( localFileOffset == this->meshes[i]->header->triangleStart && !bTriangles) 258 { 259 localFileOffset += this->readMeshTriangles(pFile, localFileOffset); 260 bTriangles = true; 261 } 262 else if( localFileOffset == this->meshes[i]->header->textureStart && !bTextures) 263 { 264 fileOffset += this->readMeshTextures(pFile, localFileOffset); 265 bTextures = true; 266 } 267 else if( localFileOffset == this->meshes[i]->header->texVecStart && !bTexVecs) 268 { 269 localFileOffset += this->readMeshTexVecs(pFile, localFileOffset); 270 bTexVecs = true; 271 } 272 else if( fileOffset == this->meshes[i]->header->vertexStart && !bVertices) 273 { 274 localFileOffset += this->readMeshVertices(pFile, localFileOffset); 275 bVertices = true; 276 } 277 } 236 278 } 237 return 0;238 } 239 240 } 241 279 return localFileOffset - fileOffset; 280 } 281 282 } 283 -
branches/bsp_model/src/lib/graphics/importer/md3/md3_data.h
r8372 r8375 89 89 90 90 91 int readMeshTriangles(FILE* pFile, int fileOffset); 92 int readMeshTextures(FILE* pFile, int fileOffset); 93 int readMeshTexVecs(FILE* pFile, int fileOffset); 94 int readMeshVertices(FILE* pFile, int fileOffset); 95 91 96 public: 92 97
Note: See TracChangeset
for help on using the changeset viewer.