Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8658 in orxonox.OLD for branches/bsp_model/src


Ignore:
Timestamp:
Jun 21, 2006, 3:12:57 AM (18 years ago)
Author:
patrick
Message:

bsp: md3 bone frame informtions read differently from the binary file, since there was a bug in the vertex infos

Location:
branches/bsp_model/src/lib/graphics/importer/md3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_data.cc

    r8654 r8658  
    456456
    457457  // reserver memory for the vertex informations
    458   this->meshes[mesh]->meshFrames = new sVec3D[this->meshes[mesh]->header->meshFrameNum * this->meshes[mesh]->header->vertexNum];
    459   this->meshes[mesh]->normals = new MD3Normal[this->meshes[mesh]->header->meshFrameNum * this->meshes[mesh]->header->vertexNum];
    460 
    461   for( int i = 0; i < this->meshes[mesh]->header->meshFrameNum * this->meshes[mesh]->header->vertexNum; i++)
     458  this->meshes[mesh]->meshFrames = new sVec3D*[this->meshes[mesh]->header->meshFrameNum]; // * this->meshes[mesh]->header->vertexNum
     459  this->meshes[mesh]->normals = new MD3Normal*[this->meshes[mesh]->header->meshFrameNum];
     460
     461  for( int i = 0; i < this->meshes[mesh]->header->meshFrameNum; i++)
    462462  {
    463     // read out the compressed data
    464     MD3VertexCompressed* vc = new MD3VertexCompressed;
    465     fread(vc, 1, sizeof(MD3VertexCompressed), pFile);
    466 
    467     this->meshes[mesh]->meshFrames[i][0] = (float)vc->vector[0] / 64.0f;
    468     this->meshes[mesh]->meshFrames[i][1] = (float)vc->vector[1] / 64.0f;
    469     this->meshes[mesh]->meshFrames[i][2] = (float)vc->vector[2] / 64.0f;
    470 
    471     this->meshes[mesh]->normals[i].vertexNormal[0] = (int)vc->vertexNormal[0];
    472     this->meshes[mesh]->normals[i].vertexNormal[1] = (int)vc->vertexNormal[1];
     463    this->meshes[mesh]->meshFrames[i] = new sVec3D[this->meshes[mesh]->header->vertexNum];
     464    this->meshes[mesh]->normals[i] = new MD3Normal[this->meshes[mesh]->header->vertexNum];
     465
     466    for( int j = 0; j < this->meshes[mesh]->header->vertexNum; j++)
     467    {
     468      // read out the compressed data
     469      MD3VertexCompressed* vc = new MD3VertexCompressed;
     470      fread(vc, 1, sizeof(MD3VertexCompressed), pFile);
     471
     472      this->meshes[mesh]->meshFrames[i][j][0] = (float)vc->vector[0] / 64.0f;
     473      this->meshes[mesh]->meshFrames[i][j][1] = (float)vc->vector[1] / 64.0f;
     474      this->meshes[mesh]->meshFrames[i][j][2] = (float)vc->vector[2] / 64.0f;
     475
     476      this->meshes[mesh]->normals[i][j].vertexNormal[0] = (int)vc->vertexNormal[0];
     477      this->meshes[mesh]->normals[i][j].vertexNormal[1] = (int)vc->vertexNormal[1];
    473478
    474479//     PRINTF(0)("nr: %i, meshframes: %f, %f, %f, normal: %f, %f\n", i, this->meshes[mesh]->meshFrames[i][0], this->meshes[mesh]->meshFrames[i][1],
    475480//     this->meshes[mesh]->meshFrames[i][2], this->meshes[mesh]->normals[i].vertexNormal[0], this->meshes[mesh]->normals[i].vertexNormal[1]);
    476481
    477     delete vc;
     482      delete vc;
     483    }
    478484  }
    479485
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_mesh.h

    r8490 r8658  
    7777    MD3Triangle*       triangles;               //!< indices into mesh frames and texture coord arrays
    7878    MD3TexVecs*        texVecs;                 //!< tex vecs coordinates
    79     sVec3D*            meshFrames;              //!< mesh frames
    80     MD3Normal*         normals;                 //!< 3d array of normals with spherical coordinates giving the dir of the vertex normal
     79    sVec3D**           meshFrames;              //!< mesh frames
     80    MD3Normal**        normals;                 //!< 3d array of normals with spherical coordinates giving the dir of the vertex normal
    8181
    8282};
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc

    r8657 r8658  
    168168        //interpolate mesh frame between the 2 current mesh frames
    169169        this->interpolateMeshFrame( data,
    170                                     &mesh->meshFrames[data->animationState.currentFrame],
    171                                     &mesh->meshFrames[data->animationState.nextFrame],
     170                                    mesh->meshFrames[data->animationState.currentFrame],
     171                                    mesh->meshFrames[data->animationState.nextFrame],
    172172                                    data->animationState.interpolationFraction, mesh, i);
    173173//       }
     
    188188          //interpolate vertex normals
    189189          this->interpolateVertexNormals(data,
    190                                          &mesh->normals[data->animationState.currentFrame],
    191                                          &mesh->normals[data->animationState.nextFrame],
     190                                         mesh->normals[data->animationState.currentFrame],
     191                                         mesh->normals[data->animationState.nextFrame],
    192192                                         data->animationState.interpolationFraction, mesh, i);
    193193        }
     
    305305        else {
    306306          //stick with current vertex normals
    307           this->drawVertexNormals(frame, &mesh->normals[data->animationState.currentFrame]);
     307          this->drawVertexNormals(frame, mesh->normals[data->animationState.currentFrame]);
    308308        }
    309309      }
Note: See TracChangeset for help on using the changeset viewer.