Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jun 15, 2006, 1:24:23 AM (18 years ago)
Author:
patrick
Message:

bsp: md3 data gets loaded correctly as it seems

File:
1 edited

Legend:

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

    r8433 r8436  
    369369  this->meshes[mesh]->normals = new MD3Normal[this->meshes[mesh]->header->meshFrameNum * this->meshes[mesh]->header->vertexNum];
    370370
    371   // read out the compressed data
    372   MD3VertexCompressed* vc = new MD3VertexCompressed[this->meshes[mesh]->header->meshFrameNum * this->meshes[mesh]->header->vertexNum];
    373   fread(vc, 1, sizeof(MD3VertexCompressed) * this->meshes[mesh]->header->meshFrameNum * this->meshes[mesh]->header->vertexNum, pFile);
    374 
    375   int index;
    376 
    377   for( int i = 0; i < this->meshes[mesh]->header->meshFrameNum; i++)
     371  for( int i = 0; i < this->meshes[mesh]->header->meshFrameNum * this->meshes[mesh]->header->vertexNum; i++)
    378372  {
    379     for( int j = 0; j < this->meshes[mesh]->header->vertexNum; j++)
    380     {
    381       index = i * this->meshes[mesh]->header->meshFrameNum + j;
    382       this->meshes[mesh]->meshFrames[index][0] = (float)vc[index].vector[0] / 64.0f;
    383       this->meshes[mesh]->meshFrames[index][1] = (float)vc[index].vector[1] / 64.0f;
    384       this->meshes[mesh]->meshFrames[index][2] = (float)vc[index].vector[2] / 64.0f;
    385 
    386       this->meshes[mesh]->normals[index].vertexNormal[0] = vc[index].vertexNormal[0];
    387       this->meshes[mesh]->normals[index].vertexNormal[1] = vc[index].vertexNormal[1];
    388     }
     373    // read out the compressed data
     374    MD3VertexCompressed* vc = new MD3VertexCompressed;
     375    fread(vc, 1, sizeof(MD3VertexCompressed), pFile);
     376
     377    this->meshes[mesh]->meshFrames[i][0] = (float)vc->vector[0] / 64.0f;
     378    this->meshes[mesh]->meshFrames[i][1] = (float)vc->vector[1] / 64.0f;
     379    this->meshes[mesh]->meshFrames[i][2] = (float)vc->vector[2] / 64.0f;
     380
     381    this->meshes[mesh]->normals[i].vertexNormal[0] = vc->vertexNormal[0];
     382    this->meshes[mesh]->normals[i].vertexNormal[1] = vc->vertexNormal[1];
    389383  }
    390384
    391385  // delete the temp memory again
    392   delete [] vc;
     386//   delete vc;
    393387
    394388  return this->meshes[mesh]->header->meshFrameNum * this->meshes[mesh]->header->vertexNum * sizeof(MD3VertexCompressed);
Note: See TracChangeset for help on using the changeset viewer.