Changeset 8162 in orxonox.OLD for branches/osx/src/lib/graphics/importer/md2Model.cc
- Timestamp:
- Jun 5, 2006, 5:27:38 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/osx/src/lib/graphics/importer/md2Model.cc
r8122 r8162 80 80 _iptr[_l] = SDL_SwapLE32( _iptr[_l] );\ 81 81 } while( 0 ) 82 #define BULK_CONV16( _ptr, _num ) do { \ 83 short _cnt = _num;\ 84 short* _iptr = (short*)_ptr;\ 85 for( int _l = 0; _l<_cnt; ++_l )\ 86 _iptr[_l] = SDL_SwapLE16( _iptr[_l] );\ 87 } while( 0 ) 82 88 #else 83 89 #define BULK_CONV( _ptr, _num ) 90 #define BULK_CONV16( _ptr, _num ) 84 91 #endif 85 92 … … 111 118 this->setAnim(STAND); 112 119 113 this->debug();120 //this->debug(); 114 121 115 122 //write the modelinfo information … … 381 388 //PRINTF(0)("\n==========================| MD2Model::debug() |===\n"); 382 389 PRINTF(0)("= Model FileName:\t%s\n", this->data->fileName.c_str()); 383 PRINTF(0)("= Skin FileName:\t%s\n", this->data->skinFileName.c_str()); 384 PRINTF(0)("= Size in Memory:\t%i Bytes\n", this->data->header->frameSize * this->data->header->numFrames + 64); // 64bytes is the header size 390 PRINTF(0)("= Skin FileName:\t%s\n", 391 this->data->skinFileName.c_str()); 392 PRINTF(0)("= Size in Memory:\t%i Bytes\n", 393 this->data->header->frameSize * this->data->header->numFrames + 64); // 64bytes is the header size 385 394 PRINTF(0)("= Number of Vertices:\t%i\n", this->data->header->numVertices); 386 395 PRINTF(0)("= Number of Frames: \t%i\n", this->data->header->numFrames); … … 491 500 fseek(pFile, this->header->offsetFrames, SEEK_SET); 492 501 fread(buffer, this->header->frameSize, this->numFrames, pFile); 493 BULK_CONV( buffer, this->header->frameSize*this->numFrames*sizeof(char)/4 );502 //BULK_CONV( buffer, this->header->frameSize*this->numFrames*sizeof(char)/4 ); 494 503 /* read opengl commands */ 495 504 fseek(pFile, this->header->offsetGlCommands, SEEK_SET); … … 500 509 fseek(pFile, this->header->offsetTriangles, SEEK_SET); 501 510 fread(this->pTriangles, sizeof(sTriangle), this->numTriangles, pFile); 502 BULK_CONV ( this->pTriangles, this->numTriangles*(sizeof(sTriangle)/4));511 BULK_CONV16( this->pTriangles, this->numTriangles*sizeof(sTriangle)/2 ); 503 512 504 513 /* read in texture coordinates */ 505 514 fseek(pFile, this->header->offsetTexCoords, SEEK_SET); 506 515 fread(this->pTexCoor, sizeof(sTexCoor), this->numTexCoor, pFile); 507 BULK_CONV ( this->pTexCoor, this->numTexCoor*(sizeof(sTexCoor)/4));516 BULK_CONV16( this->pTexCoor, this->numTexCoor*sizeof(sTexCoor)/2 ); 508 517 509 518 for(int i = 0; i < this->numFrames; ++i) 510 519 { 511 520 frame = (sFrame*)(buffer + this->header->frameSize * i); 521 //Convert the translate and scale Vec3D if needed. 522 BULK_CONV( frame, 6 ); 523 BULK_CONV( frame->pVertices, 3 ); 512 524 pVertex = this->pVertices + this->numVertices * i; 513 525 pNormals = this->pLightNormals + this->numVertices * i;
Note: See TracChangeset
for help on using the changeset viewer.