Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 15, 2006, 12:55:56 AM (18 years ago)
Author:
patrick
Message:

bsp: fixed a bad md3 reading bug, forgot to read one character and the chaos started…

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

    r8428 r8432  
    207207{
    208208  PRINTF(0)("Reading Tags\n");
    209 //  this->boneFrames = new MD3BoneFrame*[this->header->boneFrameNum];
    210209
    211210  for( int i = 0; i < this->header->boneFrameNum; i++)
     
    233232  PRINTF(0)("Reading Mesh Data\n");
    234233
    235   int    localFileOffset = 0;                                      //!< local file offset
     234  fileOffset = 0;
    236235
    237236  this->meshes = new MD3Mesh*[this->header->meshNum];
     
    241240    this->meshes[i] = new MD3Mesh();
    242241
    243     localFileOffset = 0;
     242    int localFileOffset = 0;
    244243    bool   bTriangles, bTexVecs, bVertices, bTextures;            //!< the parts that have been read so far
    245244
     
    249248    this->meshes[i]->header = md;
    250249    localFileOffset += sizeof(MD3MeshHeader);
    251 
    252     if( unlikely(this->meshes[i]->header->id != MD3_IDENT))
    253     {
    254       PRINTF(1)("Wrong MD3 mesh file tag, file %s could be corrupt\n", this->filename.c_str());
    255       return false;
    256     }
    257250
    258251    PRINTF(0)("MD3 Mesh Header debug section\n");
     
    268261    printf("vertexStart: %i\n", md->vertexStart);
    269262    printf("fileSize: %i\n", md->meshSize);
     263
     264    if( unlikely(this->meshes[i]->header->id != MD3_IDENT))
     265    {
     266      PRINTF(1)("Wrong MD3 mesh file tag, file %s could be corrupt\n", this->filename.c_str());
     267      return false;
     268    }
    270269
    271270    // check which parts to be loaded
     
    300299      }
    301300    }
     301    fileOffset += localFileOffset;
     302    PRINTF(0)("finished reading mesh %i, got %i of %i byes\n", i, localFileOffset, md->meshSize);
    302303  }
    303   return localFileOffset;
     304  return fileOffset;
    304305}
    305306
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_tag.h

    r8372 r8432  
    1818typedef struct MD3TagData
    1919{
    20   sVec3D     position;
    21   float      matrix[3][3];
     20  char       name[64];                                //!< name of the tag
     21  sVec3D     position;                                //!< position of the tag
     22  float      matrix[3][3];                            //!< matrix of the rotation
    2223};
    2324
Note: See TracChangeset for help on using the changeset viewer.