Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8426 in orxonox.OLD for branches/bsp_model/src/lib/graphics


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

bsp: fixed some bugs in the data reading. there is still one in the texture reading func

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  
    101101      while( !(bBoneFrames && bTags && bMeshes))
    102102      {
    103         printf("while\n");
     103        printf("while, fileOffset = %i\n", fileOffset);
    104104        if( fileOffset == this->header->boneFrameStart && !bBoneFrames)
    105105        {
     
    156156int MD3Data::readHeader(FILE* pFile, int fileOffset)
    157157{
     158  PRINTF(0)("Reading Header\n");
     159
    158160  this->header = new MD3Header;
    159161  fread(this->header, 1, sizeof(MD3Header), pFile);
     
    182184int MD3Data::readBoneFrames(FILE* pFile, int fileOffset)
    183185{
     186  PRINTF(0)("Reading Bone Frames\n");
     187
    184188  this->boneFrames = new MD3BoneFrame*[this->header->boneFrameNum];
    185189
     
    202206int MD3Data::readTags(FILE* pFile, int fileOffset)
    203207{
     208  PRINTF(0)("Reading Tags\n");
    204209//  this->boneFrames = new MD3BoneFrame*[this->header->boneFrameNum];
    205210
     
    226231int MD3Data::readMeshes(FILE* pFile, int fileOffset)
    227232{
    228   int    localFileOffset = fileOffset;                          //!< local file offset
     233  PRINTF(0)("Reading Mesh Data\n");
     234
     235  int    localFileOffset = 0;                                      //!< local file offset
    229236
    230237  this->meshes = new MD3Mesh*[this->header->meshNum];
     
    234241    this->meshes[i] = new MD3Mesh();
    235242
     243    localFileOffset = 0;
    236244    bool   bTriangles, bTexVecs, bVertices, bTextures;            //!< the parts that have been read so far
    237245
     
    248256    }
    249257
     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
    250271    // check which parts to be loaded
    251272    bTriangles = ( this->meshes[i]->header->triangleNum == 0);
     
    257278    while( !(bTriangles && bTexVecs && bVertices && bTextures))
    258279    {
     280      PRINTF(0)("while2: localOffset = %i\n", localFileOffset);
    259281      if( localFileOffset == this->meshes[i]->header->triangleStart  && !bTriangles)
    260282      {
     
    279301    }
    280302  }
    281   return localFileOffset - fileOffset;
     303  return localFileOffset;
    282304}
    283305
     
    289311int MD3Data::readMeshTriangles(FILE* pFile, int fileOffset, int mesh)
    290312{
     313  PRINTF(0)("Reading Mesh Triangles\n");
    291314  // create the memomry to save the triangles
    292315  this->meshes[mesh]->triangles = new MD3Triangle[this->meshes[mesh]->header->triangleNum];
     
    302325int MD3Data::readMeshTextures(FILE* pFile, int fileOffset, int mesh)
    303326{
     327  PRINTF(0)("Reading Mesh Textures\n");
     328
    304329  // create the textures
    305330  this->meshes[mesh]->material = new Material[this->meshes[mesh]->header->textureNum];
     
    323348int MD3Data::readMeshTexVecs(FILE* pFile, int fileOffset, int mesh)
    324349{
     350  PRINTF(0)("Reading Mesh TexVecs\n");
    325351  this->meshes[mesh]->texVecs = new MD3TexVecs[this->meshes[mesh]->header->vertexNum];
    326352  fread(this->meshes[mesh]->texVecs, 1, sizeof(MD3TexVecs), pFile);
     
    335361int MD3Data::readMeshVertices(FILE* pFile, int fileOffset, int mesh)
    336362{
     363  PRINTF(0)("Reading Mesh Vertices\n");
     364
    337365  // reserver memory for the vertex informations
    338366  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  
    2727
    2828//! 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 md2 identifier tag in the bin file
     29#define MD3_IDENT                       (('3'<<24) + ('P'<<16) + ('D'<<8) + 'I') //!< the md3 identifier tag in the bin file
    3030#define MD3_VERSION                     15                                       //!< the md2 version in the header
    3131#define MD2_MAX_TRIANGLES               4096                                     //!< maximal triangles count
Note: See TracChangeset for help on using the changeset viewer.